This crate provides a Rust native core model for the AWS Smithy Interface Definition Language.
This crate is the foundation for the Atelier set of crates, and provides the following components:
error module to be used by all Atelier crates.The following example demonstrates the builder interface to create a model for a simple service. The
service, MessageOfTheDay has a single resource Message. The resource has an identifier for the
date, but the read operation does not make the date member required and so will return the message
for the current date.
```rust use ateliercore::error::ErrorSource; use ateliercore::model::builder::values::{ArrayBuilder, ObjectBuilder}; use ateliercore::model::builder::{ Builder, ListBuilder, MemberBuilder, ModelBuilder, OperationBuilder, ResourceBuilder, ServiceBuilder, ShapeTraits, SimpleShapeBuilder, StructureBuilder, TraitBuilder, }; use ateliercore::model::{Identifier, Model, ShapeID};
fn makemodel() -> Model { ModelBuilder::new(Version::V10, "example.motd") .service( ServiceBuilder::new("MessageOfTheDay", "2020-06-21") .documentation("Provides a Message of the day.") .resource("Message") .into(), ) .resource( ResourceBuilder::new("Message") .identifier("date", "Date") .read("GetMessage") .into(), ) .simpleshape( SimpleShapeBuilder::string("Date") .applytrait(traits::pattern(r"^\d\d\d\d-\d\d-\d\d$")) .into(), ) .operation( OperationBuilder::new("GetMessage") .readonly() .input("GetMessageInput") .output("GetMessageOutput") .error("BadDateValue") .into(), ) .structure( StructureBuilder::new("GetMessageInput") .member("date", "Date") .into(), ) .structure( StructureBuilder::new("GetMessageOutput") .addmember(MemberBuilder::string("message").required().into()) .into(), ) .structure( StructureBuilder::new("BadDateValue") .errorsource(ErrorSource::Client) .addmember(MemberBuilder::string("errorMessage").required().into()) .into(), ) .into() } ``` */
The example weather_builder.rs in the examples directory uses the complete example from the Smithy quick start guide. The
examples directory also includes a pair of stand-alone examples, using the semantic model and builder APIs, for the
message of the day service shown in the example above.
As usual these can be executed via cargo in the following manner.
bash
$ cargo run --example weather_builder
$ cargo run --example motd_core
$ cargo run --example motd_builder
Version 0.2.1
MutableModelVisitor trait.Version 0.2.0
Version 0.1.5
UnwelcomeTerms linter.ModelReader and ModelWriter;
representation methodActionIssue an std::error::Error.ModelVisitor to action module.Model::merge method.Version 0.1.4
NoOrphanedReferences validator.CorrectTypeReferences validator.NamingConventions linter.run_linter_actions and run_validation_actions, and removed ValidateAll type.REPRESENTATION to representation() on ModelReader and ModelWriter traits.Version 0.1.3
Writer implementations features.syntax for all string constants.ShapeIDs to the module prelude.Model::resolve_id according to the Smithy spec.Version 0.1.2
HasMembers trait for a more un-typed API,Version 0.1.1
build methods to use Into<T>,Version 0.1.0