model

package
v0.0.0-...-fd97e0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2016 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package model contains functionality to generate clients for AWS APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(w io.Writer) error

Generate writes a Go file with a client for using the parsed service.

func Load

func Load(name string, r io.Reader) error

Load parses the given JSON input and loads it into the singleton instance of the package.

Types

type Constraint

type Constraint []interface{}

A Constraint is a set of constraints on input types.

func (Constraint) Condition

func (c Constraint) Condition() string

Condition returns a Go fragment which matches the constraint.

type CredentialScope

type CredentialScope struct {
	Region  string
	Service string
}

CredentialScope is a set of overrides for the service region and name.

type Endpoint

type Endpoint struct {
	Name        string
	URI         string
	Properties  Properties
	Constraints []Constraint
}

An Endpoint is an URL where a service is available.

func (Endpoint) Conditions

func (e Endpoint) Conditions() string

Conditions returns the conjunction of the conditions for the endpoint.

func (Endpoint) Region

func (e Endpoint) Region() string

Region returns the Go literal or variable for the region.

func (Endpoint) Service

func (e Endpoint) Service() string

Service returns the Go literal or variable for the service.

type Endpoints

type Endpoints map[string][]Endpoint

Endpoints are a set of named endpoints.

func (Endpoints) Generate

func (e Endpoints) Generate(w io.Writer) error

Generate writes a Go file to the given writer.

func (*Endpoints) Parse

func (e *Endpoints) Parse(r io.Reader) error

Parse parses the JSON description of the endpoints.

type Error

type Error struct {
	Code           string
	HTTPStatusCode int
	SenderFault    bool
}

Error is an error returned by the API.

type HTTPOptions

type HTTPOptions struct {
	Method     string
	RequestURI string
}

HTTPOptions contains the HTTP-specific options for an Operation.

type Member

type Member struct {
	ShapeRef
	Name     string
	Required bool
}

Member is a member of a shape.

func (Member) EC2Tag

func (m Member) EC2Tag() string

EC2Tag returns the field tag for EC2 protocol members.

func (Member) JSONTag

func (m Member) JSONTag() string

JSONTag returns the field tag for JSON protocol members.

func (Member) QueryTag

func (m Member) QueryTag(wrapper string) string

QueryTag returns the field tag for Query protocol members.

func (Member) Shape

func (m Member) Shape() *Shape

Shape returns the member's shape.

func (Member) Type

func (m Member) Type() string

Type returns the member's Go type.

func (Member) XMLTag

func (m Member) XMLTag(wrapper string) string

XMLTag returns the field tag for XML protocol members.

type Metadata

type Metadata struct {
	APIVersion          string
	EndpointPrefix      string
	JSONVersion         string
	ServiceAbbreviation string
	ServiceFullName     string
	SignatureVersion    string
	TargetPrefix        string
	Protocol            string
	ChecksumFormat      string
	GlobalEndpoint      string
	TimestampFormat     string
}

Metadata contains various bits of metadata associated with an API.

type Operation

type Operation struct {
	Name          string
	Documentation string
	HTTP          HTTPOptions
	InputRef      *ShapeRef `json:"Input"`
	OutputRef     *ShapeRef `json:"Output"`
}

Operation is an API operation.

func (Operation) Input

func (o Operation) Input() *Shape

Input returns the shape of the input parameter, if any.

func (Operation) Output

func (o Operation) Output() *Shape

Output returns the shape of the output parameter, if any.

type Properties

type Properties struct {
	CredentialScope CredentialScope
}

Properties is a set of properties associated with an Endpoint.

type Service

type Service struct {
	Name          string
	FullName      string
	PackageName   string
	Metadata      Metadata
	Documentation string
	Operations    map[string]Operation
	Shapes        map[string]*Shape
}

A Service is an AWS service.

func (Service) Wrappers

func (s Service) Wrappers() map[string]*Shape

Wrappers returns the service's wrapper shapes.

type Shape

type Shape struct {
	Box             bool
	Documentation   string
	Enum            []string
	Error           Error
	Exception       bool
	Fault           bool
	Flattened       bool
	KeyRef          *ShapeRef `json:"Key"`
	LocationName    string
	Max             int
	MemberRef       *ShapeRef           `json:"Member"`
	MemberRefs      map[string]ShapeRef `json:"Members"`
	Min             int
	Name            string
	Pattern         string
	Payload         string
	Required        []string
	Sensitive       bool
	Streaming       bool
	TimestampFormat string
	ShapeType       string    `json:"Type"`
	ValueRef        *ShapeRef `json:"Value"`
	Wrapper         bool
	XMLAttribute    bool
	XMLNamespace    XMLNamespace
	XMLOrder        []string
}

Shape is a type used in an API.

func (*Shape) ElementType

func (s *Shape) ElementType() string

ElementType returns the Go type of the shape as an element of another shape (i.e., list or map).

func (*Shape) Enums

func (s *Shape) Enums() map[string]string

Enums returns a map of enum constant names to their values.

func (*Shape) Key

func (s *Shape) Key() *Shape

Key returns the shape's key shape, if any.

func (*Shape) KeyXMLTag

func (s *Shape) KeyXMLTag() string

KeyXMLTag returns the field tag for key.

func (*Shape) Literal

func (s *Shape) Literal() string

Literal returns a Go literal of the given shape.

func (*Shape) Member

func (s *Shape) Member() *Shape

Member returns the shape's member shape, if any.

func (*Shape) Members

func (s *Shape) Members() map[string]Member

Members returns the shape's members.

func (*Shape) ResultWrapper

func (s *Shape) ResultWrapper() string

ResultWrapper returns the shape's result wrapper, if and only if a single, unambiguous wrapper can be found in the API's operation outputs.

func (*Shape) Type

func (s *Shape) Type() string

Type returns the shape's Go type.

func (*Shape) Value

func (s *Shape) Value() *Shape

Value returns the shape's value shape, if any.

func (*Shape) ValueXMLTag

func (s *Shape) ValueXMLTag() string

ValueXMLTag returns the field tag for value.

type ShapeRef

type ShapeRef struct {
	ShapeName     string `json:"Shape"`
	Documentation string
	Location      string
	LocationName  string
	Wrapper       bool
	ResultWrapper string
	Streaming     bool
	XMLNamespace  XMLNamespace
}

ShapeRef is a reference to a Shape.

func (*ShapeRef) Shape

func (ref *ShapeRef) Shape() *Shape

Shape returns the wrapped shape.

func (*ShapeRef) WrappedLiteral

func (ref *ShapeRef) WrappedLiteral() string

WrappedLiteral returns an empty Go literal of the reference shape, wrapped if a result wrapper was specified.

func (*ShapeRef) WrappedType

func (ref *ShapeRef) WrappedType() string

WrappedType returns the Go type of the reference shape, wrapped if a result wrapper was specified.

type XMLNamespace

type XMLNamespace struct {
	URI string
}

An XMLNamespace is an XML namespace. *shrug*

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL