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, SimpleShapeBuilder, StructureBuilder, TraitBuilder, }; use ateliercore::model::{Identifier, Model, ShapeID};
let model = ModelBuilder::new("example.motd") .shape( ServiceBuilder::new("MessageOfTheDay") .documentation("Provides a Message of the day.") .version("2020-06-21") .resource("Message") .into(), ) .shape( ResourceBuilder::new("Message") .identifier("date", "Date") .read("GetMessage") .into(), ) .shape( SimpleShapeBuilder::string("Date") .addtrait(TraitBuilder::pattern(r"^\d\d\d\d-\d\d-\d\d$").into()) .into(), ) .shape( OperationBuilder::new("GetMessage") .readonly() .input("GetMessageInput") .output("GetMessageOutput") .error("BadDateValue") .into(), ) .shape( StructureBuilder::new("GetMessageInput") .addmember( MemberBuilder::new("date") .refersto("Date") .into(), ) .into(), ) .shape( StructureBuilder::new("GetMessageOutput") .addmember(MemberBuilder::string("message").required().into()) .into(), ) .shape( StructureBuilder::new("BadDateValue") .error(ErrorSource::Client) .add_member(MemberBuilder::string("errorMessage").required().into()) .into(), ) .into(); ``` */
Currently, there is simply one complete example, weather.rs in the examples directory. As usual this is executed via
cargo in the following manner. It will print, using Debug, the weather example model from the Smithy quick start.
bash
$ cargo run --example weather
Version 0.1.1 (in progress)
build methods to use Into<T>.Version 0.1.0