the-sett / elm-aws-core / AWS.ServiceSpec

Provides the data model for an AWS Service Descriptor, and a codec for that model to encode/decode it from JSON.

All AWS services also have a specification, that describes the data model that the service accepts or produces, and the endpoint that the service provides. It is a similar concept to a Swagger or OpenAPI specification; the format is not the same but the function is. The format is specific to AWS, and is encoded as JSON. The most relevant place to find these service descriptors is here:

https://github.com/aws/aws-sdk-js/tree/master/apis

These service specifications are not needed to call the services. They are meta data describing the services, and can be useful for things such code generation. They are not an essential part of the elm-aws-core package, but the data model is included here for convenience.

The JSON encoders and decoders for the service specification.

awsServiceDecoder : Json.Decode.Decoder ServiceSpec

A JSON decoder for the service specification.

awsServiceEncoder : ServiceSpec -> Json.Encode.Value

A JSON encoder for the service specification.

The service spec data model.


type alias ServiceSpec =
{ metaData : MetaData
, operations : Dict String Operation
, shapes : Dict String Shape
, authorizers : Maybe Authorizers
, documentation : Maybe String
, version : Maybe String 
}

The AWS service specification data model.


type AWSType
    = AString
    | ABoolean
    | AInteger
    | ALong
    | AFloat
    | ADouble
    | ABlob
    | AStructure
    | AList
    | AMap
    | ATimestamp
    | AUnknown

The basic data types that AWS uses to define its service data model.


type alias AuthorizationStrategy =
{ name : String
, placement : Placement
, type_ : String 
}

An authorization strategy.


type alias Authorizers =
{ authorization_strategy : AuthorizationStrategy }

The service authorizers.


type HttpMethod
    = DELETE
    | GET
    | HEAD
    | OPTIONS
    | POST
    | PUT
    | PATCH

The HTTP method used to invoke a service.


type Location
    = Header
    | QueryString
    | StatusCode
    | Uri
    | Body

Describes the possible locations that a parameter being passed to or received from a service can occupy; is it in the HTTP header, body, query and so on.


type alias MetaData =
{ apiVersion : String
, endpointPrefix : String
, protocol : AWS.Config.Protocol
, serviceId : String
, checksumFormat : Maybe String
, globalEndpoint : Maybe String
, jsonVersion : Maybe String
, serviceAbbreviation : Maybe String
, serviceFullName : Maybe String
, signatureVersion : Maybe AWS.Config.Signer
, signingName : Maybe String
, targetPrefix : Maybe String
, uid : Maybe String
, xmlNamespace : Maybe String 
}

The service meta data.


type alias Operation =
{ http : Http
, name : String
, alias : Maybe String
, authtype : Maybe String
, deprecated : Maybe Basics.Bool
, deprecatedMessage : Maybe String
, documentation : Maybe String
, documentationUrl : Maybe String
, endpoint : Maybe Endpoint
, errors : Maybe (List ShapeRef)
, idempotent : Maybe Basics.Bool
, input : Maybe ShapeRef
, output : Maybe ShapeRef 
}

A descriptor for a service endpoint.


type alias Shape =
{ type_ : AWSType
, box : Maybe Basics.Bool
, deprecated : Maybe Basics.Bool
, deprecatedMessage : Maybe String
, documentation : Maybe String
, enum : Maybe (List String)
, error : Maybe Error
, event : Maybe Basics.Bool
, eventstream : Maybe Basics.Bool
, exception : Maybe Basics.Bool
, fault : Maybe Basics.Bool
, flattened : Maybe Basics.Bool
, key : Maybe ShapeRef
, locationName : Maybe String
, max : Maybe Basics.Int
, member : Maybe ShapeRef
, members : Maybe (Dict String ShapeRef)
, min : Maybe Basics.Int
, pattern : Maybe String
, payload : Maybe String
, required : Maybe (List String)
, sensitive : Maybe Basics.Bool
, streaming : Maybe Basics.Bool
, timestampFormat : Maybe AWS.Config.TimestampFormat
, value : Maybe ShapeRef
, wrapper : Maybe Basics.Bool
, xmlNamespace : Maybe String
, xmlOrder : Maybe (List String) 
}

A data model descriptor


type alias ShapeRef =
{ shape : String
, box : Maybe Basics.Bool
, deprecated : Maybe Basics.Bool
, deprecatedMessage : Maybe String
, documentation : Maybe String
, eventpayload : Maybe Basics.Bool
, flattened : Maybe Basics.Bool
, idempotencyToken : Maybe String
, jsonvalue : Maybe Basics.Bool
, location : Location
, locationName : Maybe String
, queryName : Maybe String
, resultWrapper : Maybe String
, streaming : Maybe Basics.Bool
, timestampFormat : Maybe AWS.Config.TimestampFormat
, xmlAttribute : Maybe String
, xmlNamespace : Maybe String 
}

A reference to a data model.