Skip to content
Juli Tera edited this page Aug 6, 2024 · 34 revisions

This wiki covers the public features and designs for a generated Ruby SDK using Smithy.

Protocols

  • Rails JSON - Implements a JSON protocol that communicates with Rails APIs.

Public Components and Features

Generated SDKs from smithy-ruby supports the following public features:

  • Client - The Client class is the public interface used for interacting with the service. The Client has methods for each operation defined by the API. Clients have a 1:1 mapping with a Smithy service shape and its public methods have a 1:1 mapping with Smithy operation shapes.

  • Config - The Config class is an immutable struct that contains the options that will be used by the Client. It can resolve default value chains and validates provided values against expected types. Config classes have a 1:1 mapping with a Smithy service shape.

  • Types - Types are light-weight classes that contain shape data. Types are built from params on input and populated by service responses on output. Types have a 1:1 mapping to Smithy structure shapes, enum shapes, and union shapes.

  • Errors - Errors are a collection of classes that represent generic service errors and modeled Smithy error shapes. Error have a 1:1 mapping to Smithy structure shapes modeled with the error trait.

  • Paginators - Paginators are classes that provide an abstraction for paginating operations. These classes provide enumerators that will automatically iterate the paginated responses and items. Paginators have a 1:1 mapping to Smithy operation shapes modeled with the pagination trait.

  • Waiters - Waiters are classes that provide an abstraction for polling operations until desired states are reached. Waiters have a 1:1 mapping to each waiter definition on the waitable trait across all Smithy operation shapes.

  • Interceptors - Interceptors provide lifecycle hooks into the SDK. Interceptors have the ability to read or modify the input, output, request, or response objects during operation execution.

  • Plugins - Plugins are distributable classes that modify Config to add custom behavior.

  • Retries - Retries are performed when the encountered error is a throttling error, transient error, server error, or a modeled error marked with the retryable trait. Retry Strategies can customize when and how to perform a retry.

  • Stub Responses - Stubbed responses are a feature that allows for mocking responses during testing. Mocked responses do not use the network.

  • Identity and Auth - Identities, Identity Resolvers, Auth Schemes, Auth Resolvers, and Signers are components that are used to authenticate a request with a service. Smithy supports many authentication schemes using modeled authentication traits.

  • HTTP Client - The HTTP client is a class that handles transmission of a Request object over the network and populates a Response object.

  • Endpoints - Endpoints and Endpoint Providers are mechanisms for configuring and resolving endpoints. Endpoint Providers have a 1:1 mapping to Smithy service shapes.

  • Observability (Telemetry) - This feature allows operations to be instrumented and be observable. Telemetry classes contain pre-determined telemetry data for each operation to emit.

Private Components

These are listed just for reference.

  • Params - Params are modules that convert user provided input into rigid shapes used by middleware. Params have a 1:1 mapping to Smithy shapes.

  • Validators - Validators are classes that provide a method for validating Ruby input types against the Smithy model. Validators have a 1:1 mapping to Smithy input structure shapes.

  • Builders and Parsers - Builders and parsers are protocol specific classes that build a request using operation input and parse a response into an output object. Builders and parsers have a 1:1 mapping to Smithy complex shapes (Structure, List, Map, Operation).

  • Stubs - Stubs are classes that build a network response from provided values instead of performing a real network call. They are used in tests to control output. Stubs have a 1:1 mapping to Smithy structure shapes.

  • Middleware - Middleware is used to handle the request from start to finish. Each middleware is responsible for performing some action (build, parse, validate, retry, etc) and then hand the request off to the next middleware. Middleware classes have a 1:1 mapping with Smithy operation shapes.

Smithy Trait Designs