Documentation
¶
Overview ¶
Package api represents API abstractions for rendering service generated files.
Index ¶
- Constants
- func AppendDocstring(base, toAdd string) string
- func ExpandModelGlobPath(globs ...string) ([]string, error)
- func HasCrosslinks(service string) bool
- func LogDebug(w io.Writer)
- func NewExamplesBuilder() defaultExamplesBuilder
- func NewWAFregionalExamplesBuilder() wafregionalExamplesBuilder
- func ParamsStructFromJSON(value interface{}, shape *Shape, prefixPackageName bool) string
- func S3ManagerUploadInputGoCode(a *API) string
- func ServiceID(a *API) string
- func ServiceIDFromUID(uid string) string
- func ServiceName(a *API) string
- func TrimModelServiceVersions(modelPaths []string) (include, exclude []string)
- type API
- func (a *API) APIErrorsGoCode() string
- func (a *API) APIEventStreamTestGoCode() string
- func (a *API) APIGoCode() string
- func (a *API) APIName() string
- func (a *API) APISmokeTestsGoCode() string
- func (a *API) AddImport(v string) error
- func (a *API) AddSDKImport(v ...string) error
- func (a *API) Attach(filename string) error
- func (a *API) AttachDocs(filename string) error
- func (a *API) AttachExamples(filename string) error
- func (a *API) AttachPaginators(filename string) error
- func (a *API) AttachSmokeTests(filename string) error
- func (a *API) AttachString(str string) error
- func (a *API) AttachWaiters(filename string) error
- func (a *API) ExampleGoCode() string
- func (a *API) ExamplesGoCode() string
- func (a *API) ExportableName(name string) string
- func (a *API) GetCrosslinkURL(params ...string) string
- func (a *API) ImportPath() string
- func (a *API) InterfaceGoCode() string
- func (a *API) InterfacePackageName() string
- func (a *API) NewAPIGoCodeWithPkgName(cfg string) string
- func (a *API) NiceName() string
- func (a *API) OperationForMethod(name string) *Operation
- func (a *API) OperationHasOutputPlaceholder() bool
- func (a *API) OperationList() []*Operation
- func (a *API) OperationNames() []string
- func (a *API) PackageName() string
- func (a *API) ProtocolPackage() string
- func (a *API) ServiceGoCode() string
- func (a *API) ServicePackageDoc() string
- func (a *API) Setup() error
- func (a *API) ShapeList() []*Shape
- func (a *API) ShapeListErrors() []*Shape
- func (a *API) ShapeNames() []string
- func (a *API) StructName() string
- func (a *API) UseInitMethods() bool
- func (a *API) WaitersGoCode() string
- type APIs
- type AuthType
- type Comments
- type EndpointDiscovery
- type EndpointTrait
- type ErrorInfo
- type Event
- type EventStream
- func (es *EventStream) EventGroupName() string
- func (es *EventStream) StreamEventTypeGetterName() string
- func (es *EventStream) StreamReaderAPIName() string
- func (es *EventStream) StreamReaderImplConstructorName() string
- func (es *EventStream) StreamReaderImplName() string
- func (es *EventStream) StreamUnknownEventName() string
- func (es *EventStream) StreamUnmarshalerForEventName() string
- func (es *EventStream) StreamWriterAPIName() string
- func (es *EventStream) StreamWriterImplName() string
- type EventStreamAPI
- type EventStreamHeaderTypeMap
- type EventStreams
- type Example
- type Examples
- type ExamplesDefinition
- type HTTPChecksum
- type HTTPInfo
- type IoSuffix
- type Loader
- type Metadata
- type Operation
- func (o *Operation) Example() string
- func (o *Operation) ExampleInput() string
- func (o *Operation) GetSigner() string
- func (o *Operation) GoCode() string
- func (o *Operation) HasAccountIDMemberWithARN() bool
- func (o *Operation) HasInput() bool
- func (o *Operation) HasOutput() bool
- func (o *Operation) InterfaceSignature() string
- func (o *Operation) Methods() []string
- func (o *Operation) RequestChecksumRequired() bool
- func (o *Operation) ShouldDiscardResponse() bool
- func (o *Operation) ShouldSignRequestBody() bool
- type Paginator
- type ProtocolSettings
- type Shape
- func (s *Shape) Clone(newName string) *Shape
- func (s *Shape) Docstring() string
- func (s *Shape) EnumName(n int) string
- func (s *Shape) ErrorCodeName() string
- func (s *Shape) ErrorName() string
- func (s *Shape) GetModeledMember(name string) *ShapeRef
- func (s Shape) GetTimestampFormat() string
- func (s *Shape) GoCode() string
- func (s *Shape) GoCodeStringers() string
- func (s *Shape) GoStructType(name string, ref *ShapeRef) string
- func (s *Shape) GoStructValueType(name string, ref *ShapeRef) string
- func (s *Shape) GoTags(root, required bool) string
- func (s *Shape) GoType() string
- func (s *Shape) GoTypeElem() string
- func (s *Shape) GoTypeWithPkgName() string
- func (s *Shape) GoTypeWithPkgNameElem() string
- func (s *Shape) HasDefaultValue() bool
- func (s *Shape) HasHostLabelMembers() bool
- func (s *Shape) HasMember(name string) bool
- func (s *Shape) HasPayloadMembers() bool
- func (s *Shape) IsEnum() bool
- func (s *Shape) IsInternal() bool
- func (s *Shape) IsRequired(member string) bool
- func (s *Shape) IsSensitive() bool
- func (s *Shape) MemberNames() []string
- func (s *Shape) NestedShape() *Shape
- func (s *Shape) PayloadRefName() string
- func (s *Shape) Rename(newName string)
- func (s *Shape) WillRefBeBase64Encoded(refName string) bool
- type ShapeRef
- func (ref *ShapeRef) CanBeEmpty() bool
- func (ref *ShapeRef) Docstring() string
- func (ref ShapeRef) GetTimestampFormat() string
- func (ref *ShapeRef) GoTags(toplevel bool, isRequired bool) string
- func (ref *ShapeRef) GoType() string
- func (ref *ShapeRef) GoTypeElem() string
- func (ref *ShapeRef) GoTypeWithPkgName() string
- func (s *ShapeRef) HasDefaultValue() bool
- func (ref *ShapeRef) IndentedDocstring() string
- func (s *ShapeRef) UseIndirection() bool
- type ShapeTag
- type ShapeTags
- type ShapeValidation
- type ShapeValidationType
- type ShapeValidations
- type ShapeValueBuilder
- func (b ShapeValueBuilder) BuildComplex(name, memName string, ref *ShapeRef, parent *Shape, v map[string]interface{}) string
- func (b ShapeValueBuilder) BuildList(name, memName string, ref *ShapeRef, v []interface{}) string
- func (b ShapeValueBuilder) BuildScalar(name, memName string, ref *ShapeRef, shape interface{}, isPayload bool) string
- func (b ShapeValueBuilder) BuildShape(ref *ShapeRef, shapes map[string]interface{}, isMap bool) string
- func (b ShapeValueBuilder) GoType(ref *ShapeRef, elem bool) string
- type SmokeTestCase
- type SmokeTestSuite
- type UnsupportedAPIModelError
- type Waiter
- type WaiterAcceptor
- type XMLInfo
Constants ¶
const ( // ShapeValidationRequired states the shape must be set ShapeValidationRequired = iota // ShapeValidationMinVal states the shape must have at least a number of // elements, or for numbers a minimum value ShapeValidationMinVal // ShapeValidationNested states the shape has nested values that need // to be validated ShapeValidationNested )
const SDKImportRoot = "github.com/aws/aws-sdk-go"
SDKImportRoot is the root import path of the SDK.
Variables ¶
This section is empty.
Functions ¶
func AppendDocstring ¶
func ExpandModelGlobPath ¶
ExpandModelGlobPath returns a slice of model paths expanded from the glob pattern passed in. Returns the path of the model file to be loaded. Includes all versions of a service model.
e.g: models/apis/*/*/api-2.json Or with specific model file: models/apis/service/version/api-2.json
func HasCrosslinks ¶
HasCrosslinks will return whether or not a service has crosslinking .
func LogDebug ¶
LogDebug initialize's the debug logger for the components in the api package to log debug lines to.
Panics if called multiple times.
Must be used prior to any model loading or code gen.
func NewExamplesBuilder ¶
func NewExamplesBuilder() defaultExamplesBuilder
NewExamplesBuilder returns an initialized example builder for generating example input API shapes from a model.
func NewWAFregionalExamplesBuilder ¶
func NewWAFregionalExamplesBuilder() wafregionalExamplesBuilder
func ParamsStructFromJSON ¶
ParamsStructFromJSON returns a JSON string representation of a structure.
func S3ManagerUploadInputGoCode ¶
S3ManagerUploadInputGoCode returns the Go code for the S3 Upload Manager's input structure.
func ServiceIDFromUID ¶
ServiceIDFromUID will parse the service id from the uid and return the service id that was found.
func ServiceName ¶
ServiceName returns the SDK's naming of the service. Has backwards compatibility built in for services that were incorrectly named with the service's endpoint prefix.
func TrimModelServiceVersions ¶
TrimModelServiceVersions sorts the model paths by service version then returns recent model versions, and model version excluded.
Uses the third from last path element to determine unique service. Only one service version will be included.
models/apis/service/version/api-2.json
Types ¶
type API ¶
type API struct { Metadata Metadata Operations map[string]*Operation Shapes map[string]*Shape Waiters []Waiter Documentation string `json:"-"` Examples Examples SmokeTests SmokeTestSuite IgnoreUnsupportedAPIs bool // Set to true to avoid removing unused shapes NoRemoveUnusedShapes bool // Set to true to avoid renaming to 'Input/Output' postfixed shapes NoRenameToplevelShapes bool // Set to true to ignore service/request init methods (for testing) NoInitMethods bool // Set to true to ignore String() and GoString methods (for generated tests) NoStringerMethods bool // Set to true to not generate API service name constants NoConstServiceNames bool // Set to true to not generate validation shapes NoValidataShapeMethods bool // Set to true to not generate struct field accessors NoGenStructFieldAccessors bool // Set to not remove unsupported (non-legacy) JSON from API, (for generated tests). NoRemoveUnsupportedJSONValue bool BaseImportPath string BaseCrosslinkURL string HasEventStream bool `json:"-"` EndpointDiscoveryOp *Operation HasEndpointARN bool `json:"-"` HasOutpostID bool `json:"-"` HasAccountIdWithARN bool `json:"-"` WithGeneratedTypedErrors bool // Set to true to strictly enforce usage of the serviceId for the package naming StrictServiceId bool // contains filtered or unexported fields }
An API defines a service API's definition. and logic to serialize the definition.
func (*API) APIErrorsGoCode ¶
APIErrorsGoCode returns the Go code for the errors.go file.
func (*API) APIEventStreamTestGoCode ¶
APIEventStreamTestGoCode generates Go code for EventStream operation tests.
func (*API) APISmokeTestsGoCode ¶
APISmokeTestsGoCode returns the Go Code string for the smoke tests.
func (*API) AddSDKImport ¶
AddSDKImport adds a SDK package import to the generated file's import.
func (*API) Attach ¶
Attach opens a file by name, and unmarshal its JSON data. Will proceed to setup the API if not already done so.
func (*API) AttachDocs ¶
AttachDocs attaches documentation from a JSON filename.
func (*API) AttachExamples ¶
AttachExamples will create a new ExamplesDefinition from the examples file and reference the API object.
func (*API) AttachPaginators ¶
AttachPaginators attaches pagination configuration from filename to the API.
func (*API) AttachSmokeTests ¶
AttachSmokeTests attaches the smoke test cases to the API model.
func (*API) AttachString ¶
AttachString will unmarshal a raw JSON string, and setup the API if not already done so.
func (*API) AttachWaiters ¶
AttachWaiters reads a file of waiter definitions, and adds those to the API. Will panic if an error occurs.
func (*API) ExampleGoCode ¶
ExampleGoCode renders service example code. Returning it as a string.
func (*API) ExamplesGoCode ¶
ExamplesGoCode will return a code representation of the entry within the examples.json file.
func (*API) ExportableName ¶
ExportableName a name which is exportable as a value or name in Go code
func (*API) GetCrosslinkURL ¶
GetCrosslinkURL returns the crosslinking URL for the shape based on the name and uid provided. Empty string is returned if no crosslink link could be determined.
func (*API) ImportPath ¶
ImportPath returns the client's full import path
func (*API) InterfaceGoCode ¶
InterfaceGoCode returns the go code for the service's API operations as an interface{}. Assumes that the interface is being created in a different package than the service API's package.
func (*API) InterfacePackageName ¶
InterfacePackageName returns the package name for the interface.
func (*API) NewAPIGoCodeWithPkgName ¶
NewAPIGoCodeWithPkgName returns a string of instantiating the API prefixed with its package name. Takes a string depicting the Config.
func (*API) OperationForMethod ¶
OperationForMethod returns the API operation name that corresponds to the client method name provided.
func (*API) OperationHasOutputPlaceholder ¶
OperationHasOutputPlaceholder returns if any of the API operation input or output shapes are place holders.
func (*API) OperationList ¶
OperationList returns a slice of API operation pointers
func (*API) OperationNames ¶
OperationNames returns a slice of API operations supported.
func (*API) ProtocolPackage ¶
ProtocolPackage returns the package name of the protocol this API uses.
func (*API) ServiceGoCode ¶
ServiceGoCode renders service go code. Returning it as a string.
func (*API) ServicePackageDoc ¶
ServicePackageDoc generates the contents of the doc file for the service.
Will also read in the custom doc templates for the service if found.
func (*API) ShapeList ¶
ShapeList returns a slice of shape pointers used by the API.
Will exclude error shapes from the list of shapes returned.
func (*API) ShapeListErrors ¶
ShapeListErrors returns a list of the errors defined by the API model
func (*API) ShapeNames ¶
ShapeNames returns a slice of names for each shape used by the API.
func (*API) StructName ¶
StructName returns the struct name for a given API.
func (*API) UseInitMethods ¶
UseInitMethods returns if the service's init method should be rendered.
func (*API) WaitersGoCode ¶
WaitersGoCode generates and returns Go code for each of the waiters of this API.
type EndpointDiscovery ¶
type EndpointDiscovery struct { // Required indicates that for a given operation that endpoint is required. // Any required endpoint discovery operation cannot have endpoint discovery // turned off. Required bool `json:"required"` }
EndpointDiscovery represents a map of key values pairs that represents metadata about how a given API will make a call to the discovery endpoint.
type EndpointTrait ¶
type EndpointTrait struct { // Specifies the hostPrefix template to prepend to the operation's request // endpoint host. HostPrefix string `json:"hostPrefix"` }
EndpointTrait provides the structure of the modeled endpoint trait, and its properties.
type Event ¶
type Event struct { Name string Shape *Shape For *EventStream Private bool }
Event is a single EventStream event that can be sent or received in an EventStream.
type EventStream ¶
EventStream represents a single eventstream group (input/output) and the modeled events that are known for the stream.
func (*EventStream) EventGroupName ¶
func (es *EventStream) EventGroupName() string
func (*EventStream) StreamEventTypeGetterName ¶
func (es *EventStream) StreamEventTypeGetterName() string
func (*EventStream) StreamReaderAPIName ¶
func (es *EventStream) StreamReaderAPIName() string
func (*EventStream) StreamReaderImplConstructorName ¶
func (es *EventStream) StreamReaderImplConstructorName() string
func (*EventStream) StreamReaderImplName ¶
func (es *EventStream) StreamReaderImplName() string
func (*EventStream) StreamUnknownEventName ¶
func (es *EventStream) StreamUnknownEventName() string
func (*EventStream) StreamUnmarshalerForEventName ¶
func (es *EventStream) StreamUnmarshalerForEventName() string
func (*EventStream) StreamWriterAPIName ¶
func (es *EventStream) StreamWriterAPIName() string
func (*EventStream) StreamWriterImplName ¶
func (es *EventStream) StreamWriterImplName() string
type EventStreamAPI ¶
type EventStreamAPI struct { API *API Operation *Operation Name string InputStream *EventStream OutputStream *EventStream RequireHTTP2 bool // The eventstream generated code was generated with an older model that // does not scale with bi-directional models. This drives the need to // expose the output shape's event stream member as an exported member. Legacy bool }
EventStreamAPI provides details about the event stream async API and associated EventStream shapes.
func (EventStreamAPI) OutputMemberName ¶
func (e EventStreamAPI) OutputMemberName() string
func (*EventStreamAPI) ShapeDoc ¶
func (esAPI *EventStreamAPI) ShapeDoc() string
ShapeDoc returns the docstring for the EventStream API.
func (*EventStreamAPI) StreamInputEventTypeGetterName ¶
func (es *EventStreamAPI) StreamInputEventTypeGetterName() string
func (*EventStreamAPI) StreamOutputUnmarshalerForEventName ¶
func (es *EventStreamAPI) StreamOutputUnmarshalerForEventName() string
type EventStreamHeaderTypeMap ¶
EventStreamHeaderTypeMap provides the mapping of a EventStream Header's Value type to the shape reference's member type.
type EventStreams ¶
type EventStreams map[*Shape]*EventStream
EventStreams is a map of streams for the API shared across all operations. Ensurs that no stream is duplicated.
func (*EventStreams) GetStream ¶
func (es *EventStreams) GetStream(topShape *Shape, streamShape *Shape) *EventStream
GetStream returns an EventStream for the operations top level shape, and member reference to the stream shape.
type Example ¶
type Example struct { API *API `json:"-"` Operation *Operation `json:"-"` OperationName string `json:"-"` Index string `json:"-"` Builder examplesBuilder `json:"-"` VisitedErrors map[string]struct{} `json:"-"` Title string `json:"title"` Description string `json:"description"` ID string `json:"id"` Comments Comments `json:"comments"` Input map[string]interface{} `json:"input"` Output map[string]interface{} `json:"output"` }
Example is a single entry within the examples-1.json file.
func (Example) GoCode ¶
ExampleCode will generate the example code for the given Example shape. TODO: Can delete
func (*Example) HasVisitedError ¶
TODO: In the operation docuentation where we list errors, this needs to be done there as well.
func (*Example) MethodName ¶
type ExamplesDefinition ¶
ExamplesDefinition is the structural representation of the examples-1.json file
type HTTPChecksum ¶
type IoSuffix ¶
IoSuffix represents map of service to shape names that are suffixed with `Input`, `Output` string and are not Input or Output shapes used by any operation within the service enclosure.
type Loader ¶
type Loader struct { // The base Go import path the loaded models will be appended to. BaseImport string // Allows ignoring API models that are unsupported by the SDK without // failing the load of other supported APIs. IgnoreUnsupportedAPIs bool // Set to true to strictly enforce usage of the serviceId for the package naming StrictServiceId bool }
Loader provides the loading of APIs from files.
type Metadata ¶
type Metadata struct { APIVersion string EndpointPrefix string SigningName string ServiceAbbreviation string ServiceFullName string SignatureVersion string JSONVersion string TargetPrefix string Protocol string ProtocolSettings ProtocolSettings UID string EndpointsID string ServiceID string NoResolveEndpoint bool AWSQueryCompatible *awsQueryCompatible }
A Metadata is the metadata about an API's definition.
type Operation ¶
type Operation struct { API *API `json:"-"` ExportedName string Name string Documentation string `json:"-"` // HTTP HTTPInfo Host string `json:"host"` InputRef ShapeRef `json:"input"` OutputRef ShapeRef `json:"output"` ErrorRefs []ShapeRef `json:"errors"` Paginator *Paginator Deprecated bool `json:"deprecated"` DeprecatedMsg string `json:"deprecatedMessage"` AuthType AuthType `json:"authtype"` CustomBuildHandlers []string EventStreamAPI *EventStreamAPI IsEndpointDiscoveryOp bool `json:"endpointoperation"` EndpointDiscovery *EndpointDiscovery `json:"endpointdiscovery"` Endpoint *EndpointTrait `json:"endpoint"` // HTTPChecksum replaces usage of httpChecksumRequired, but some APIs // (s3control) still uses old trait. HTTPChecksum HTTPChecksum `json:"httpChecksum"` IsHttpChecksumRequired bool `json:"httpChecksumRequired"` // contains filtered or unexported fields }
An Operation defines a specific API Operation.
func (*Operation) ExampleInput ¶
ExampleInput return a string of the rendered Go code for an example's input parameters
func (*Operation) HasAccountIDMemberWithARN ¶
HasAccountIDMemberWithARN returns true if an account id member exists for an input shape that may take in an ARN.
func (*Operation) InterfaceSignature ¶
InterfaceSignature returns a string representing the Operation's interface{} functional signature.
func (*Operation) RequestChecksumRequired ¶
RequestChecksumRequired returns if the request requires the Content-MD5 checksum to be computed.
func (*Operation) ShouldDiscardResponse ¶
ShouldDiscardResponse returns if the operation should discard the response returned by the service.
func (*Operation) ShouldSignRequestBody ¶
ShouldSignRequestBody returns if the operation request body should be signed or not.
type Paginator ¶
type Paginator struct { InputTokens interface{} `json:"input_token"` OutputTokens interface{} `json:"output_token"` LimitKey string `json:"limit_key"` MoreResults string `json:"more_results"` }
Paginator keeps track of pagination configuration for an API operation.
func (*Paginator) InputTokensString ¶
InputTokensString returns output tokens formatted as a list
func (*Paginator) OutputTokensString ¶
OutputTokensString returns output tokens formatted as a list
type ProtocolSettings ¶
type ProtocolSettings struct {
HTTP2 string `json:"h2,omitempty"`
}
ProtocolSettings define how the SDK should handle requests in the context of of a protocol.
type Shape ¶
type Shape struct { API *API `json:"-"` ShapeName string Documentation string `json:"-"` DefaultValue string `json:"-"` // References of struct members will include their originally modeled // member name for cross references. OriginalShapeName string `json:"-"` // Map of exported member names to the ShapeReference. MemberRefs map[string]*ShapeRef `json:"members"` MemberRef ShapeRef `json:"member"` // List ref KeyRef ShapeRef `json:"key"` // map key ref ValueRef ShapeRef `json:"value"` // map value ref Required []string Payload string Type string // this is being added for type union specifically. We want to generate // api as struct and handle setSDK and setResource differently RealType string Exception bool Enum []string EnumConsts []string Flattened bool Streaming bool Location string LocationName string IdempotencyToken bool `json:"idempotencyToken"` TimestampFormat string `json:"timestampFormat"` XMLNamespace XMLInfo Min float64 // optional Minimum length (string, list) or value (number) OutputEventStreamAPI *EventStreamAPI EventStream *EventStream EventFor map[string]*EventStream `json:"-"` IsInputEventStream bool `json:"-"` IsOutputEventStream bool `json:"-"` IsEventStream bool `json:"eventstream"` IsEvent bool `json:"event"` Refs []*ShapeRef // References to this shape OrigShapeName string `json:"-"` // Defines if the shape is a placeholder and should not be used directly Placeholder bool Deprecated bool `json:"deprecated"` DeprecatedMsg string `json:"deprecatedMessage"` Validations ShapeValidations // Error information that is set if the shape is an error shape. ErrorInfo ErrorInfo `json:"error"` // Flags that the shape cannot be rename. Prevents the shape from being // renamed further by the Input/Output. AliasedShapeName bool // Sensitive types should not be logged by SDK type loggers. Sensitive bool `json:"sensitive"` // Flags that a member of the shape is an EndpointARN HasEndpointARNMember bool // Flags that a member of the shape is an OutpostIDMember HasOutpostIDMember bool // Flags that the shape has an account id member along with EndpointARN member HasAccountIdMemberWithARN bool // Indicates the Shape is used as an operation input UsedAsInput bool // Indicates the Shape is used as an operation output UsedAsOutput bool // Indicates a structure shape is a document type Document bool `json:"document"` // contains filtered or unexported fields }
A Shape defines the definition of a shape type
func (*Shape) Clone ¶
Clone returns a cloned version of the shape with all references clones.
Does not clone EventStream or Validate related values.
func (*Shape) ErrorCodeName ¶
ErrorCodeName will return the error shape's name formated for error code const.
func (*Shape) ErrorName ¶
ErrorName will return the shape's name or error code if available based on the API's protocol. This is the error code string returned by the service.
func (*Shape) GetModeledMember ¶
GetModeledMember returns the member's ShapeReference if it exists within the shape. Returns nil if the member could not be found.
func (Shape) GetTimestampFormat ¶
func (*Shape) GoCodeStringers ¶
GoCodeStringers renders the Stringers for API input/output shapes
func (*Shape) GoStructType ¶
GoStructType returns the type of a struct field based on the API model definition.
func (*Shape) GoStructValueType ¶
GoStructValueType returns the Shape's Go type value instead of a pointer for the type.
func (*Shape) GoTypeElem ¶
GoTypeElem returns the Go type for the Shape. If the shape type is a pointer just the type will be returned minus the pointer *.
func (*Shape) GoTypeWithPkgName ¶
GoTypeWithPkgName returns a shape's type as a string with the package name in <packageName>.<type> format. Package naming only applies to structures.
func (*Shape) GoTypeWithPkgNameElem ¶
GoTypeWithPkgNameElem returns the shapes type as a string with the "*" removed if there was one preset.
func (*Shape) HasDefaultValue ¶
func (*Shape) HasHostLabelMembers ¶
HasHostLabelMembers returns true if the shape contains any members which are decorated with the hostLabel trait.
func (*Shape) HasMember ¶
HasMember will return whether or not the shape has a given member by name. Name passed in must match the SDK's exported name for the member, not the modeled member name
func (*Shape) HasPayloadMembers ¶
HasPayloadMembers returns if the shape has any members that will be serialized to the payload of a API message.
func (*Shape) IsInternal ¶
IsInternal returns whether the shape was defined in this package
func (*Shape) IsRequired ¶
IsRequired returns if member is a required field. Required fields are fields marked as required, hostLabels, or location of uri path.
func (*Shape) IsSensitive ¶
IsSensitive checks whether the Shape itself is sensitive, or if the Shape is a collection/map with a sensitive member.
func (*Shape) MemberNames ¶
MemberNames returns a slice of struct member names.
func (*Shape) NestedShape ¶
NestedShape returns the shape pointer value for the shape which is nested under the current shape. If the shape is not nested nil will be returned.
strucutures, the current shape is returned map: the value shape of the map is returned list: the element shape of the list is returned
func (*Shape) PayloadRefName ¶
PayloadRefName returns the payload member of the shape if there is one modeled. If no payload is modeled, empty string will be returned.
func (*Shape) Rename ¶
Rename changes the name of the Shape to newName. Also updates the associated API's reference to use newName.
func (*Shape) WillRefBeBase64Encoded ¶
type ShapeRef ¶
type ShapeRef struct { API *API `json:"-"` Shape *Shape `json:"-"` Documentation string `json:"-"` DefaultValue string `json:"-"` ShapeName string `json:"shape"` Location string LocationName string QueryName string Flattened bool Streaming bool XMLAttribute bool // References of struct members will include their originally modeled // member name for cross references. OriginalMemberName string `json:"-"` // Ignore, if set, will not be sent over the wire Ignore bool XMLNamespace XMLInfo Payload string IdempotencyToken bool `json:"idempotencyToken"` TimestampFormat string `json:"timestampFormat"` JSONValue bool `json:"jsonvalue"` Deprecated bool `json:"deprecated"` DeprecatedMsg string `json:"deprecatedMessage"` EndpointDiscoveryID bool `json:"endpointdiscoveryid"` HostLabel bool `json:"hostLabel"` OrigShapeName string `json:"-"` GenerateGetter bool IsEventPayload bool `json:"eventpayload"` IsEventHeader bool `json:"eventheader"` // Collection of custom tags the shape reference includes. CustomTags ShapeTags // Flags whether the member reference is a endpoint ARN EndpointARN bool // Flags whether the member reference is a Outpost ID OutpostIDMember bool // Flag whether the member reference is a Account ID when endpoint shape ARN is present AccountIDMemberWithARN bool // Flags that the member was modeled as JSONValue but suppressed by the SDK. SuppressedJSONValue bool `json:"-"` }
A ShapeRef defines the usage of a shape within the API.
func (*ShapeRef) CanBeEmpty ¶
CanBeEmpty returns if the shape value can sent request as an empty value. String, blob, list, and map are types must not be empty when the member is serialized to the URI path, or decorated with HostLabel.
func (ShapeRef) GetTimestampFormat ¶
func (*ShapeRef) GoTypeElem ¶
GoTypeElem returns the Go type for the Shape. If the shape type is a pointer just the type will be returned minus the pointer *.
func (*ShapeRef) GoTypeWithPkgName ¶
GoTypeWithPkgName returns a shape's type as a string with the package name in <packageName>.<type> format. Package naming only applies to structures.
func (*ShapeRef) HasDefaultValue ¶
HasDefaultValue returns whether this shape has a default value
func (*ShapeRef) IndentedDocstring ¶
IndentedDocstring is the indented form of the doc string.
func (*ShapeRef) UseIndirection ¶
UseIndirection returns if the shape's reference should use indirection or not.
type ShapeTag ¶
type ShapeTag struct {
Key, Val string
}
ShapeTag is a struct tag that will be applied to a shape's generated code
type ShapeTags ¶
type ShapeTags []ShapeTag
ShapeTags is a collection of shape tags and provides serialization of the tags in an ordered list.
type ShapeValidation ¶
type ShapeValidation struct { // Name of the shape to be validated Name string // Reference to the shape within the context the shape is referenced Ref *ShapeRef // Type of validation needed Type ShapeValidationType }
A ShapeValidation contains information about a shape and the type of validation that is needed
func (ShapeValidation) GoCode ¶
func (sv ShapeValidation) GoCode() string
GoCode returns the generated Go code for the Shape with its validation type.
type ShapeValidationType ¶
type ShapeValidationType int
A ShapeValidationType is the type of validation that a shape needs
type ShapeValidations ¶
type ShapeValidations []ShapeValidation
A ShapeValidations is a collection of shape validations needed nested within a parent shape
func (ShapeValidations) GoCode ¶
func (vs ShapeValidations) GoCode(shape *Shape) string
GoCode generates the Go code needed to perform validations for the shape and its nested fields.
func (ShapeValidations) Has ¶
func (vs ShapeValidations) Has(ref *ShapeRef, typ ShapeValidationType) bool
Has returns true or false if the ShapeValidations already contains the the reference and validation type.
type ShapeValueBuilder ¶
type ShapeValueBuilder struct { // Specifies if API shapes modeled as blob types, input values are base64 // encoded or not, and strings values instead. Base64BlobValues bool // The helper that will provide the logic and formated code to convert a // timestamp input value into a Go time.Time. ParseTimeString func(ref *ShapeRef, memberName, v string) string }
ShapeValueBuilder provides the logic to build the nested values for a shape. Base64BlobValues is true if the blob field in shapeRef.Shape.Type is base64 encoded.
func NewShapeValueBuilder ¶
func NewShapeValueBuilder() ShapeValueBuilder
NewShapeValueBuilder returns an initialized ShapeValueBuilder for generating API shape types initialized with values.
func (ShapeValueBuilder) BuildComplex ¶
func (b ShapeValueBuilder) BuildComplex(name, memName string, ref *ShapeRef, parent *Shape, v map[string]interface{}) string
BuildComplex will build the shape's value for complex types such as structs, and maps.
func (ShapeValueBuilder) BuildList ¶
func (b ShapeValueBuilder) BuildList(name, memName string, ref *ShapeRef, v []interface{}) string
BuildList will construct a list shape based off the service's definition of that list.
func (ShapeValueBuilder) BuildScalar ¶
func (b ShapeValueBuilder) BuildScalar(name, memName string, ref *ShapeRef, shape interface{}, isPayload bool) string
BuildScalar will build atomic Go types.
func (ShapeValueBuilder) BuildShape ¶
func (b ShapeValueBuilder) BuildShape(ref *ShapeRef, shapes map[string]interface{}, isMap bool) string
BuildShape will recursively build the referenced shape based on the json object provided. isMap will dictate how the field name is specified. If isMap is true, we will expect the member name to be quotes like "Foo".
type SmokeTestCase ¶
type SmokeTestCase struct { OpName string `json:"operationName"` Input map[string]interface{} `json:"input"` ExpectErr bool `json:"errorExpectedFromService"` }
SmokeTestCase provides the definition for a integration smoke test case.
func (SmokeTestCase) BuildInputShape ¶
func (c SmokeTestCase) BuildInputShape(ref *ShapeRef) string
BuildInputShape returns the Go code as a string for initializing the test case's input shape.
type SmokeTestSuite ¶
type SmokeTestSuite struct { Version int `json:"version"` DefaultRegion string `json:"defaultRegion"` TestCases []SmokeTestCase `json:"testCases"` }
SmokeTestSuite defines the test suite for smoke tests.
type UnsupportedAPIModelError ¶
type UnsupportedAPIModelError struct {
Err error
}
UnsupportedAPIModelError provides wrapping of an error causing the API to fail to load because the SDK does not support the API service defined.
func (UnsupportedAPIModelError) Error ¶
func (e UnsupportedAPIModelError) Error() string
type Waiter ¶
type Waiter struct { Name string Delay int MaxAttempts int OperationName string `json:"operation"` Operation *Operation Acceptors []WaiterAcceptor }
A Waiter is an individual waiter definition.
func (*Waiter) InterfaceSignature ¶
InterfaceSignature returns a string representing the Waiter's interface function signature.
type WaiterAcceptor ¶
WaiterAcceptor is the acceptors defined in the model the SDK will use to wait on resource states with.
func (*WaiterAcceptor) ExpectedString ¶
func (a *WaiterAcceptor) ExpectedString() string
ExpectedString returns the string that was expected by the WaiterAcceptor
Source Files
¶
- api.go
- customization_passes.go
- docstring.go
- endpoint_arn.go
- endpoint_trait.go
- eventstream.go
- eventstream_tmpl.go
- eventstream_tmpl_reader.go
- eventstream_tmpl_readertests.go
- eventstream_tmpl_tests.go
- eventstream_tmpl_writer.go
- eventstream_tmpl_writertests.go
- example.go
- examples_builder.go
- examples_builder_customizations.go
- exportable_name.go
- legacy_io_suffix.go
- legacy_jsonvalue.go
- legacy_struct_names.go
- legacy_stutter.go
- list_of_shame.go
- load.go
- logger.go
- operation.go
- pagination.go
- param_filler.go
- passes.go
- s3manger_input.go
- service_name.go
- shape.go
- shape_alias.go
- shape_validation.go
- shape_value_builder.go
- smoke.go
- waiters.go
Directories
¶
Path | Synopsis |
---|---|
codegentest
|
|
service
Package service contains automatically generated AWS clients.
|
Package service contains automatically generated AWS clients. |
service/awsendpointdiscoverytest
Package awsendpointdiscoverytest provides the client and types for making API requests to AwsEndpointDiscoveryTest.
|
Package awsendpointdiscoverytest provides the client and types for making API requests to AwsEndpointDiscoveryTest. |
service/awsendpointdiscoverytest/awsendpointdiscoverytestiface
Package awsendpointdiscoverytestiface provides an interface to enable mocking the AwsEndpointDiscoveryTest service client for testing your code.
|
Package awsendpointdiscoverytestiface provides an interface to enable mocking the AwsEndpointDiscoveryTest service client for testing your code. |
service/awsquerycompatible
Package awsquerycompatible provides the client and types for making API requests to AWSQuery Compatible Service.
|
Package awsquerycompatible provides the client and types for making API requests to AWSQuery Compatible Service. |
service/awsquerycompatible/awsquerycompatibleiface
Package awsquerycompatibleiface provides an interface to enable mocking the AWSQuery Compatible Service service client for testing your code.
|
Package awsquerycompatibleiface provides an interface to enable mocking the AWSQuery Compatible Service service client for testing your code. |
service/restjsonservice
Package restjsonservice provides the client and types for making API requests to REST JSON Service.
|
Package restjsonservice provides the client and types for making API requests to REST JSON Service. |
service/restjsonservice/restjsonserviceiface
Package restjsonserviceiface provides an interface to enable mocking the REST JSON Service service client for testing your code.
|
Package restjsonserviceiface provides an interface to enable mocking the REST JSON Service service client for testing your code. |
service/restxmlservice
Package restxmlservice provides the client and types for making API requests to REST XML Service.
|
Package restxmlservice provides the client and types for making API requests to REST XML Service. |
service/restxmlservice/restxmlserviceiface
Package restxmlserviceiface provides an interface to enable mocking the REST XML Service service client for testing your code.
|
Package restxmlserviceiface provides an interface to enable mocking the REST XML Service service client for testing your code. |
service/rpcservice
Package rpcservice provides the client and types for making API requests to RPC Service.
|
Package rpcservice provides the client and types for making API requests to RPC Service. |
service/rpcservice/rpcserviceiface
Package rpcserviceiface provides an interface to enable mocking the RPC Service service client for testing your code.
|
Package rpcserviceiface provides an interface to enable mocking the RPC Service service client for testing your code. |