Finish projecting AWS IDL types

This converts the remaining AWS resource types over to the new IDL
model; this includes the apigateway, cloudwatch, sns, and sqs packages.
This commit is contained in:
joeduffy 2017-04-28 15:22:44 -07:00
parent b381d23393
commit 59573fc05f
16 changed files with 826 additions and 0 deletions

View file

@ -0,0 +1,17 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
"github.com/pulumi/coconut/lib/aws/idl/iam"
)
// The Account resource specifies the AWS Identity and Access Management (IAM) role that Amazon API
// Gateway (API Gateway) uses to write API logs to Amazon CloudWatch Logs (CloudWatch Logs).
type Account struct {
idl.NamedResource
// CloudWatchRole is the IAM role that has write access to CloudWatch Logs in your account.
CloudWatchRole *iam.Role `coco:"cloudWatchRole,optional"`
}

View file

@ -0,0 +1,30 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The APIKey resource creates a unique key that you can distribute to clients who are executing Amazon
// API Gateway (API Gateway) Method resources that require an API key. To specify which API key clients must use, map
// the API key with the RestApi and Stage resources that include the methods requiring a key.
type APIKey struct {
idl.NamedResource
// KeyName is a name for the API key. If you don't specify a name, a unique physical ID is generated and used.
KeyName *string `coco:"keyName,replaces,optional"`
// Description is a description of the purpose of the API key.
Description *string `coco:"description,optional"`
// Enabled indicates whether the API key can be used by clients.
Enabled *bool `coco:"enabled,optional"`
// StageKeys is a list of stages to associated with this API key.
StageKeys *StageKey `coco:"stageKeys,optional"`
}
type StageKey struct {
// RestAPI is a RestAPI resource that includes the stage with which you want to associate the API key.
RestAPI *RestAPI `coco:"restAPI,optional"`
// Stage is the stage with which to associate the API key. The stage must be included in the RestAPI
// resource that you specified in the RestAPI property.
Stage *Stage `coco:"stage,optional"`
}

View file

@ -0,0 +1,50 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
"github.com/pulumi/coconut/lib/aws/idl/iam"
)
// The Authorizer resource creates an authorization layer that Amazon API Gateway (API Gateway) activates for
// methods that have authorization enabled. API Gateway activates the authorizer when a client calls those methods.
type Authorizer struct {
idl.NamedResource
// Type is the type of authorizer.
Type AuthorizerType `coco:"type"`
// AuthorizerCredentials are the credentials required for the authorizer. To specify an AWS Identity and Access
// Management (IAM) role that API Gateway assumes, specify the role. To use resource-based permissions on the AWS
// Lambda (Lambda) function, specify null.
AuthorizerCredentials *iam.Role `coco:"authorizerCredentials,optional"`
// AuthorizerResultTTLInSeconds is the time-to-live (TTL) period, in seconds, that specifies how long API Gateway
// caches authorizer results. If you specify a value greater than `0`, API Gateway caches the authorizer responses.
// By default, API Gateway sets this property to `300`. The maximum value is `3600`, or 1 hour.
AuthorizerResultTTLInSeconds *float64 `coco:"authorizerResultTTLInSeconds,optional"`
// AuthorizerURI is the authorizer's Uniform Resource Identifier (URI). If you specify `TOKEN` for the authorizer's
// type property, specify a Lambda function URI, which has the form `arn:aws:apigateway:region:lambda:path/path`.
// The path usually has the form `/2015-03-31/functions/LambdaFunctionARN/invocations`.
AuthorizerURI *string `coco:"authorizerURI,optional"`
// IdentitySource is the source of the identity in an incoming request. If you specify `TOKEN` for the authorizer's
// type property, specify a mapping expression. The custom header mapping expression has the form
// `method.request.header.name`, where name is the name of a custom authorization header that clients submit as part
// of their requests.
IdentitySource *string `coco:"identitySource,optional"`
// IdentityValidationExpression is a validation expression for the incoming identity. If you specify `TOKEN` for
// the authorizer's type property, specify a regular expression. API Gateway uses the expression to attempt to
// match the incoming client token, and proceeds if the token matches. If the token doesn't match, API Gateway
// responds with a 401 (unauthorized request) error code.
IdentityValidationExpression *string `coco:"identityValidationExpression,optional"`
// providers is a list of the Amazon Cognito user pools to associate with this authorizer.
Providers *[]idl.Resource/*TODO: cognito.UserPool*/ `coco:"providers,optional"`
// RestAPI is the resource in which API Gateway creates the authorizer.
RestAPI *RestAPI `coco:"restAPI,optional"`
}
type AuthorizerType string
const (
TokenAuthorizer AuthorizerType = "TOKEN" // a custom authorizer that uses a Lambda function.
CognitoAuthorizer AuthorizerType = "COGNITO_USER_POOLS" // an authorizer that uses Amazon Cognito user pools.
)

View file

@ -0,0 +1,21 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The BasePathMapping resource creates a base path that clients who call your Amazon API Gateway API
// must use in the invocation URL.
type BasePathMapping struct {
idl.NamedResource
// DomainName is the domain name for the base path mapping.
DomainName string `coco:"domainName"`
// RestAPI is the API to map.
RestAPI *RestAPI `coco:"restAPI"`
// BasePath is the base path that callers of the API must provider in the URL after the domain name.
BasePath *string `coco:"basePath,optional"`
// Stage is the mapping's API stage.
Stage *Stage `coco:"stage,optional"`
}

View file

@ -0,0 +1,15 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The ClientCertificate resource creates a client certificate that Amazon API Gateway (API Gateway)
// uses to configure client-side SSL authentication for sending requests to the integration endpoint.
type ClientCertificate struct {
idl.NamedResource
// Description is a description of the client certificate.
Description *string `coco:"description,optional"`
}

View file

@ -0,0 +1,63 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The Deployment resource deploys an Amazon API Gateway (API Gateway) RestAPI resource to a stage so
// that clients can call the API over the Internet. The stage acts as an environment.
type Deployment struct {
idl.NamedResource
// restAPI is the RestAPI resource to deploy.
RestAPI *RestAPI `coco:"restAPI"`
// description is a description of the purpose of the API Gateway deployment.
Description *string `coco:"description,optional"`
// stageDescription configures the stage that API Gateway creates with this deployment.
StageDescription *StageDescription `coco:"stageDescription,optional"`
// stageName is a name for the stage that API Gateway creates with this deployment. Use only alphanumeric
// characters.
StageName *string `coco:"stageName,optional"`
}
type StageDescription struct {
// Indicates whether cache clustering is enabled for the stage.
CacheClusterEnabled *bool `coco:"cacheClusterEnabled,optional"`
// The size of the stage's cache cluster.
CacheClusterSize *string `coco:"cacheClusterSize,optional"`
// Indicates whether the cached responses are encrypted.
CacheDataEncrypted *bool `coco:"cacheDataEncrypted,optional"`
// The time-to-live (TTL) period, in seconds, that specifies how long API Gateway caches responses.
CacheTTLInSeconds *float64 `coco:"cacheTTLInSeconds,optional"`
// Indicates whether responses are cached and returned for requests. You must enable a cache cluster on the stage
// to cache responses. For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html.
CachingEnabled *bool `coco:"cachingEnabled,optional"`
// The client certificate that API Gateway uses to call your integration endpoints in the stage.
ClientCertificate *ClientCertificate `coco:"clientCertificate,optional"`
// Indicates whether data trace logging is enabled for methods in the stage. API Gateway pushes these logs to Amazon
// CloudWatch Logs.
DataTraceEnabled *bool `coco:"dataTraceEnabled,optional"`
// A description of the purpose of the stage.
Description *string `coco:"description,optional"`
// The logging level for this method.
LoggingLevel *LoggingLevel `coco:"loggingLevel,optional"`
// Configures settings for all of the stage's methods.
MethodSettings *[]MethodSetting `coco:"methodSettings,optional"`
// Indicates whether Amazon CloudWatch metrics are enabled for methods in the stage.
MetricsEnabled *bool `coco:"metricsEnabled,optional"`
// The name of the stage, which API Gateway uses as the first path segment in the invoke URI.
StageName *string `coco:"stageName,optional"`
// The number of burst requests per second that API Gateway permits across all APIs, stages, and methods in your
// AWS account. For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html.
ThrottlingBurstLimit *float64 `coco:"throttlingBurstLimit,optional"`
// The number of steady-state requests per second that API Gateway permits across all APIs, stages, and methods in
// your AWS account. For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html.
ThrottlingRateLimit *float64 `coco:"throttlingRateLimit,optional"`
// A map that defines the stage variables. Variable names must consist of alphanumeric characters, and the values
// must match the following regular expression: `[A-Za-z0-9-._~:/?#&=,]+`.
Variables *map[string]string `coco:"variables,optional"`
}

View file

@ -0,0 +1,215 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The Method resource creates Amazon API Gateway (API Gateway) methods that define the parameters and
// body that clients must send in their requests.
type Method struct {
idl.NamedResource
// The HTTP method that clients will use to call this method.
HTTPMethod string `coco:"httpMethod"`
// The API Gateway resource. For root resource methods, specify the RestAPI's root resource ID.
APIResource *Resource `coco:"apiResource"`
// The RestAPI resource in which API Gateway creates the method.
RestAPI *RestAPI `coco:"restAPI"`
// Indicates whether the method requires clients to submit a valid API key.
APIKeyRequired *bool `coco:"apiKeyRequired,optional"`
// The method's authorization type. Required to be "CUSTOM" if you specify an authorizer.
AuthorizationType *AuthorizationType `coco:"authorizationType,optional"`
// The authorizer to use on this method. If you specify this, make sure authorizationType is set to "CUSTOM".
Authorizer *Authorizer `coco:"authorizer,optional"`
// The back-end system that the method calls when it receives a request.
Integration *Integration `coco:"integration,optional"`
// The responses that can be sent to the client who calls the method.
MethodResponses *[]MethodResponse `coco:"methodResponses,optional"`
// The resources used for the response's content type. Specify response models as key-value pairs, with a content
// type (string) as the key and a Model resource as the value.
RequestModels *map[string]*Model `coco:"requestModels,optional"`
// Request parameters that API Gateway accepts. Specify request parameters as key-value pairs (string-to-Boolean
// map), with a source as the key and a Boolean as the value. The Boolean specifies whether a parameter is
// required. A source must match the following format `method.request.location.name`, where the `location` is
// `querystring`, `path`, or `header`, and `name` is a valid, unique parameter name.
RequestParameters *map[string]bool `coco:"requestParameters,optional"`
}
// The method's authorization type.
type AuthorizationType string
const (
NoAuthorization AuthorizationType = "NONE" // open access.
AWSIAMAuthorization AuthorizationType = "AWS_IAM" // using AWS IAM permissions.
CustomAuthorization AuthorizationType = "CUSTOM" // a custom authorizer.
CognitoAuthorization AuthorizationType = "COGNITO_USER_POOLS" // a Cognito user pool.
)
// Integration specifies information about the target back end that an Amazon API Gateway method calls.
type Integration struct {
// The type of back end your method is running.
Type IntegrationType `coco:"type"`
// A list of request parameters whose values API Gateway will cache.
CacheKeyParameters *[]string `coco:"cacheKeyParameters,optional"`
// An API-specific tag group of related cached parameters.
CacheNamespace *string `coco:"cacheNamespace,optional"`
// The credentials required for the integration. To specify an AWS Identity and Access Management (IAM) role that
// API Gateway assumes, specify the role's Amazon Resource Name (ARN). To require that the caller's identity be
// passed through from the request, specify arn:aws:iam::*:user/*.
//
// To use resource-based permissions on the AWS Lambda (Lambda) function, don't specify this property. Use the
// AWS::Lambda::Permission resource to permit API Gateway to call the function. For more information, see
// http://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html#access-control-resource-based-example-apigateway-invoke-function.
Credentials *string `coco:"credentials,optional"`
// The integration's HTTP method type. This is required for all types except for "MOCK".
IntegrationHTTPMethod *string `coco:"integrationHTTPMethod,optional"`
// The response that API Gateway provides after a method's back end completes processing a request. API Gateway
// intercepts the back end's response so that you can control how API Gateway surfaces back-end responses. For
// example, you can map the back-end status codes to codes that you define.
IntegrationResponse *[]IntegrationResponse `coco:"integrationResponse,optional"`
// Indicates when API Gateway passes requests to the targeted back end. This behavior depends on the request's
// Content-Type header and whether you defined a mapping template for it.
PassthroughBehavior *PassthroughBehavior `coco:"passthroughBehavior,optional"`
// The request parameters that API Gateway sends with the back-end request. Specify request parameters as key-value
// pairs (string-to-string maps), with a destination as the key and a source as the value.
//
// Specify the destination using the following pattern `integration.request.location.name`, where `location` is
// `querystring`, `path`, or `header`, and `name` is a valid, unique parameter name.
//
// The source must be an existing method request parameter or a static value. Static values must be enclosed in
// single quotation marks and pre-encoded based on their destination in the request.
RequestParameters *map[string]string `coco:"requestParameters,optional"`
// A map of Apache Velocity templates that are applied on the request payload. The template that API Gateway uses
// is based on the value of the Content-Type header sent by the client. The content type value is the key, and the
// template is the value (specified as a string). For more information about templates, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html.
RequestTemplates *map[string]string `coco:"requestTemplates,optional"`
// The integration's Uniform Resource Identifier (URI).
//
// If you specify "HTTP" for the Type property, specify the API endpoint URL.
//
// If you specify "MOCK" for the Type property, don't specify this property.
//
// If you specify "AWS" for the Type property, specify an AWS service that follows the form:
// `arn:aws:apigateway:region:subdomain.service|service:path|action/service_api`. For example, a Lambda function
// URI follows the form: `arn:aws:apigateway:region:lambda:path/path`. The path is usually in the form
// `/2015-03-31/functions/LambdaFunctionARN/invocations`. For more information, see Integration's URI property.
//
// If you specify "HTTP" or "AWS" for the Type property, you must specify the URI property.
URI *string `coco:"uri,optional"`
}
// IntegrationType specifies an Integration's type.
type IntegrationType string
const (
HTTPIntegration IntegrationType = "HTTP" // for integrating with an HTTP back end.
HTTPProxyIntegration IntegrationType = "HTTP_PROXY" // for integrating with the HTTP proxy integration.
AWSIntegration IntegrationType = "AWS" // for any AWS service endpoints.
AWSProxyIntegration IntegrationType = "AWS_PROXY" // for integrating with the Lambda proxy integration type.
MockIntegration IntegrationType = "MOCK" // for testing without actually invoking the back end.
)
// IntegrationResponse specifies the response that Amazon API Gateway sends after a method's back end finishes
// processing a request.
type IntegrationResponse struct {
// The response parameters from the back-end response that API Gateway sends to the method response. Specify
// response parameters as key-value pairs (string-to-string mappings).
//
// Use the destination as the key and the source as the value:
//
// * The destination must be an existing response parameter in the MethodResponse property.
//
// * The source must be an existing method request parameter or a static value. You must enclose static values
// in single quotation marks and pre-encode these values based on the destination specified in the request.
//
// For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html.
ResponseParameters *map[string]string `coco:"responseParameters,optional"`
// The templates used to transform the integration response body. Specify templates as key-value pairs
// (string-to-string maps), with a content type as the key and a template as the value. For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html.
ResponseTemplates *map[string]string `coco:"responseTemplates,optional"`
// A regular expression that specifies which error strings or status codes from the back end map to the integration
// response.
SelectionPattern *string `coco:"selectionPattern,optional"`
// The status code that API Gateway uses to map the integration response to a MethodResponse status code.
StatusCode *string `coco:"statusCode,optional"`
}
// PassthroughBehavior specifies how the method request body of an unmapped content type will be passed through the
// integration request to the back end without transformation. A content type is unmapped if no mapping template is
// defined in the integration or the content type does not match any of the mapped content types.
type PassthroughBehavior string
const (
// Passes the method request body through the integration request to the back end without transformation when the
// method request content type does not match any content type associated with the mapping templates defined in the
// integration request.
PassthroughWhenNoMatch PassthroughBehavior = "WHEN_NO_MATCH"
// Passes the method request body through the integration request to the back end without transformation when no
// mapping template is defined in the integration request. If a template is defined when this option is selected,
// the method request of an unmapped content-type will be rejected with an HTTP 415 Unsupported Media Type response.
PassthroughWhenNoTemplates PassthroughBehavior = "WHEN_NO_TEMPLATES"
// Rejects the method request with an HTTP 415 Unsupported Media Type response when either the method request
// content type does not match any content type associated with the mapping templates defined in the integration
// request or no mapping template is defined in the integration request.
PassthroughNever PassthroughBehavior = "NEVER"
)
// MethodResponse defines the responses that can be sent to the client who calls an Amazon API Gateway method.
type MethodResponse struct {
// The method response's status code, which you map to an IntegrationResponse.
StatusCode string `coco:"statusCode"`
// The resources used for the response's content type. Specify response models as key-value pairs, with a content
// type as the key (string) and a Model resource as the value.
ResponseModels *map[string]*Model `coco:"responseModels,optional"`
// Response parameters that API Gateway sends to the client that called a method. Specify response parameters as
// key-value pairs (string-to-Boolean maps), with a destination as the key and a Boolean as the value. Specify the
// destination using the following pattern: `method.response.header.name`, where the `name` is a valid, unique
// header name. The Boolean specifies whether a parameter is required.
ResponseParameters *map[string]bool `coco:"responseParameters,optional"`
}
// MethodSetting configures settings for all methods in an Amazon API Gateway (API Gateway) stage.
type MethodSetting struct {
// Indicates whether the cached responses are encrypted.
CacheDataEncrypted *bool `coco:"cacheDataEncrypted,optional"`
// The time-to-live (TTL) period, in seconds, that specifies how long API Gateway caches responses.
CacheTTLInSeconds *float64 `coco:"cacheTTLInSeconds,optional"`
// Indicates whether responses are cached and returned for requests. You must enable a cache cluster on the stage
// to cache responses. For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html.
CachingEnabled *bool `coco:"cachingEnabled,optional"`
// Indicates whether data trace logging is enabled for methods in the stage. API Gateway pushes these logs to Amazon
// CloudWatch Logs.
DataTraceEnabled *bool `coco:"dataTraceEnabled,optional"`
// The HTTP method.
HTTPMethod *string `coco:"httpMethod,optional"`
// The logging level for this method.
LoggingLevel *LoggingLevel `coco:"loggingLevel,optional"`
// Indicates whether Amazon CloudWatch metrics are enabled for methods in the stage.
MetricsEnabled *bool `coco:"metricsEnabled,optional"`
// The resource path for this method. Forward slashes (`/`) are encoded as `~1` and the initial slash must include
// a forward slash. For example, the path value `/resource/subresource` must be encoded as
// `/~1resource~1subresource.` To specify the root path, use only a slash (`/`).
ResourcePath *string `coco:"resourcePath,optional"`
// The number of burst requests per second that API Gateway permits across all APIs, stages, and methods in your
// AWS account. For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html.
ThrottlingBurstLimit *float64 `coco:"throttlingBurstLimit,optional"`
// The number of steady-state requests per second that API Gateway permits across all APIs, stages, and methods in
// your AWS account. For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html.
ThrottlingRateLimit *float64 `coco:"throttlingRateLimit,optional"`
}
// Specifies the logging level for this method, which effects the log entries pushed to Amazon CloudWatch Logs.
type LoggingLevel string
const (
LoggingOff LoggingLevel = "OFF"
LoggingErrorLevel LoggingLevel = "ERROR"
LoggingInfoLevel LoggingLevel = "INFO"
)

View file

@ -0,0 +1,23 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The Model resource defines the structure of a request or response payload for an Amazon API Gateway method.
type Model struct {
idl.NamedResource
// The content type for the model.
ContentType string `coco:"contentType,replaces"`
// The REST API with which to associate this model.
RestAPI *RestAPI `coco:"restAPI,replaces"`
// The schema to use to transform data to one or more output formats. Specify null (`{}`) if you don't want to
// specify a schema.
Schema interface{} `coco:"schema"`
// A name for the model. If you don't specify a name, a unique physical ID is generated and used.
ModelName *string `coco:"modelName,replaces,optional"`
// A description that identifies this model.
Description *string `coco:"description,optional"`
}

View file

@ -0,0 +1,19 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// An Amazon API Gateway (API Gateway) API resource.
type Resource struct {
idl.NamedResource
// If you want to create a child resource, the parent resource. For resources without a parent, specify
// the RestAPI's root resource.
Parent *Resource `coco:"parent,replaces"`
// A path name for the resource.
PathPart string `coco:"pathPart,replaces"`
// The RestAPI resource in which you want to create this resource.
RestAPI *RestAPI `coco:"restAPI,replaces"`
}

View file

@ -0,0 +1,43 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
"github.com/pulumi/coconut/lib/aws/idl/s3"
)
// The RestAPI resource contains a collection of Amazon API Gateway (API Gateway) resources and methods that can be
// invoked through HTTPS endpoints.
type RestAPI struct {
idl.NamedResource
// An OpenAPI specification that defines a set of RESTful APIs in the JSON format.
Body *interface{} `coco:"body,optional"`
// The Amazon Simple Storage Service (Amazon S3) location that points to a OpenAPI file, which defines a set of
// RESTful APIs in JSON or YAML format.
BodyS3Location *S3Location `coco:"bodyS3Location,optional"`
// Another API Gateway RestAPI resource that you want to clone.
CloneFrom *RestAPI `coco:"cloneFrom,optional"`
// A description of the purpose of this API Gateway RestAPI resource.
Description *string `coco:"description,optional"`
// If a warning occurs while API Gateway is creating the RestAPI resource, indicates whether to roll back the
// resource.
FailOnWarnings *bool `coco:"failOnWarnings,optional"`
// A name for the API Gateway RestApi resource. Required if you don't specify an OpenAPI definition.
APIName *string `coco:"apiName,optional"`
// Custom header parameters for the request.
Parameters *[]string `coco:"parameters,optional"`
}
// S3Location is a property of the RestAPI resource that specifies the Amazon Simple Storage Service (Amazon S3)
// location of a OpenAPI (formerly Swagger) file that defines a set of RESTful APIs in JSON or YAML.
type S3Location struct {
// The S3 object corresponding to the OpenAPI file.
Object *s3.Object `coco:"object"`
// The Amazon S3 ETag (a file checksum) of the OpenAPI file. If you don't specify a value, API Gateway skips ETag
// validation of your OpenAPI file.
ETag *string `coco:"etag,optional"`
// For versioning-enabled buckets, a specific version of the OpenAPI file.
Version *string `coco:"version,optional"`
}

View file

@ -0,0 +1,33 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The Stage resource specifies the AWS Identity and Access Management (IAM) role that Amazon API
// Gateway (API Gateway) uses to write API logs to Amazon CloudWatch Logs (CloudWatch Logs).
type Stage struct {
idl.NamedResource
// The RestAPI resource that you're deploying with this stage.
RestAPI *RestAPI `coco:"restAPI,replaces"`
// The name of the stage, which API Gateway uses as the first path segment in the invoke URI.
StageName string `coco:"stageName,replaces"`
// The deployment that the stage points to.
Deployment *Deployment `coco:"deployment"`
// Indicates whether cache clustering is enabled for the stage.
CacheClusterEnabled *bool `coco:"cacheClusterEnabled,optional"`
// The stage's cache cluster size.
CacheClusterSize *string `coco:"cacheClusterSize,optional"`
// The identifier of the client certificate that API Gateway uses to call your integration endpoints in the stage.
ClientCertificate *ClientCertificate `coco:"clientCertificate,optional"`
// A description of the stage's purpose.
Description *string `coco:"description,optional"`
// Settings for all methods in the stage.
MethodSettings *[]MethodSetting `coco:"methodSettings,optional"`
// A map (string to string map) that defines the stage variables, where the variable name is the key and the
// variable value is the value. Variable names are limited to alphanumeric characters. Values must match the
// following regular expression: `[A-Za-z0-9-._~:/?#&=,]+`.
Variables *map[string]string `coco:"variables,optional"`
}

View file

@ -0,0 +1,61 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The UsagePlan resource specifies a usage plan for deployed Amazon API Gateway (API Gateway) APIs. A
// usage plan enforces throttling and quota limits on individual client API keys. For more information, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-usage-plans.html.
type UsagePlan struct {
idl.NamedResource
APIStages *[]APIStage `coco:"apiStages,optional"`
Description *string `coco:"description,optional"`
Quota *QuotaSettings `coco:"quota,optional"`
Throttle *ThrottleSettings `coco:"throttle,optional"`
UsagePlanName *string `coco:"usagePlanName,optional"`
}
// APIStage specifies which Amazon API Gateway (API Gateway) stage and API to associate with a usage plan.
type APIStage struct {
// The API you want to associate with the usage plan.
API *RestAPI `coco:"api,optional"`
// The Stage you want to associate with the usage plan.
Stage *Stage `coco:"stage,optional"`
}
// QuotaSettings specifies the maximum number of requests users can make to your Amazon API Gateway (API Gateway) APIs.
type QuotaSettings struct {
// The maximum number of requests that users can make within the specified time period.
Limit *float64 `coco:"limit,optional"`
// For the initial time period, the number of requests to subtract from the specified limit. When you first
// implement a usage plan, the plan might start in the middle of the week or month. With this property, you can
// decrease the limit for this initial time period.
Offset *float64 `coco:"offset,optional"`
// The time period for which the maximum limit of requests applies.
Period *QuotaPeriod `coco:"period,optional"`
}
// The time period in which a quota limit applies.
type QuotaPeriod string
const (
QuotaDayPeriod QuotaPeriod = "DAY"
QuotaWeekPeriod QuotaPeriod = "WEEK"
QuotaMonthPeriod QuotaPeriod = "MONTH"
)
// ThrottleSettings specifies the overall request rate (average requests per second) and burst capacity when users call
// your Amazon API Gateway (API Gateway) APIs.
type ThrottleSettings struct {
// The maximum API request rate limit over a time ranging from one to a few seconds. The maximum API request rate
// limit depends on whether the underlying token bucket is at its full capacity. For more information about request
// throttling, see http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html.
BurstRateLimit *float64 `coco:"burstRateLimit,optional"`
// The API request steady-state rate limit (average requests per second over an extended period of time). For more
// information about request throttling, see
// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html.
RateLimit *float64 `coco:"rateLimit,optional"`
}

View file

@ -0,0 +1,17 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package apigateway
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The UsagePlanKey resource associates an Amazon API Gateway API key with an API Gateway usage plan. This association
// determines which user the usage plan is applied to.
type UsagePlanKey struct {
idl.NamedResource
// The API key for the API resource to associate with a usage plan.
Key *APIKey `coco:"key,replaces"`
// The usage plan.
UsagePlan *UsagePlan `coco:"usagePlan,replaces"`
}

View file

@ -0,0 +1,118 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package cloudwatch
import (
"github.com/pulumi/coconut/pkg/resource/idl"
"github.com/pulumi/coconut/lib/aws/idl/sns"
)
// Alarm is a CloudWatch alarm. For more information, see
// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html.
type Alarm struct {
idl.NamedResource
// The arithmetic operator to use when comparing the specified statistic and threshold. The specified statistic
// value is used as the first operand (so, "<statistic> <op> <threshold>").
ComparisonOperator AlarmComparisonOperator `coco:"comparisonOperator"`
// The number of periods over which data is compared to the specific threshold.
EvaluationPeriods float64 `coco:"evaluationPerids"`
// The name for the alarm's associated metric.
MetricName string `coco:"metricName"`
// The namespace for the alarm's associated metric.
Namespace string `coco:"namespace"`
// The time over which the specified statistic is applied; it is a time in second that is a multiple of 60.
Period float64 `coco:"period"`
// The statistic to apply to the alarm's associated metric.
Statistic AlarmStatistic `coco:"statistic"`
// The value against which the specified statistic is compared.
Threshold float64 `coco:"threshold"`
// Indicates whether or not actions should be executed during any changes to the alarm's state.
ActionsEnabled *bool `coco:"actionsEnabled,optional"`
// The list of actions to execute hen this alarm transitions into an ALARM state from any other state. Each action
// is specified as an Amazon Resource Number (ARN).
AlarmActions *[]ActionTarget `coco:"alarmActions,optional"`
// The description for the alarm.
AlarmDescription *string `coco:"alarmDescription,optional"`
// A name for the alarm. If you don't specify one, an auto-generated physical ID will be assigned.
AlarmName *string `coco:"alarmName,replaces,optional"`
// The dimension for the alarm's associated metric.
Dimensions *[]AlarmDimension `coco:"dimensions,optional"`
// The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state.
// Each action is specified as an Amazon Resource Number (ARN). Currently the only action supported is publishing
// to an Amazon SNS topic or an Amazon Auto Scaling policy.
InsufficientDataActions *[]ActionTarget `coco:"insufficientDataActions,optional"`
// The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is
// specified as an Amazon Resource Number (ARN). Currently the only action supported is publishing to an Amazon SNS
// topic of an Amazon Auto Scaling policy.
OKActions *[]ActionTarget `coco:"okActions,optional"`
// The unit for the alarm's associated metric.
Unit *AlarmMetric `coco:"unit,optional"`
}
// ActionTarget is a strongly typed capability for an action target to avoid string-based ARNs.
// TODO[pulumi/coconut#90]: once we support more resource types, we need to support Auto Scaling policies, etc. It's
// not yet clear whether we should do this using ARNs, or something else.
type ActionTarget sns.Topic
// AlarmComparisonOperator represents the operator (>=, >, <, or <=) used for alarm threshold comparisons.
type AlarmComparisonOperator string
const (
ThresholdGreaterThanOrEqualTo AlarmComparisonOperator = "GreaterThanOrEqualToThreshold"
ThresholdGreaterThan AlarmComparisonOperator = "GreaterThanThreshold"
ThresholdLessThan AlarmComparisonOperator = "LessThanThreshold"
ThresholdLessThanOrEqualTo AlarmComparisonOperator = "LessThanOrEqualToThreshold"
)
// AlarmStatistic represents the legal values for an alarm's statistic.
type AlarmStatistic string
const (
SampleCountStatistic AlarmStatistic = "SampleCount"
AverageStatistic AlarmStatistic = "Average"
SumStatistic AlarmStatistic = "Sum"
MinimumStatistic AlarmStatistic = "Minimum"
MaximumStatistic AlarmStatistic = "Maximum"
)
// AlarmDimension is an embedded property of the alarm type. Dimensions are arbitrary name/value pairs that can be
// associated with a CloudWatch metric. You can specify a maximum of 10 dimensions for a given metric.
type AlarmDimension struct {
Name string `coco:"name"` // the name of the dimension, from 1-255 characters in length.
// TODO[pulumi/coconut#90]: strongly type this.
Value interface{} `coco:"value"` // the value representing the dimension measurement, from 1-255 characters in length.
}
// AlarmMetric represents the legal values for an alarm's associated metric.
type AlarmMetric string
const (
SecondsMetric AlarmMetric = "Seconds"
MicrosecondsMetric AlarmMetric = "Microseconds"
MillisecondsMetric AlarmMetric = "Milliseconds"
BytesMetric AlarmMetric = "Bytes"
KilobytesMetric AlarmMetric = "Kilobytes"
MegabytesMetric AlarmMetric = "Megabytes"
GigabytesMetric AlarmMetric = "Gigabytes"
TerabytesMetric AlarmMetric = "Terabytes"
BytesPerSecondMetric AlarmMetric = "Bytes/Second"
KilobytesPerSecondMetric AlarmMetric = "Kilobytes/Second"
MegabytesPerSecondMetric AlarmMetric = "Megabytes/Second"
GigabytesPerSecondMetric AlarmMetric = "Gigabytes/Second"
TerabytesPerSecondMetric AlarmMetric = "Terabytes/Second"
BitsMetric AlarmMetric = "Bits"
KilobitsMetric AlarmMetric = "Kilobits"
MegabitsMetric AlarmMetric = "Megabits"
GigabitsMetric AlarmMetric = "Gigabits"
TerabitsMetric AlarmMetric = "Terabits"
BitsPerSecondMetric AlarmMetric = "Bits/Second"
KilobitsPerSecondMetric AlarmMetric = "Kilobits/Second"
MegabitsPerSecondMetric AlarmMetric = "Megabits/Second"
GigabitsPerSecondMetric AlarmMetric = "Gigabits/Second"
TerabitsPerSecondMetric AlarmMetric = "Terabits/Second"
PercentMetric AlarmMetric = "Percent"
CountMetric AlarmMetric = "Count"
CountPerSecondMetric AlarmMetric = "Count/Second"
NoMetric AlarmMetric = "None"
)

40
lib/aws/idl/sns/topic.go Normal file
View file

@ -0,0 +1,40 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package sns
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// An Amazon Simple Notification Service (Amazon SNS) topic. For more information, see
// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html.
type Topic struct {
idl.NamedResource
// A name for the topic. If you don't specify a name, a unique physical ID will be generated.
TopicName *string `coco:"topicName,replaces,optional"`
// A developer-defined string that can be used to identify this SNS topic.
DisplayName *string `coco:"displayName,optional"`
// The SNS subscriptions (endpoints) for this topic.
Subscription *[]TopicSubscription `coco:"subscription,optional"`
}
type TopicSubscription struct {
// The subscription's protocol.
Protocol TopicProtocol `coco:"protocol"`
// The subscription's endpoint (format depends on the protocol).
Endpoint string `coco:"endpoint"`
}
// The protocols supported by the Amazon Simple Notification Service (Amazon SNS).
type TopicProtocol string
const (
HTTPTopic TopicProtocol = "http" // delivery of JSON-encoded message via HTTP POST.
HTTPSTopic TopicProtocol = "https" // delivery of JSON-encoded message via HTTPS POST.
EmailTopic TopicProtocol = "email" // delivery of message via SMTP.
EmailJSONTopic TopicProtocol = "email-json" // delivery of JSON-encoded message via SMTP.
SMSTopic TopicProtocol = "sms" // delivery of message via SMS.
SQSTopic TopicProtocol = "sqs" // delivery of JSON-encoded message to an Amazon SQS queue.
ApplicationTopic TopicProtocol = "application" // delivery of JSON-encoded message to a mobile app or device.
LambdaTopic TopicProtocol = "lambda" // delivery of JSON-encoded message to an AWS Lambda function.
)

61
lib/aws/idl/sqs/queue.go Normal file
View file

@ -0,0 +1,61 @@
// Copyright 2017 Pulumi, Inc. All rights reserved.
package sqs
import (
"github.com/pulumi/coconut/pkg/resource/idl"
)
// The Queue resource creates an Amzon Simple Queue Service (Amazon SQS) queue. For more information about creating
// FIFO (first-in-first-out) queues, see http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/.
type Queue struct {
idl.NamedResource
// FIFOQueue indicates whether this queue is a FIFO queue. The default value is `false`.
FIFOQueue *bool `coco:"fifoQueue,replaces,optional"`
// queueName is a name for the queue. To create a FIFO queue, the name of your FIFO queue must end with the `.fifo`
// suffix. If you don't specify a name, a unique physical ID will be generated and used.
//
// Important: If you specify a name, you cannot perform updates that require replacement of this resource. You can
// perform updates that require no or some interruption. If you must replace the resource, specify a new name.
QueueName *string `coco:"queueName,replaces,optional"`
// contentBasedDeduplication, for first-in-first-out (FIFO) queues, specifies whether to enable content-based
// deduplication. During the deduplication interval, Amazon SQS treats messages that are sent with identical
// content as duplicates and delivers only one copy of the message.
ContentBasedDeduplication *bool `coco:"contentBasedDeduplication,optional"`
// delaySeconds is the time in seconds that the delivery of all messages in the queue is delayed. You can specify
// an integer value of `0` to `900` (15 minutes). The default value is `0`.
DelaySeconds *float64 `coco:"delaySeconds,optional"`
// maximumMessageSize sets a limit of how many bytes that a message can contain before Amazon SQS rejects it. You
// can specify an integer value from `1024` bytes (1 KiB) to `262144` bytes (256 KiB). The default value is
// `262144` bytes (256 KiB).
MaximumMessageSize *float64 `coco:"maximumMessageSize,optional"`
// messageRetentionPeriod is the number of seconds that Amazon SQS retains a message. You can specify an integer
// value from `60` seconds (1 minute) to `1209600` seconds (14 days). The default value is `345600` (4 days).
MessageRetentionPeriod *float64 `coco:"messageRetentionPeriod,optional"`
// receiveMessageWaitTimeSeconds specifies the duration, in seconds, that receiving a message waits until a message
// is in the queue in order to include it in the response, as opposed to returning an empty response if a message is
// not yet available. You can specify an integer from `1` to `20`. The short polling is used as the default
// or when you specify `0` for this property. For more information about SQS Long Polling, see
// http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-long-polling.html.
ReceiveMessageWaitTimeSeconds *float64 `coco:"receiveMessageWaitTimeSeconds,optional"`
// redrivePolicy specifies an existing dead letter queue to receive messages after the source queue (this queue)
// fails to process a message a specified number of times.
RedrivePolicy *RedrivePolicy `coco:"redrivePolicy,optional"`
// visibilityTimeout specifies the length of time during which a message will be unavailable after a message is
// delivered from the queue. This blocks other components from receiving the same message and gives the initial
// component time to process and delete the message from the queue.
//
// Values must be from `0` to `43200` seconds (12 hours). The default value if unspecified is `30` seconds.
//
// For more information about Amazon SQS queue visibility timeouts, see Visibility Timeouts in
// http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html.
VisibilityTimeout *float64 `coco:"visibilityTimeout,optional"`
}
type RedrivePolicy struct {
// deadLetterTarget is the dead letter queue to which the messages are sent after maxReceiveCount has been exceeded.
DeadLetterTarget *Queue `coco:"deadLetterTarget"`
// maxReceiveCount is the number of times a message is delivered to the source queue before being sent to the dead
// letter queue.
MaxReceiveCount float64 `coco:"maxReceiveCount"`
}