diff --git a/.travis.yml b/.travis.yml index fb2b0b95a..35e5d0795 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ install: - godep restore -v - pushd cmd/lumijs/ && yarn install && popd - pushd lib/lumi/ && yarn install && popd - - pushd lib/aws/pack/ && yarn install && popd before_script: - export PATH=$TRAVIS_BUILD_DIR/cmd/lumijs:$PATH - export LUMIROOT=~/.lumi diff --git a/Makefile b/Makefile index f81093f5b..cdaff03d1 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,10 @@ GOMETALINTER=${GOMETALINTERBIN} --config=Gometalinter.json default: banner vet test install lint_quiet .PHONY: all -all: banner_all vet test install lint_quiet lumijs lumirtpkg lumijspkg lumipkg awspkg +all: banner_all vet test install lint_quiet lumijs lumirtpkg lumijspkg lumipkg .PHONY: nightly -nightly: banner_all vet test install lint_quiet lumijs lumirtpkg lumijspkg lumipkg awspkg examples gocover +nightly: banner_all vet test install lint_quiet lumijs lumirtpkg lumijspkg lumipkg examples gocover .PHONY: banner banner: @@ -75,21 +75,13 @@ test: lumijs: @cd ./cmd/lumijs && $(MAKE) -.PHONY: lumirtpkg lumirtpkg: @cd ./lib/lumirt && $(MAKE) - -.PHONY: lumijspkg lumijspkg: @cd ./lib/lumijs && $(MAKE) - -.PHONY: lumipkg lumipkg: @cd ./lib/lumi && $(MAKE) - -.PHONY: awspkg -awspkg: - @cd ./lib/aws && $(MAKE) +.PHONY: lumirtpkg lumijspkg lumipkg publish: @$(ECHO) "\033[0;32mPublishing current release:\033[0m" diff --git a/lib/aws/.gitignore b/lib/aws/.gitignore deleted file mode 100644 index 81325b3d8..000000000 --- a/lib/aws/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/bin/ - diff --git a/lib/aws/Gometalinter.json b/lib/aws/Gometalinter.json deleted file mode 100644 index 8583d3ec0..000000000 --- a/lib/aws/Gometalinter.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "Deadline": "5m", - "DisableAll": true, - "Enable": [ - "aligncheck", - "deadcode", - "errcheck", - "gas", - "goconst", - "gofmt", - "golint", - "gosimple", - "ineffassign", - "interfacer", - "lll", - "misspell", - "staticcheck", - "structcheck", - "unconvert", - "varcheck", - "vet", - "vetshadow" - ], - "LineLength": 120 -} - diff --git a/lib/aws/Makefile b/lib/aws/Makefile deleted file mode 100644 index 0812c2f8a..000000000 --- a/lib/aws/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -SHELL=/bin/bash -.SHELLFLAGS=-e - -GOPKGS = $(shell go list ./provider/... | grep -v /vendor/) -LUMIROOT ?= /usr/local/lumi -LUMILIB = ${LUMIROOT}/packs -THISLIB = ${LUMILIB}/aws -TESTPARALLELISM = 10 - -ECHO=echo -e -GOMETALINTERBIN=gometalinter -GOMETALINTER=${GOMETALINTERBIN} --config=Gometalinter.json - -.PHONY: default -default: banner vet build test install lint_quiet - -.PHONY: banner -banner: - @$(ECHO) "\033[1;37m================\033[0m" - @$(ECHO) "\033[1;37mLumi AWS Package\033[0m" - @$(ECHO) "\033[1;37m================\033[0m" - -.PHONY: gen -gen: - @$(ECHO) "\033[0;32mGEN:\033[0m" - lumidl \ - aws idl/ \ - --recursive \ - --out-pack=pack/ \ - --out-rpc=rpc/ - -.PHONY: clean -clean: - rm -rf ./bin - rm -rf ${THISLIB} - -.PHONY: build -build: - @$(ECHO) "\033[0;32mBUILD:\033[0m" - cd pack/ && yarn link @lumi/lumirt @lumi/lumijs @lumi/lumi # ensure we resolve to Lumi's stdlib. - cd pack/ && lumijs # compile the LumiPack - cd pack/ && lumi pack verify # ensure the pack verifies - cp -R pack/.lumi/bin/ bin/ # copy the pack to our bin dir - go version - cd provider/ && go build -i -o ../bin/lumi-resource-aws # compile the resource provider - -.PHONY: install -install: build - @$(ECHO) "\033[0;32mINSTALL:\033[0m [${LUMILIB}]" - cd pack/ && yarn link # ensure NPM references resolve locally. - mkdir -p ${LUMILIB} # ensure the machine-wide library dir exists. - cp -R ./bin/ ${THISLIB} # copy to the standard library location. - -.PHONY: lint -lint: - @$(ECHO) "\033[0;32mLINT:\033[0m" - ./pack/node_modules/.bin/tslint './pack/**/*.ts' --exclude='./pack/node_modules/**' - which ${GOMETALINTERBIN} >/dev/null - $(GOMETALINTER) ./provider/... | sort ; exit "$${PIPESTATUS[0]}" - -# In quiet mode, suppress some messages. -# - "or be unexported": TODO[pulumi/lumi#191]: will fix when we write all of our API docs -# - "cyclomatic complexity" (in config): TODO[pulumi/lumi#259]: need to fix a bunch of complex functions. -LINT_SUPPRESS="or be unexported" - -.PHONY: lint_quiet -lint_quiet: - @$(ECHO) "\033[0;32mLINT (quiet):\033[0m" - ./pack/node_modules/.bin/tslint './pack/**/*.ts' --exclude='./pack/node_modules/**' - which ${GOMETALINTERBIN} >/dev/null - $(GOMETALINTER) ./provider/... | grep -vE ${LINT_SUPPRESS} | sort ; exit $$(($${PIPESTATUS[1]}-1)) - @$(ECHO) "\033[0;33mgolint was run quietly; to run with noisy errors, run 'make lint'\033[0m" - -.PHONY: vet -vet: - @$(ECHO) "\033[0;32mVET:\033[0m" - go tool vet -printf=false provider/ - -.PHONY: test -test: - @$(ECHO) "\033[0;32mTEST:\033[0m" - go test -cover -parallel ${TESTPARALLELISM} ${GOPKGS} - -.PHONY: verify -verify: gen - $(shell git diff --quiet .) - diff --git a/lib/aws/README.md b/lib/aws/README.md deleted file mode 100644 index 562b50634..000000000 --- a/lib/aws/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# lib/aws - -This directory contains the primitive stacks for AWS resources. - -Eventually, this should likely move out into its own standalone Git repo. - diff --git a/lib/aws/idl/apigateway/account.go b/lib/aws/idl/apigateway/account.go deleted file mode 100644 index 201eb4f36..000000000 --- a/lib/aws/idl/apigateway/account.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" - - "github.com/pulumi/lumi/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 `lumi:"cloudWatchRole,optional"` -} diff --git a/lib/aws/idl/apigateway/apiKey.go b/lib/aws/idl/apigateway/apiKey.go deleted file mode 100644 index 1ef76f14a..000000000 --- a/lib/aws/idl/apigateway/apiKey.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"keyName,replaces,optional"` - // Description is a description of the purpose of the API key. - Description *string `lumi:"description,optional"` - // Enabled indicates whether the API key can be used by clients. - Enabled *bool `lumi:"enabled,optional"` - // StageKeys is a list of stages to associated with this API key. - StageKeys *StageKey `lumi:"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 `lumi:"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 `lumi:"stage,optional"` -} diff --git a/lib/aws/idl/apigateway/authorizer.go b/lib/aws/idl/apigateway/authorizer.go deleted file mode 100644 index 95ffe6cb9..000000000 --- a/lib/aws/idl/apigateway/authorizer.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" - - "github.com/pulumi/lumi/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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"identityValidationExpression,optional"` - // providers is a list of the Amazon Cognito user pools to associate with this authorizer. - Providers *[]idl.Resource/*TODO[pulumi/lumi#217]: cognito.UserPool*/ `lumi:"providers,optional"` - // RestAPI is the resource in which API Gateway creates the authorizer. - RestAPI *RestAPI `lumi:"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. -) diff --git a/lib/aws/idl/apigateway/basePathMapping.go b/lib/aws/idl/apigateway/basePathMapping.go deleted file mode 100644 index 54cc698b8..000000000 --- a/lib/aws/idl/apigateway/basePathMapping.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"domainName"` - // RestAPI is the API to map. - RestAPI *RestAPI `lumi:"restAPI"` - // BasePath is the base path that callers of the API must provider in the URL after the domain name. - BasePath *string `lumi:"basePath,optional"` - // Stage is the mapping's API stage. - Stage *Stage `lumi:"stage,optional"` -} diff --git a/lib/aws/idl/apigateway/clientCertificate.go b/lib/aws/idl/apigateway/clientCertificate.go deleted file mode 100644 index 1d3fcb322..000000000 --- a/lib/aws/idl/apigateway/clientCertificate.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"description,optional"` -} diff --git a/lib/aws/idl/apigateway/deployment.go b/lib/aws/idl/apigateway/deployment.go deleted file mode 100644 index 614b6fe79..000000000 --- a/lib/aws/idl/apigateway/deployment.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"restAPI,replaces"` - // description is a description of the purpose of the API Gateway deployment. - Description *string `lumi:"description,optional"` - - // The identifier for the deployment resource. - ID string `lumi:"id,out"` - // The date and time that the deployment resource was created. - CreatedDate string `lumi:"createdDate,out"` -} diff --git a/lib/aws/idl/apigateway/method.go b/lib/aws/idl/apigateway/method.go deleted file mode 100644 index 192d62b49..000000000 --- a/lib/aws/idl/apigateway/method.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"httpMethod"` - // The API Gateway resource. For root resource methods, specify the RestAPI's root resource ID. - APIResource *Resource `lumi:"apiResource"` - // The RestAPI resource in which API Gateway creates the method. - RestAPI *RestAPI `lumi:"restAPI"` - // Indicates whether the method requires clients to submit a valid API key. - APIKeyRequired *bool `lumi:"apiKeyRequired,optional"` - // The method's authorization type. Required to be "CUSTOM" if you specify an authorizer. - AuthorizationType *AuthorizationType `lumi:"authorizationType,optional"` - // The authorizer to use on this method. If you specify this, make sure authorizationType is set to "CUSTOM". - Authorizer *Authorizer `lumi:"authorizer,optional"` - // The back-end system that the method calls when it receives a request. - Integration *Integration `lumi:"integration,optional"` - // The responses that can be sent to the client who calls the method. - MethodResponses *[]MethodResponse `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"type"` - // A list of request parameters whose values API Gateway will cache. - CacheKeyParameters *[]string `lumi:"cacheKeyParameters,optional"` - // An API-specific tag group of related cached parameters. - CacheNamespace *string `lumi:"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 `lumi:"credentials,optional"` - // The integration's HTTP method type. This is required for all types except for "MOCK". - IntegrationHTTPMethod *string `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"responseTemplates,optional"` - // A regular expression that specifies which error strings or status codes from the back end map to the integration - // response. - SelectionPattern *string `lumi:"selectionPattern,optional"` - // The status code that API Gateway uses to map the integration response to a MethodResponse status code. - StatusCode *string `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"cacheDataEncrypted,optional"` - // The time-to-live (TTL) period, in seconds, that specifies how long API Gateway caches responses. - CacheTTLInSeconds *float64 `lumi:"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 `lumi:"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 `lumi:"dataTraceEnabled,optional"` - // The HTTP method. - HTTPMethod *string `lumi:"httpMethod,optional"` - // The logging level for this method. - LoggingLevel *LoggingLevel `lumi:"loggingLevel,optional"` - // Indicates whether Amazon CloudWatch metrics are enabled for methods in the stage. - MetricsEnabled *bool `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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" -) diff --git a/lib/aws/idl/apigateway/model.go b/lib/aws/idl/apigateway/model.go deleted file mode 100644 index 571559b21..000000000 --- a/lib/aws/idl/apigateway/model.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"contentType,replaces"` - // The REST API with which to associate this model. - RestAPI *RestAPI `lumi:"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{} `lumi:"schema"` - // A name for the model. If you don't specify a name, a unique physical ID is generated and used. - ModelName *string `lumi:"modelName,replaces,optional"` - // A description that identifies this model. - Description *string `lumi:"description,optional"` -} diff --git a/lib/aws/idl/apigateway/resource.go b/lib/aws/idl/apigateway/resource.go deleted file mode 100644 index 9768b7676..000000000 --- a/lib/aws/idl/apigateway/resource.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"parent,replaces"` - // A path name for the resource. - PathPart string `lumi:"pathPart,replaces"` - // The RestAPI resource in which you want to create this resource. - RestAPI *RestAPI `lumi:"restAPI,replaces"` -} diff --git a/lib/aws/idl/apigateway/restAPI.go b/lib/aws/idl/apigateway/restAPI.go deleted file mode 100644 index 0be8d1c9c..000000000 --- a/lib/aws/idl/apigateway/restAPI.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" - - "github.com/pulumi/lumi/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{} `lumi:"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 `lumi:"bodyS3Location,optional"` - // Another API Gateway RestAPI resource that you want to clone. - CloneFrom *RestAPI `lumi:"cloneFrom,optional"` - // A description of the purpose of this API Gateway RestAPI resource. - Description *string `lumi:"description,optional"` - // If a warning occurs while API Gateway is creating the RestAPI resource, indicates whether to roll back the - // resource. - FailOnWarnings *bool `lumi:"failOnWarnings,optional"` - // A name for the API Gateway RestApi resource. Required if you don't specify an OpenAPI definition. - APIName *string `lumi:"apiName,optional"` - // Custom header parameters for the request. - Parameters *[]string `lumi:"parameters,optional"` - - // The API's identifier. This identifier is unique across all of your APIs in Amazon API Gateway. - ID string `lumi:"id,out"` - // The timestamp when the API was created. - CreatedDate string `lumi:"createdDate,out"` - // A version identifier for the API. - Version string `lumi:"version,out"` - // The warning messages reported when failonwarnings is turned on during API import. - Warnings []string `lumi:"warnings,out"` - // The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded - // text payloads. - BinaryMediaTypes []string `lumi:"binaryMediaTypes,out"` -} - -// 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 `lumi:"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 `lumi:"etag,optional"` - // For versioning-enabled buckets, a specific version of the OpenAPI file. - Version *string `lumi:"version,optional"` -} diff --git a/lib/aws/idl/apigateway/stage.go b/lib/aws/idl/apigateway/stage.go deleted file mode 100644 index 1f3d61a2d..000000000 --- a/lib/aws/idl/apigateway/stage.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"restAPI,replaces"` - // The name of the stage, which API Gateway uses as the first path segment in the invoke URI. - StageName string `lumi:"stageName,replaces"` - // The deployment that the stage points to. - Deployment *Deployment `lumi:"deployment"` - // Indicates whether cache clustering is enabled for the stage. - CacheClusterEnabled *bool `lumi:"cacheClusterEnabled,optional"` - // The stage's cache cluster size. - CacheClusterSize *string `lumi:"cacheClusterSize,optional"` - // The identifier of the client certificate that API Gateway uses to call your integration endpoints in the stage. - ClientCertificate *ClientCertificate `lumi:"clientCertificate,optional"` - // A description of the stage's purpose. - Description *string `lumi:"description,optional"` - // Settings for all methods in the stage. - MethodSettings *[]MethodSetting `lumi:"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 `lumi:"variables,optional"` - - // The timestamp when the stage was created. - CreatedDate string `lumi:"createdDate,out"` - // The timestamp when the stage last updated. - LastUpdatedDate string `lumi:"lastUpdatedDate,out"` - // The URL to invoke the HTTP endpoint for this API stage. - URL string `lumi:"url,out"` - // The execution ARN needed to pass to Lambda to give this API stage permission. - ExecutionARN string `lumi:"executionARN,out"` -} diff --git a/lib/aws/idl/apigateway/usagePlan.go b/lib/aws/idl/apigateway/usagePlan.go deleted file mode 100644 index 43d016947..000000000 --- a/lib/aws/idl/apigateway/usagePlan.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"apiStages,optional"` - Description *string `lumi:"description,optional"` - Quota *QuotaSettings `lumi:"quota,optional"` - Throttle *ThrottleSettings `lumi:"throttle,optional"` - UsagePlanName *string `lumi:"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 `lumi:"api,optional"` - // The Stage you want to associate with the usage plan. - Stage *Stage `lumi:"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 `lumi:"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 `lumi:"offset,optional"` - // The time period for which the maximum limit of requests applies. - Period *QuotaPeriod `lumi:"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 `lumi:"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 `lumi:"rateLimit,optional"` -} diff --git a/lib/aws/idl/apigateway/usagePlanKey.go b/lib/aws/idl/apigateway/usagePlanKey.go deleted file mode 100644 index e0b105b0d..000000000 --- a/lib/aws/idl/apigateway/usagePlanKey.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "github.com/pulumi/lumi/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 `lumi:"key,replaces"` - // The usage plan. - UsagePlan *UsagePlan `lumi:"usagePlan,replaces"` -} diff --git a/lib/aws/idl/cloudwatch/alarm.go b/lib/aws/idl/cloudwatch/alarm.go deleted file mode 100644 index cadebeedd..000000000 --- a/lib/aws/idl/cloudwatch/alarm.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package cloudwatch - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" - - "github.com/pulumi/lumi/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, " "). - ComparisonOperator AlarmComparisonOperator `lumi:"comparisonOperator"` - // The number of periods over which data is compared to the specific threshold. - EvaluationPeriods float64 `lumi:"evaluationPerids"` - // The name for the alarm's associated metric. - MetricName string `lumi:"metricName"` - // The namespace for the alarm's associated metric. - Namespace string `lumi:"namespace"` - // The time over which the specified statistic is applied; it is a time in second that is a multiple of 60. - Period float64 `lumi:"period"` - // The statistic to apply to the alarm's associated metric. - Statistic AlarmStatistic `lumi:"statistic"` - // The value against which the specified statistic is compared. - Threshold float64 `lumi:"threshold"` - // Indicates whether or not actions should be executed during any changes to the alarm's state. - ActionsEnabled *bool `lumi:"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 `lumi:"alarmActions,optional"` - // The description for the alarm. - AlarmDescription *string `lumi:"alarmDescription,optional"` - // A name for the alarm. If you don't specify one, an auto-generated physical ID will be assigned. - AlarmName *string `lumi:"alarmName,replaces,optional"` - // The dimension for the alarm's associated metric. - Dimensions *[]AlarmDimension `lumi:"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 `lumi:"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 `lumi:"okActions,optional"` - // The unit for the alarm's associated metric. - Unit *AlarmMetric `lumi:"unit,optional"` -} - -// ActionTarget is a strongly typed capability for an action target to avoid string-based ARNs. -// TODO[pulumi/lumi#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 `lumi:"name"` // the name of the dimension, from 1-255 characters in length. - // TODO[pulumi/lumi#90]: strongly type this. - Value interface{} `lumi:"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" -) diff --git a/lib/aws/idl/cloudwatch/logGroup.go b/lib/aws/idl/cloudwatch/logGroup.go deleted file mode 100644 index 790c1330c..000000000 --- a/lib/aws/idl/cloudwatch/logGroup.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package cloudwatch - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// LogGroup is a CloudWatch Logs log group. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html. -type LogGroup struct { - idl.NamedResource - // The name of the log group. - LogGroupName *string `lumi:"logGroupName,optional,replaces"` - // The number of days log events are kept in CloudWatch Logs. When a log event expires, CloudWatch Logs automatically deletes it. - RetentionInDays *float64 `lumi:"retentionInDays,optional"` -} diff --git a/lib/aws/idl/cloudwatch/logSubscriptionFilter.go b/lib/aws/idl/cloudwatch/logSubscriptionFilter.go deleted file mode 100644 index 5bdda0ef1..000000000 --- a/lib/aws/idl/cloudwatch/logSubscriptionFilter.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package cloudwatch - -import ( - aws "github.com/pulumi/lumi/lib/aws/idl" - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// LogSubscriptionFilter is a CloudWatch Logs subscription filter. For more information, see -// http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CreateSubscriptionFilter.html. -type LogSubscriptionFilter struct { - idl.NamedResource - // The name of the log group. - LogGroupName string `lumi:"logGroupName,replaces"` - // A filter pattern for subscribing to a filtered stream of log events. - FilterPattern string `lumi:"filterPattern"` - // The ARN of the destination to deliver matching log events to. - DestinationArn string `lumi:"destinationArn,replaces"` - // The ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the - // destination stream. You don't need to provide the ARN when you are working with a logical destination for - // cross-account delivery. - RoleARN *aws.ARN `lumi:"roleArn,optional"` - // The method used to distribute log data to the destination, when the destination is an Amazon Kinesis stream. - // By default, log data is grouped by log stream. For a more even distribution, you can group log data randomly. - Distribution *LogSubscriptionDistribution `lumi:"distribution,optional"` - - // The time the log group subscription gilter was created. - CreationTime *float64 `lumi:"creationTime,out"` -} - -type LogSubscriptionDistribution string - -const ( - RandomDistribution LogSubscriptionDistribution = "Random" - ByLogStreamDistribution LogSubscriptionDistribution = "ByLogStream" -) diff --git a/lib/aws/idl/dynamodb/table.go b/lib/aws/idl/dynamodb/table.go deleted file mode 100644 index 0b3d61f3a..000000000 --- a/lib/aws/idl/dynamodb/table.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package dynamodb - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// The Table resource creates an AWS DynamoDB Table. For more information, see -// http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/. -type Table struct { - idl.NamedResource - HashKey string `lumi:"hashKey,replaces"` - Attributes []Attribute `lumi:"attributes"` - ReadCapacity float64 `lumi:"readCapacity"` - WriteCapacity float64 `lumi:"writeCapacity"` - RangeKey *string `lumi:"rangeKey,optional,replaces"` - TableName *string `lumi:"tableName,optional,replaces"` - GlobalSecondaryIndexes *[]GlobalSecondaryIndex `lumi:"globalSecondaryIndexes,optional"` - - // TODO[pulumi/lumi#216]: - // LocalSecondaryIndexes - // StreamSpecification -} - -// Attribute is a DynamoDB Table Attribute definition. -type Attribute struct { - // Name of the DynamoDB Table Attribute. - Name string `lumi:"name"` - // Type of the DynamoDB Table Attribute. You can specify S for string data, N for numeric data, or B for binary data. - Type AttributeType `lumi:"type"` -} - -// AttributeType represents the types of DynamoDB Table Attributes. -type AttributeType string - -const ( - StringAttribute AttributeType = "S" - NumberAttribute AttributeType = "N" - BinaryAttribute AttributeType = "B" -) - -// A GlobalSecondaryIndex represents an alternative index at DynamoDB Table -type GlobalSecondaryIndex struct { - IndexName string `lumi:"indexName"` - HashKey string `lumi:"hashKey"` - RangeKey *string `lumi:"rangeKey,optional"` - ReadCapacity float64 `lumi:"readCapacity"` - WriteCapacity float64 `lumi:"writeCapacity"` - NonKeyAttributes []string `lumi:"nonKeyAttributes"` - ProjectionType ProjectionType `lumi:"projectionType"` -} - -// ProjectionType represents the types of DynamoDB Table Attributes. -type ProjectionType string - -const ( - KeysOnlyProjection ProjectionType = "KEYS_ONLY" - IncludeProjection ProjectionType = "INCLUDE" - AllProjection ProjectionType = "ALL" -) diff --git a/lib/aws/idl/ec2/instance.go b/lib/aws/idl/ec2/instance.go deleted file mode 100644 index d2a4d864c..000000000 --- a/lib/aws/idl/ec2/instance.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Instance ia an EC2 VM instance. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html. -type Instance struct { - idl.NamedResource - // Provides the unique ID of the Amazon Machine Image (AMI) that was assigned during registration. - ImageID string `lumi:"imageId,replaces"` - // The instance type, such as t2.micro. The default type is "m3.medium". - InstanceType *InstanceType `lumi:"instanceType,optional,replaces"` - // A list that contains the Amazon EC2 security groups to assign to the Amazon EC2 instance. - SecurityGroups *[]*SecurityGroup `lumi:"securityGroups,optional,replaces"` - // Provides the name of the Amazon EC2 key pair. - KeyName *string `lumi:"keyName,optional,replaces"` - // Provides a list of tags to attach to the instance. - Tags *[]Tag `lumi:"tags,optional"` - - // Output properties: - - // The Availability Zone where the specified instance is launched. For example: `us-east-1b`. - AvailabilityZone string `lumi:"availabilityZone,out"` - // The private DNS name of the specified instance. For example: `ip-10-24-34-0.ec2.internal`. - PrivateDNSName *string `lumi:"privateDNSName,out,optional"` - // The public DNS name of the specified instance. For example: `ec2-107-20-50-45.compute-1.amazonaws.com`. - PublicDNSName *string `lumi:"publicDNSName,out,optional"` - // The private IP address of the specified instance. For example: `10.24.34.0`. - PrivateIP *string `lumi:"privateIP,out,optional"` - // The public IP address of the specified instance. For example: `192.0.2.0`. - PublicIP *string `lumi:"publicIP,out,optional"` -} - -// A Tag applied to an EC2 instance. -type Tag struct { - Key string `lumi:"key"` - Value string `lumi:"value"` -} - -// InstanceType is an enum type with all the names of instance types available in EC2. -type InstanceType string - -const ( - // GENERAL PURPOSE: - - // T2: Instances are Burstable Performance Instances that provide a baseline level of CPU performance with the - // ability to burst above the baseline. The baseline performance and ability to burst are governed by CPU Credits. - // Each T2 instance receives CPU Credits continuously at a set rate depending on the instance size. T2 instances - // accrue CPU Credits when they are idle, and use CPU credits when they are active. T2 instances are a good choice - // for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web - // servers, developer environments and databases). For more information see Burstable Performance Instances. - T2InstanceNano InstanceType = "t2.nano" - T2InstanceMicro InstanceType = "t2.micro" - T2InstanceSmall InstanceType = "t2.small" - T2InstanceMedium InstanceType = "t2.medium" - T2InstanceLarge InstanceType = "t2.large" - T2InstanceXLarge InstanceType = "t2.xlarge" - T2Instance2XLarge InstanceType = "t2.2xlarge" - - // M4: Instances are the latest generation of General Purpose Instances. This family provides a balance of compute, - // memory, and network resources, and it is a good choice for many applications. - M4InstanceLarge InstanceType = "m4.large" - M4InstanceXLarge InstanceType = "m4.xlarge" - M4Instance2XLarge InstanceType = "m4.2xlarge" - M4Instance4XLarge InstanceType = "m4.4xlarge" - M4Instance10XLarge InstanceType = "m4.10xlarge" - M4Instance16XLarge InstanceType = "m4.16xlarge" - - // M3: This family includes the M3 instance types and provides a balance of compute, memory, and network resources, - // and it is a good choice for many applications. - M3InstanceMedium InstanceType = "m3.medium" - M3InstanceLarge InstanceType = "m3.large" - M3InstanceXLarge InstanceType = "m3.xlarge" - M3Instance2XLarge InstanceType = "m3.2xlarge" - - // COMPUTE OPTIMIZED: - - // C4: Instances are the latest generation of Compute-optimized instances, featuring the highest performing - // processors and the lowest price/compute performance in EC2. - C4InstanceLarge InstanceType = "c4.large" - C4InstanceXLarge InstanceType = "c4.xlarge" - C4Instance2XLarge InstanceType = "c4.2xlarge" - C4Instance4XLarge InstanceType = "c4.4xlarge" - C4Instance8XLarge InstanceType = "c4.8xlarge" - - // C3: Instances are the previous generation of Compute-optimized instances. - C3InstanceLarge InstanceType = "c3.large" - C3InstanceXLarge InstanceType = "c3.xlarge" - C3Instance2XLarge InstanceType = "c3.2xlarge" - C3Instance4XLarge InstanceType = "c3.4xlarge" - C3Instance8XLarge InstanceType = "c3.8xlarge" - - // MEMORY OPTIMIZED: - - // X1: Instances are optimized for large-scale, enterprise-class, in-memory applications and have the lowest price - // per GiB of RAM among Amazon EC2 instance types. - X1Instance32XLarge InstanceType = "x1.32xlarge" - X1Instance16XLarge InstanceType = "x1.16xlarge" - - // R4: Instance InstanceType =s are optimized for memory-intensive applications and offer better price per GiB of RAM than R3. - R4InstanceLarge InstanceType = "r4.large" - R4InstanceXLarge InstanceType = "r4.xlarge" - R4Instance2XLarge InstanceType = "r4.2xlarge" - R4Instance4XLarge InstanceType = "r4.4xlarge" - R4Instance8XLarge InstanceType = "r4.8xlarge" - R4Instance16XLarge InstanceType = "r4.16xlarge" - - // R3: Instance InstanceType =s are optimized for memory-intensive applications and offer lower price per GiB of RAM. - R3InstanceLarge InstanceType = "r3.large" - R3InstanceXLarge InstanceType = "r3.xlarge" - R3Instance2XLarge InstanceType = "r3.2xlarge" - R3Instance4XLarge InstanceType = "r3.4xlarge" - R3Instance8XLarge InstanceType = "r3.8xlarge" - - // ACCELERATED COMPUTING INSTANCES: - - // P2: Instance InstanceType =s are intended for general-purpose GPU compute applications. - P2InstanceXLarge InstanceType = "p2.xlarge" - P2Instance8XLarge InstanceType = "p2.8xlarge" - P2Instance16XLarge InstanceType = "p2.16xlarge" - - // G2: Instances are optimized for graphics-intensive applications. - G2Instance2XLarge InstanceType = "g2.2xlarge" - G2Instance8XLarge InstanceType = "g2.8xlarge" - - // F1: Instances offer customizable hardware acceleration with field programmable gate arrays (FPGAs). - F1Instance2XLarge InstanceType = "f1.2xlarge" - F1Instance16XLarge InstanceType = "f1.16xlarge" - - // STORAGE OPTIMIZED: - - // I3: This family includes the High Storage Instances that provide Non-Volatile Memory Express (NVMe) SSD backed - // instance storage optimized for low latency, very high random I/O performance, high sequential read throughput and - // provide high IOPS at a low cost. - I3InstanceLarge InstanceType = "i3.large" - I3InstanceXLarge InstanceType = "i3.xlarge" - I3Instance2XLarge InstanceType = "i3.2xlarge" - I3Instance4XLarge InstanceType = "i3.4xlarge" - I3Instance8XLarge InstanceType = "i3.8xlarge" - I3Instance16XLarge InstanceType = "i3.16xlarge" - - // D2: Instances feature up to 48 TB of HDD-based local storage, deliver high disk throughput, and offer the lowest - // price per disk throughput performance on Amazon EC2. - D2InstanceXLarge InstanceType = "d2.xlarge" - D2Instance2XLarge InstanceType = "d2.2xlarge" - D2Instance4XLarge InstanceType = "d2.4xlarge" - D2Instance8XLarge InstanceType = "d2.8xlarge" -) diff --git a/lib/aws/idl/ec2/internetGateway.go b/lib/aws/idl/ec2/internetGateway.go deleted file mode 100644 index 3fc18daf1..000000000 --- a/lib/aws/idl/ec2/internetGateway.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// An Internet gateway enables your instances to connect to the Internet through the Amazon EC2 edge network. See -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internet-gateway.html. -type InternetGateway struct { - idl.NamedResource -} diff --git a/lib/aws/idl/ec2/route.go b/lib/aws/idl/ec2/route.go deleted file mode 100644 index a719dd798..000000000 --- a/lib/aws/idl/ec2/route.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Route in a route table within a VPC. For more information, see -// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html. -type Route struct { - idl.NamedResource - // The CIDR address block used for the destination match. For example, `0.0.0.0/0`. Routing decisions are based - // on the most specific match. - DestinationCidrBlock string `lumi:"destinationCidrBlock,replaces"` - // The route table where the route will be added. - RouteTable *RouteTable `lumi:"routeTable,replaces"` - // The Internet gateway that is attached to your VPC. For route entries that specify a gateway, you must also - // specify a dependency on the gateway attachment resource (`vpcGatewayAttachment`). - InternetGateway *InternetGateway `lumi:"internetGateway,replaces"` - // The gateway attachment resource that attached the specified gateway to the VPC. - VPCGatewayAttachment *VPCGatewayAttachment `lumi:"vpcGatewayAttachment,replaces"` -} diff --git a/lib/aws/idl/ec2/routeTable.go b/lib/aws/idl/ec2/routeTable.go deleted file mode 100644 index 1610b9b55..000000000 --- a/lib/aws/idl/ec2/routeTable.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// RouteTable is a route table within your VPC. After creating a route table, you can add routes and associate the -// table with a subnet. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html. -type RouteTable struct { - idl.NamedResource - // The VPC where the route table will be created. - VPC *VPC `lumi:"vpc,replaces"` -} diff --git a/lib/aws/idl/ec2/securityGroup.go b/lib/aws/idl/ec2/securityGroup.go deleted file mode 100644 index 28c948a84..000000000 --- a/lib/aws/idl/ec2/securityGroup.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// A SecurityGroup is an Amazon EC2 Security Group. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html. -type SecurityGroup struct { - idl.NamedResource - // A required description about the security group. - GroupDescription string `lumi:"groupDescription,replaces"` - // An optional name for the security group. If you don't specify one, a unique physical ID will be generated and - // used instead. 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. - GroupName *string `lumi:"groupName,optional,replaces"` - // The VPC in which this security group resides (or blank if the default VPC). - VPC *VPC `lumi:"vpc,optional,replaces"` - // A list of Amazon EC2 security group egress rules. - SecurityGroupEgress *[]SecurityGroupRule `lumi:"securityGroupEgress,optional"` - // A list of Amazon EC2 security group ingress rules. - SecurityGroupIngress *[]SecurityGroupRule `lumi:"securityGroupIngress,optional"` - // The group ID of the specified security group, such as `sg-94b3a1f6`. - GroupID string `lumi:"groupID,out"` -} - -// A SecurityGroupRule describes an EC2 security group rule embedded within a SecurityGroup. -type SecurityGroupRule struct { - // The IP name or number. - IPProtocol string `lumi:"ipProtocol"` - // Specifies a CIDR range. - CIDRIP *string `lumi:"cidrIp,optional"` - // The start of port range for the TCP and UDP protocols, or an ICMP type number. An ICMP type number of `-1` - // indicates a wildcard (i.e., any ICMP type number). - FromPort *float64 `lumi:"fromPort,optional"` - // The end of port range for the TCP and UDP protocols, or an ICMP code. An ICMP code of `-1` indicates a - // wildcard (i.e., any ICMP code). - ToPort *float64 `lumi:"toPort,optional"` -} diff --git a/lib/aws/idl/ec2/securityGroupEgress.go b/lib/aws/idl/ec2/securityGroupEgress.go deleted file mode 100644 index 91de16527..000000000 --- a/lib/aws/idl/ec2/securityGroupEgress.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// SecurityGroupEgress adds an egress (outbound) rule to an Amazon VPC security group. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html. -type SecurityGroupEgress struct { - idl.NamedResource - // Start of port range for the TCP and UDP protocols, or an ICMP type number. If you specify `icmp` for the - // `ipProtocol` property, you can specify `-1` as a wildcard (i.e., any ICMP type number). - FromPort float64 `lumi:"fromPort,replaces"` - // The Amazon VPC security group to modify. - Group *SecurityGroup `lumi:"group,replaces"` - // IP protocol name or number. - IPProtocol string `lumi:"ipProtocol,replaces"` - // End of port range for the TCP and UDP protocols, or an ICMP code. If you specify `icmp` for the `ipProtocol` - // property, you can specify `-1` as a wildcard (i.e., any ICMP code). - ToPort float64 `lumi:"toPort,replaces"` - // An IPv4 CIDR range. - CIDRIP *string `lumi:"cidrIp,replaces,optional"` - // An IPv6 CIDR range. - CIDRIPv6 *string `lumi:"cidrIpv6,replaces,optional"` - // The AWS service prefix of an Amazon VPC endpoint. - DestinationPrefixListId *string `lumi:"destinationPrefixListId,replaces,optional"` - // Specifies the group ID of the destination Amazon VPC security group. - DestinationSecurityGroup *SecurityGroup `lumi:"destinationSecurityGroup,replaces,optional"` -} diff --git a/lib/aws/idl/ec2/securityGroupIngress.go b/lib/aws/idl/ec2/securityGroupIngress.go deleted file mode 100644 index b0560e3e3..000000000 --- a/lib/aws/idl/ec2/securityGroupIngress.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// SecurityGroupIngress dds an ingress (inbound) rule to an Amazon VPC security group. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-ingress.html. -type SecurityGroupIngress struct { - idl.NamedResource - // IP protocol name or number. - IPProtocol string `lumi:"ipProtocol,replaces"` - // An IPv4 CIDR range. - CIDRIP *string `lumi:"cidrIp,replaces,optional"` - // An IPv6 CIDR range. - CIDRIPv6 *string `lumi:"cidrIpv6,replaces,optional"` - // Start of port range for the TCP and UDP protocols, or an ICMP type number. If you specify `icmp` for the - // `ipProtocol` property, you can specify `-1` as a wildcard (i.e., any ICMP type number). - FromPort *float64 `lumi:"fromPort,replaces,optional"` - // The Amazon VPC security group to modify. - Group *SecurityGroup `lumi:"group,replaces,optional"` - // Name of the Amazon EC2 security group (non-VPC security group) to modify. - GroupName *string `lumi:"groupName,replaces,optional"` - // Specifies the ID of the source security group or uses the Ref intrinsic function to refer to the logical ID of a - // security group defined in the same template. - SourceSecurityGroup *SecurityGroup `lumi:"sourceSecurityGroup,replaces,optional"` - // Specifies the name of the Amazon EC2 security group (non-VPC security group) to allow access or uses the Ref - // intrinsic function to refer to the logical name of a security group defined in the same template. For instances - // in a VPC, specify the SourceSecurityGroupId property. - SourceSecurityGroupName *string `lumi:"sourceSecurityGroupName,replaces,optional"` - // Specifies the AWS Account ID of the owner of the Amazon EC2 security group specified in the - // SourceSecurityGroupName property. - SourceSecurityGroupOwnerId *string `lumi:"sourceSecurityGroupOwnerId,replaces,optional"` - // End of port range for the TCP and UDP protocols, or an ICMP code. If you specify `icmp` for the `ipProtocol` - // property, you can specify `-1` as a wildcard (i.e., any ICMP code). - ToPort *float64 `lumi:"toPort,replaces,optional"` -} diff --git a/lib/aws/idl/ec2/subnet.go b/lib/aws/idl/ec2/subnet.go deleted file mode 100644 index fe02d3dff..000000000 --- a/lib/aws/idl/ec2/subnet.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Subnet is a subnet in an existing VPC. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html. -type Subnet struct { - idl.NamedResource - // The CIDR block that you want the subnet to cover (for example, `"10.0.0.0/24"`). - CIDRBlock string `lumi:"cidrBlock,replaces"` - // The VPC on which you want to create the subnet. - VPC *VPC `lumi:"vpc,replaces"` - // The availability zone in which you want the subnet. By default, AWS selects a zone for you. - AvailabilityZone *string `lumi:"availabilityZone,replaces,optional"` - // Indicates whether instances that are launched in this subnet receive a public IP address. By default, `false`. - MapPublicIpOnLaunch *bool `lumi:"mapPublicIpOnLaunch,optional"` -} diff --git a/lib/aws/idl/ec2/vpc.go b/lib/aws/idl/ec2/vpc.go deleted file mode 100644 index 95e73a397..000000000 --- a/lib/aws/idl/ec2/vpc.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// VPC is a Virtual Private Cloud with a specified CIDR block. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html. -type VPC struct { - idl.NamedResource - // The CIDR block you want the VPC to cover. For example, "10.0.0.0/16". - CIDRBlock string `lumi:"cidrBlock,replaces"` - // The allowed tenancy of instances launched into the VPC. "default" indicates that instances can be launched with - // any tenancy, while "dedicated" indicates that any instance launched into the VPC automatically has dedicated - // tenancy, unless you launch it with the default tenancy. - InstanceTenancy *InstanceTenancy `lumi:"instanceTenancy,optional,replaces"` - // Specifies whether DNS resolution is supported for the VPC. If true, the Amazon DNS server resolves DNS hostnames - // for your instances to their corresponding IP addresses; otherwise, it does not. By default, the value is true. - EnableDNSSupport *bool `lumi:"enableDnsSupport,optional"` - // Specifies whether the instances launched in the VPC get DNS hostnames. If this attribute is true, instances in - // the VPC get DNS hostnames; otherwise, they do not. You can only set enableDnsHostnames to true if you also set - // the enableDnsSupport property to true. By default, the value is set to false. - EnableDNSHostnames *bool `lumi:"enableDnsHostnames,optional"` -} - -type InstanceTenancy string - -const ( - // Your instance runs on shared hardware. - DefaultTenancy InstanceTenancy = "default" - // Your instance runs on single-tenant hardware. - DedicatedTenancy InstanceTenancy = "dedicated" - // Your instance runs on a Dedicated Host, which is an isolated server with configurations that you can control. - HostTenancy InstanceTenancy = "host" -) diff --git a/lib/aws/idl/ec2/vpcGatewayAttachment.go b/lib/aws/idl/ec2/vpcGatewayAttachment.go deleted file mode 100644 index 45da2f703..000000000 --- a/lib/aws/idl/ec2/vpcGatewayAttachment.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// VPCGatewayAttachment attaches a gateway to a VPC. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html. -type VPCGatewayAttachment struct { - idl.NamedResource - // The VPC to associate with this gateway. - VPC *VPC `lumi:"vpc,replaces"` - // The Internet gateway to attach to the VPC. - InternetGateway *InternetGateway `lumi:"internetGateway,replaces"` -} diff --git a/lib/aws/idl/ec2/vpcPeeringConnection.go b/lib/aws/idl/ec2/vpcPeeringConnection.go deleted file mode 100644 index 2f5ff6951..000000000 --- a/lib/aws/idl/ec2/vpcPeeringConnection.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// VPCPeeringConnection enables a network connection between two virtual private clouds (VPCs) so that you can route -// traffic between them by means of a private IP addresses. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html. -type VPCPeeringConnection struct { - idl.NamedResource - // The VPC with which you are creating the peering connection. - PeerVPC *VPC `lumi:"peerVpc,replaces"` - // The VPC that is requesting a peering connection. - VPC *VPC `lumi:"vpc,replaces"` -} diff --git a/lib/aws/idl/elasticbeanstalk/application.go b/lib/aws/idl/elasticbeanstalk/application.go deleted file mode 100644 index f8b2a39ce..000000000 --- a/lib/aws/idl/elasticbeanstalk/application.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package elasticbeanstalk - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Application is an Elastic Beanstalk application. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html. -type Application struct { - idl.NamedResource - // ApplicationName is a name for the application. If you don't specify a name, a unique physical ID is used instead. - ApplicationName *string `lumi:"applicationName,optional,replaces"` - // An optional description of this application. - Description *string `lumi:"description,optional"` -} diff --git a/lib/aws/idl/elasticbeanstalk/applicationVersion.go b/lib/aws/idl/elasticbeanstalk/applicationVersion.go deleted file mode 100644 index 792fa7b04..000000000 --- a/lib/aws/idl/elasticbeanstalk/applicationVersion.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package elasticbeanstalk - -import ( - "github.com/pulumi/lumi/lib/aws/idl/s3" - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// ApplicationVersion is an application version, an iteration of deployable code, for an Elastic Beanstalk application. -// For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html. -type ApplicationVersion struct { - idl.NamedResource - // Name of the Elastic Beanstalk application that is associated with this application version. - Application *Application `lumi:"application,replaces"` - // An optional version label name. If you don't specify one, a unique physical ID will be generated and - // used instead. 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. - VersionLabel *string `lumi:"versionLabel,optional,replaces"` - // A description of this application version. - Description *string `lumi:"description,optional"` - // The source bundle for this application version. This supports all the usual Lumi asset schemes, in addition - // to Amazon Simple Storage Service (S3) bucket locations, indicating with a URI scheme of s3///. - SourceBundle *s3.Object `lumi:"sourceBundle,replaces"` -} diff --git a/lib/aws/idl/elasticbeanstalk/environment.go b/lib/aws/idl/elasticbeanstalk/environment.go deleted file mode 100644 index 6e5663775..000000000 --- a/lib/aws/idl/elasticbeanstalk/environment.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package elasticbeanstalk - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// ApplicationVersion is an application version, an iteration of deployable code, for an Elastic Beanstalk application. -// For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html. -type Environment struct { - idl.NamedResource - // The name of the application that is associated with this environment. - Application *Application `lumi:"application,replaces"` - // A prefix for your Elastic Beanstalk environment URL. - CNAMEPrefix *string `lumi:"cnamePrefix,optional,replaces"` - // A description that helps you identify this environment. - Description *string `lumi:"description,optional"` - // A name for the Elastic Beanstalk environment. - EnvironmentName *string `lumi:"environmentName,optional,replaces"` - // Key-value pairs defining configuration options for this environment, such as the instance type. These options - // override the values that are defined in the solution stack or the configuration template. If you remove any - // options during a stack update, the removed options revert to default values. - OptionSettings *[]OptionSetting `lumi:"optionSettings,optional"` - // The name of an Elastic Beanstalk solution stack that this configuration will use. For more information, see - // http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html. You must specify either this - // parameter or an Elastic Beanstalk configuration template name. - SolutionStackName *string `lumi:"solutionStackName,optional,replaces"` - // An arbitrary set of tags (key–value pairs) for this environment. - Tags *[]Tag `lumi:"tags,optional,replaces"` - // The name of the Elastic Beanstalk configuration template to use with the environment. You must specify either - // this parameter or a solution stack name. - TemplateName *string `lumi:"templateName,optional"` - // Specifies the tier to use in creating this environment. The environment tier that you choose determines whether - // Elastic Beanstalk provisions resources to support a web application that handles HTTP(S) requests or a web - // application that handles background-processing tasks. - Tier *Tier `lumi:"tier,optional,replaces"` - // The version to associate with the environment. - Version *ApplicationVersion `lumi:"version,optional"` - // The URL to the load balancer for this environment. - EndpointURL string `lumi:"endpointURL,out"` - // Key-value pairs defining all of the configuration options for this environment, including both values provided - // in the OptionSettings input, as well as settings with default values. - AllOptionSettings *[]OptionSetting `lumi:"allOptionSettings,out"` -} - -// OptionSetting specifies options for an Elastic Beanstalk environment. -type OptionSetting struct { - // A unique namespace identifying the option's associated AWS resource. For a list of namespaces that you can use, - // see http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html. - Namespace string `lumi:"namespace"` - // The name of the configuration option. For a list of options that you can use, see - // http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html. - OptionName string `lumi:"optionName"` - // The value of the setting. - Value string `lumi:"value"` -} - -// A Tag helps to identify and categorize resources. -type Tag struct { - // The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be - // prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, - // _, ., /, =, +, and -. - Key string `lumi:"key"` - // The value for the tag. You can specify a value that is 1 to 255 Unicode characters in length and cannot be - // prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, - // _, ., /, =, +, and -. - Value string `lumi:"value"` -} - -// The Tier for an Elastic Beanstalk Environment. -type Tier string - -const ( - WebServerTier Tier = "WebServer::Standard::1.0" - WorkerTier Tier = "Worker::SQS/HTTP::1.0" -) diff --git a/lib/aws/idl/iam/group.go b/lib/aws/idl/iam/group.go deleted file mode 100644 index 509a04be8..000000000 --- a/lib/aws/idl/iam/group.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package iam - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Group is an AWS Identity and Access Management (IAM) group. -type Group struct { - idl.NamedResource - // groupName is a name for the IAM group. If you don't specify a name, a unique physical ID will be generated. - // - // 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 this resource, specify a new name. - // - // If you specify a new name, you must specify the `CAPABILITY_NAMED_IAM` value to acknowledge your capabilities. - // - // Warning: Naming an IAM resource can cause an unrecoverable error if you reuse the same code in multiple regions. - // To prevent this, create a name that includes the region name itself, to create a region-specific name. - GroupName *string `lumi:"groupName,replaces,optional"` - // managedPolicies is one or more managed policies to attach to this role. - ManagedPolicies *[]*Policy `lumi:"managedPolicies,optional"` - // path is the path associated with this role. For more information about paths, see - // http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html#Identifiers_FriendlyNames. - Path *string `lumi:"path,optional"` - // policies are the policies to associate with this role. - Policies *InlinePolicy `lumi:"policies,optional"` -} diff --git a/lib/aws/idl/iam/instanceprofile.go b/lib/aws/idl/iam/instanceprofile.go deleted file mode 100644 index 1ecc70b60..000000000 --- a/lib/aws/idl/iam/instanceprofile.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package iam - -import ( - aws "github.com/pulumi/lumi/lib/aws/idl" - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// InstanceProfile is an AWS Identity and Access Management (IAM) instance profile. Use an IAM instance profile to -// enable applications running on an EC2 instance to securely access your AWS resources. For more information about -// IAM instance profiles, see -// http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html. -type InstanceProfile struct { - idl.NamedResource - // Path is the path associated with this instance profile. For more information about paths, see - // http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html#Identifiers_FriendlyNames. - Path *string `lumi:"path,replaces,optional"` - // The name of the instance profile that you want to create. This parameter allows a string consisting of upper and - // lowercase alphanumeric characters with no spaces. You can also include any of the following characters: = , . @ -. - InstanceProfileName *string `lumi:"instanceProfileName,replaces,optional"` - // The name of an existing IAM role to associate with this instance profile. Currently, you can assign a maximum - // of one role to an instance profile. - Roles []*Role `lumi:"roles"` - // The Amazon Resource Name (ARN) for the instance profile. For example, - // `arn:aws:iam::1234567890:instance-profile/MyProfile-ASDNSDLKJ`. - ARN aws.ARN `lumi:"arn,out"` -} diff --git a/lib/aws/idl/iam/policy.go b/lib/aws/idl/iam/policy.go deleted file mode 100644 index e39b0fb95..000000000 --- a/lib/aws/idl/iam/policy.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package iam - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Policy associates an IAM policy with IAM users, roles, or groups. For more information about IAM -// policies, see http://docs.aws.amazon.com/IAM/latest/UserGuide/policies_overview.html. -type Policy struct { - idl.NamedResource - // PolicyDocument is a policy document that contains permissions to add to the specified users, roles, or groups. - PolicyDocument interface{} `lumi:"policyDocument"` // IDEA: schematize this. - // PolicyName is the name of the policy. If you specify multiple policies for an entity, specify unique names. For - // example, if you specify a list of policies for an IAM role, each policy must have a unique name. - PolicyName string `lumi:"policyName"` - // Groups are the groups to which you want to add this policy. - Groups *[]*Group `lumi:"groups,optional"` - // Roles are the roles to which you want to attach this policy. - Roles *[]*Role `lumi:"roles,optional"` - // Users are the users for whom you want to add this policy. - Users *[]*User `lumi:"users,optional"` -} - -// InlinePolicies are attached to Policies, Groups, and User resources, to describe what actions are allowed on them. -// For more information on policies, please see http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html. -type InlinePolicy struct { - // PolicyDocument is a policy document that describes what actions are allowed on which resources. - PolicyDocument interface{} `lumi:"policyDocument"` // IDEA: schematize this. - // PolicyName is the unique name of the policy. - PolicyName string `lumi:"policyName"` -} diff --git a/lib/aws/idl/iam/role.go b/lib/aws/idl/iam/role.go deleted file mode 100644 index fb3a40246..000000000 --- a/lib/aws/idl/iam/role.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package iam - -import ( - aws "github.com/pulumi/lumi/lib/aws/idl" - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Role is an AWS Identity and Access Management (IAM) role. Use an IAM role to enable applications running on an EC2 -// instance to securely access your AWS resources. For more information about IAM roles, see -// http://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html. -type Role struct { - idl.NamedResource - // AssumeRolePolicyDocument is the trust policy associated with this role. - AssumeRolePolicyDocument interface{} `lumi:"assumeRolePolicyDocument"` // IDEA: schematize this. - // Path is the path associated with this role. For more information about paths, see - // http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html#Identifiers_FriendlyNames. - Path *string `lumi:"path,replaces,optional"` - // RoleName is a name for the IAM role. If you don't specify a name, a unique physical ID will be generated. - // - // 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. - // - // If you specify a name, you must specify the `CAPABILITY_NAMED_IAM` value to acknowledge these capabilities. - // - // Warning: Naming an IAM resource can cause an unrecoverable error if you reuse the same code in multiple regions. - // To prevent this, create a name that includes the region name itself, to create a region-specific name. - RoleName *string `lumi:"roleName,replaces,optional"` - // managedPolicies is one or more managed policies to attach to this role. - ManagedPolicyARNs *[]aws.ARN `lumi:"managedPolicyARNs,optional"` - // Policies are the policies to associate with this role. - Policies *[]InlinePolicy `lumi:"policies,optional"` - // The Amazon Resource Name (ARN) for the instance profile. For example, - // `arn:aws:iam::1234567890:role/MyRole-AJJHDSKSDF`. - ARN aws.ARN `lumi:"arn,out"` -} diff --git a/lib/aws/idl/iam/user.go b/lib/aws/idl/iam/user.go deleted file mode 100644 index 7d4750d9e..000000000 --- a/lib/aws/idl/iam/user.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package iam - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// The User resource creates an AWS Identity and Access Management (IAM) user. -type User struct { - idl.NamedResource - // UserName is a name for the IAM group. If you don't specify a name, a unique physical ID will be generated. - // - // 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 this resource, specify a new name. - // - // If you specify a new name, you must specify the `CAPABILITY_NAMED_IAM` value to acknowledge your capabilities. - // - // Warning: Naming an IAM resource can cause an unrecoverable error if you reuse the same code in multiple regions. - // To prevent this, create a name that includes the region name itself, to create a region-specific name. - UserName *string `lumi:"userName,replaces,optional"` - // Groups is a list of groups to which you want to add the user. - Groups *[]*Group `lumi:"groups,optional"` - // LoginProfile creates a login profile so that the user can access the AWS Management Console. - LoginProfile *LoginProfile `lumi:"loginProfile,optional"` - // ManagedPolicies is one or more managed policies to attach to this role. - ManagedPolicies *[]*Policy `lumi:"managedPolicies,optional"` - // Path is the path associated with this role. For more information about paths, see - // http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html#Identifiers_FriendlyNames. - Path *string `lumi:"path,optional"` - // Policies are the policies to associate with this role. - Policies *[]InlinePolicy `lumi:"policies,optional"` -} - -type LoginProfile struct { - // Password is the password for the user. - Password string `lumi:"password"` - // PasswordResetRequired specifies whether the user is required to set a new password the next time the user logs - // into the AWS Management Console. - PasswordResetRequired *bool `lumi:"passwordResetRequired,optional"` -} diff --git a/lib/aws/idl/kms/key.go b/lib/aws/idl/kms/key.go deleted file mode 100644 index 90199444c..000000000 --- a/lib/aws/idl/kms/key.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package kms - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// The Key resource creates a customer master key (CMK) in AWS Key Management Service (AWS KMS). Users (customers) can -// use the master key to encrypt their data stored in AWS services that are integrated with AWS KMS or within their -// applications. For more information, see http://docs.aws.amazon.com/kms/latest/developerguide/. -type Key struct { - idl.NamedResource - // KeyPolicy attaches a KMS policy to this key. Use a policy to specify who has permission to use the key and which - // actions they can perform. For more information, see - // http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html. - KeyPolicy interface{} `lumi:"keyPolicy"` // IDEA: schematize this. - // Description is an optional description of the key. Use a description that helps your users decide whether the - // key is appropriate for a particular task. - Description *string `lumi:"description,optional"` - // Enabled indicates whether the key is available for use. This value is `true` by default. - Enabled *bool `lumi:"enabled,optional"` - // EnableKeyRotation indicates whether AWS KMS rotates the key. This value is `false` by default. - EnableKeyRotation *bool `lumi:"enableKeyRotation,optional"` -} diff --git a/lib/aws/idl/lambda/function.go b/lib/aws/idl/lambda/function.go deleted file mode 100644 index 124bbb031..000000000 --- a/lib/aws/idl/lambda/function.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package lambda - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" - - aws "github.com/pulumi/lumi/lib/aws/idl" - "github.com/pulumi/lumi/lib/aws/idl/ec2" - "github.com/pulumi/lumi/lib/aws/idl/iam" - "github.com/pulumi/lumi/lib/aws/idl/kms" -) - -// The Function resource creates an AWS Lambda function that can run code in response to events. -type Function struct { - idl.NamedResource - - // code is the source code of your Lambda function. This supports all the usual Lumi asset schemes, in addition - // to Amazon Simple Storage Service (S3) bucket locations, indicating with a URI scheme of s3///. - Code *idl.Archive `lumi:"code"` - // handler is the name of the function (within your source code) that Lambda calls to start running your code. - Handler string `lumi:"handler"` - // role is the AWS Identity and Access Management (IAM) execution role that Lambda assumes when it runs your code - // to access AWS services. - Role *iam.Role `lumi:"role"` - // runtime is the runtime environment for the Lambda function that you are uploading. - Runtime Runtime `lumi:"runtime"` - // functionName is a name for the function. If you don't specify a name, a unique physical ID is used instead. - FunctionName *string `lumi:"functionName,optional"` - // deadLetterConfig configures how Lambda handles events that it can't process. If you don't specify a Dead Letter - // Queue (DLQ) configuration, Lambda discards events after the maximum number of retries. - DeadLetterConfig *DeadLetterConfig `lumi:"deadLetterConfig,optional"` - // description is an optional description of the function. - Description *string `lumi:"description,optional"` - // environment contains key-value pairs that Lambda caches and makes available for your Lambda functions. Use - // environment variables to apply configuration changes, such as test and production environment configurations, - // without changing your Lambda function source code. - Environment *Environment `lumi:"environment,optional"` - // kmsKey is a AWS Key Management Service (AMS KMS) key that Lambda uses to encrypt and decrypt environment - // variables. - KMSKey *kms.Key `lumi:"kmsKey,optional"` - // memorySize is the amount of memory, in MB, that is allocated to your Lambda function. Lambda uses this value to - // proportionally allocate the amount of CPU power. Your function use case determines your CPU and memory - // requirements. For example, a database operation might need less memory than an image processing function. You - // must specify a value that is greater than or equal to `128` and it must be a multiple of `64`. You cannot - // specify a size larger than `1536`. The default value is `128` MB. - MemorySize *float64 `lumi:"memorySize,optional"` - // timeout is the function execution time (in seconds) after which Lambda terminates the function. Because the - // execution time affects cost, set this value based on the function's expected execution time. By default, timeout - // is set to `3` seconds. - Timeout *float64 `lumi:"timeout,optional"` - // vpcConfig specifies a VPC configuration that Lambda uses to set up an elastic network interface (ENI). The ENI - // enables your function to connect to other resources in your VPC, but it doesn't provide public Internet access. - // If your function requires Internet access (for example, to access AWS services that don't have VPC endpoints), - // configure a Network Address Translation (NAT) instance inside your VPC or use an Amazon Virtual Private Cloud - // (Amazon VPC) NAT gateway. - VPCConfig *VPCConfig `lumi:"vpcConfig,optional"` - - // The ARN of the Lambda function, such as `arn:aws:lambda:us-west-2:123456789012:MyStack-AMILookUp-NT5EUXTNTXXD`. - ARN aws.ARN `lumi:"arn,out"` - // version is the latest published version of the Lambda function. - Version string `lumi:"version,out"` - // codeSHA256 is the base64-encoded SHA-256 hash of the source code zip file for the Lambda function. - CodeSHA256 string `lumi:"codeSHA256,out"` - // lastModified is the date the Lambda function was last modified. - LastModified string `lumi:"lastModified,out"` -} - -// Runtime represents the legal runtime environments for Lambdas. -type Runtime string - -const ( - NodeJSRuntime Runtime = "nodejs" - NodeJS4d3Runtime Runtime = "nodejs4.3" - NodeJS4d3EdgeRuntime Runtime = "nodejs4.3-edge" - NodeJS6d10Runtime Runtime = "nodejs6.10" - Java8Runtime Runtime = "java8" - Python2d7Runtime Runtime = "python2.7" - DotnetCore1d0Runtime Runtime = "dotnetcore1.0" -) - -// DeadLetterConfig is a property of an AWS Lambda Function resource that specifies a Dead Letter Queue (DLQ) that -// events are sent to when functions cannot be processed. For example, you can send unprocessed events to an Amazon -// Simple Notification Service (Amazon SQS) topic, where you can take further action. -type DeadLetterConfig struct { - // The Target resource where Lambda delivers unprocessed events. It may be an Amazon SNS topic or Amazon - // Simple Queue Service (SQS) queue. For the Lambda function-execution role, you must explicitly provide the - // relevant permissions so that access to your DLQ resource is part of the execution role for your Lambda function. - Target *idl.Resource `lumi:"target"` // IDEA: use union types to represent `sns.Topic | sqs.Queue`; -} - -// Environment is a property of an AWS Lambda Function resource that specifies key-value pairs that the function can -// access so that you can apply configuration changes, such as test and production environment configurations, without -// changing the function code. -type Environment map[string]string - -// VPCConfig is a property of an AWS Lambda Function resource that enables it to access resources in a VPC. For more -// information, see http://docs.aws.amazon.com/lambda/latest/dg/vpc.html. -type VPCConfig struct { - // securityGroups is a list of one or more security groups in the VPC that include the resources to which your - // Lambda function requires access. - SecurityGroups []*ec2.SecurityGroup `lumi:"securityGroups"` - // subnets is a list of one or more subnet IDs in the VPC that includes the resources to which your Lambda function - // requires access. - Subnets []*ec2.Subnet `lumi:"subnets"` -} diff --git a/lib/aws/idl/lambda/permission.go b/lib/aws/idl/lambda/permission.go deleted file mode 100644 index 41cc0e039..000000000 --- a/lib/aws/idl/lambda/permission.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package lambda - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" - - aws "github.com/pulumi/lumi/lib/aws/idl" -) - -// The Permission resource associates a policy statement with a specific AWS Lambda function's access policy. The -// function policy grants a specific AWS service or application permission to invoke the function. For more -// information, see http://docs.aws.amazon.com/lambda/latest/dg/API_AddPermission.html. -type Permission struct { - idl.NamedResource - // The Lambda actions that you want to allow in this statement. For example, you can specify lambda:CreateFunction - // to specify a certain action, or use a wildcard (lambda:*) to grant permission to all Lambda actions. For a list - // of actions, see http://docs.aws.amazon.com/IAM/latest/UserGuide/list_lambda.html. - Action string `lumi:"action,replaces"` - // The Lambda function that you want to associate with this statement. - Function *Function `lumi:"function,replaces"` - // The entity for which you are granting permission to invoke the Lambda function. This entity can be any valid AWS - // service principal, such as `s3.amazonaws.com` or `sns.amazonaws.com`, or, if you are granting cross-account - // permission, an AWS account ID. For example, you might want to allow a custom application in another AWS account - // to push events to Lambda by invoking your function. - Principal string `lumi:"principal,replaces"` - // The AWS account ID (without hyphens) of the source owner. For example, if you specify an S3 bucket in the - // sourceARN property, this value is the bucket owner's account ID. You can use this property to ensure that all - // source principals are owned by a specific account. - SourceAccount *string `lumi:"sourceAccount,replaces,optional"` - // The ARN of a resource that is invoking your function. When granting Amazon Simple Storage Service (Amazon S3) - // permission to invoke your function, specify this property with the bucket ARN as its value. This ensures that - // events generated only from the specified bucket, not just any bucket from any AWS account that creates a mapping - // to your function, can invoke the function. - SourceARN *aws.ARN `lumi:"sourceARN,replaces,optional"` -} diff --git a/lib/aws/idl/s3/acl.go b/lib/aws/idl/s3/acl.go deleted file mode 100644 index 01d69447e..000000000 --- a/lib/aws/idl/s3/acl.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package s3 - -// CannedACL is a predefined Amazon S3 grant. Each canned ACL value has a predefined set of grantees and permissions. -type CannedACL string - -const ( - // Owner gets `FULL_CONTROL`. Noone else has access rights (default). - PrivateACL CannedACL = "private" - // Owner gets `FULL_CONTROL`. The `AllUsers` group gets `READ` access. - PublicReadACL CannedACL = "public-read" - // Owner gets `FULL_CONTROL`. The `AllUsers` group gets `READ` and `WRITE` access. - PublicReadWriteACL CannedACL = "public-read-write" - // Owner gets `FULL_CONTROL`. Amazon EC2 gets `READ` access to `GET` an AMI bundle. - AWSExecReadACL CannedACL = "aws-exec-read" - // Owner gets `FULL_CONTROL`. The `AuthenticatedUsers` group gets `READ` access. - AuthenticatedReadACL CannedACL = "authenticated-read" - // Object owner gets `FULL_CONTROL`. Bucket owner gets `READ` access. - BucketOwnerReadACL CannedACL = "bucket-owner-read" - // Both object and bucket owner get `FULL_CONTROL` over the object. - BucketOwnerFullControlACL CannedACL = "bucket-owner-full-control" - // The `LogDelivery` group gets `WRITE` and `READ_ACP` permissions on this bucket. - LogDeliveryWriteACL CannedACL = "log-delivery-write" -) diff --git a/lib/aws/idl/s3/bucket.go b/lib/aws/idl/s3/bucket.go deleted file mode 100644 index e4e790cbe..000000000 --- a/lib/aws/idl/s3/bucket.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package s3 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Bucket represents an Amazon Simple Storage Service (Amazon S3) bucket. -// TODO[pulumi/lumi#218]: support all the various configuration settings (CORS, lifecycle, logging, and so on). -type Bucket struct { - idl.NamedResource - // BucketName is a name for the bucket. If you don't specify a name, a unique physical ID is generated. The name - // must contain only lowercase letters, numbers, periods (`.`), and dashes (`-`). - BucketName *string `lumi:"bucketName,replaces,optional"` - // accessControl is a canned access control list (ACL) that grants predefined permissions to the bucket. - AccessControl *CannedACL `lumi:"accessControl,optional"` -} diff --git a/lib/aws/idl/s3/object.go b/lib/aws/idl/s3/object.go deleted file mode 100644 index 11e901027..000000000 --- a/lib/aws/idl/s3/object.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package s3 - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// Object represents an Amazon Simple Storage Service (S3) object (key/value blob). -type Object struct { - idl.Resource - // The Key that uniquely identifies this object. - Key string `lumi:"key,replaces"` - // The Bucket this object belongs to. - Bucket *Bucket `lumi:"bucket,replaces"` - // The Source of content for this object. - Source *idl.Asset `lumi:"source,in"` - // A standard MIME type describing the format of the object data. - ContentType *string `lumi:"contentType,optional"` - // Specifies presentational information for the object. - ContentDisposition *string `lumi:"contentDisposition,optional"` - // Specifies caching behavior along the request/reply chain. - CacheControl *string `lumi:"cacheControl,optional"` - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `lumi:"contentEncoding,optional"` - // The language the content is in. - ContentLanguage *string `lumi:"contentLanguage,optional"` - // Size of the body in bytes. This parameter is useful when the size of the - // body cannot be determined automatically. - ContentLength *float64 `lumi:"contentLength,optional"` -} diff --git a/lib/aws/idl/sns/subscription.go b/lib/aws/idl/sns/subscription.go deleted file mode 100644 index 80e87c211..000000000 --- a/lib/aws/idl/sns/subscription.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package sns - -import ( - "github.com/pulumi/lumi/pkg/resource/idl" -) - -// An Amazon Simple Notification Service (Amazon SNS) topic subscription. For more information, see -// http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html. -type Subscription struct { - idl.NamedResource - // A name for the topic. If you don't specify a name, a unique physical ID will be generated. - Topic *Topic `lumi:"topic,replaces"` - // The subscription's protocol. - Protocol Protocol `lumi:"protocol,replaces"` - // The subscription's endpoint (format depends on the protocol). - Endpoint string `lumi:"endpoint,replaces"` -} - -// The protocols supported by the Amazon Simple Notification Service (Amazon SNS). -type Protocol string - -const ( - HTTSubscription Protocol = "http" // delivery of JSON-encoded message via HTTP POST. - HTTPSSubscription Protocol = "https" // delivery of JSON-encoded message via HTTPS POST. - EmailSubscription Protocol = "email" // delivery of message via SMTP. - EmailJSONSubscription Protocol = "email-json" // delivery of JSON-encoded message via SMTP. - SMSSubscription Protocol = "sms" // delivery of message via SMS. - SQSSubscription Protocol = "sqs" // delivery of JSON-encoded message to an Amazon SQS queue. - ApplicationSubscription Protocol = "application" // delivery of JSON-encoded message to a mobile app or device. - LambdaSubscription Protocol = "lambda" // delivery of JSON-encoded message to an AWS Lambda function. -) diff --git a/lib/aws/idl/sns/topic.go b/lib/aws/idl/sns/topic.go deleted file mode 100644 index 528c7d189..000000000 --- a/lib/aws/idl/sns/topic.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package sns - -import ( - "github.com/pulumi/lumi/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 `lumi:"topicName,replaces,optional"` - // A developer-defined string that can be used to identify this SNS topic. - DisplayName *string `lumi:"displayName,optional"` -} diff --git a/lib/aws/idl/sqs/queue.go b/lib/aws/idl/sqs/queue.go deleted file mode 100644 index d2d11cd8f..000000000 --- a/lib/aws/idl/sqs/queue.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package sqs - -import ( - "github.com/pulumi/lumi/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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"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 `lumi:"visibilityTimeout,optional"` -} - -type RedrivePolicy struct { - // deadLetterTarget is the dead letter queue to which the messages are sent after maxReceiveCount has been exceeded. - DeadLetterTarget *Queue `lumi:"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 `lumi:"maxReceiveCount"` -} diff --git a/lib/aws/idl/types.go b/lib/aws/idl/types.go deleted file mode 100644 index 0b09e565e..000000000 --- a/lib/aws/idl/types.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package aws - -// Amazon Resource Names (ARNs) uniquely identify AWS resources. An ARN is required when you need to specify a -// resource unambiguously across all of AWS, such as in IAM policies, Amazon Relational Database Service (Amazon RDS) -// tags, and API calls. -// -// Here are some example ARNs: -// -// * Elastic Beanstalk application version: -// arn:aws:elasticbeanstalk:us-east-1:123456789012:environment/My App/MyEnvironment -// * IAM user name: -// arn:aws:iam::123456789012:user/David -// * Amazon RDS instance used for tagging: -// arn:aws:rds:eu-west-1:123456789012:db:mysql-db -// * Object in an Amazon S3 bucket: -// arn:aws:s3:::my_corporate_bucket/exampleobject.png -// -// The following are the general formats for ARNs; the specific components and values depend on the AWS service: -// -// arn:partition:service:region:account-id:resource -// arn:partition:service:region:account-id:resourcetype/resource -// arn:partition:service:region:account-id:resourcetype:resource -// -// The component parts are: -// -// * `partition`: The partition that the resource is in. For standard AWS regions, the partition is `aws`. If you -// have resources in other partitions, the partition is `aws-partitionname`. For example, the partition for -// resources in the China (Beijing) region is `aws-cn`. -// * `service`: The service namespace that identifies the AWS product (for example, Amazon S3, IAM, or Amazon RDS). -// For a list of namespaces, see -// http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces. -// * `region`: The region the resource resides in. Note that the ARNs for some resources do not require a region, -// so this component might be omitted. -// * `account`: The ID of the AWS account that owns the resource, without the hyphens. For example, 123456789012. -// Note that the ARNs for some resources don't require an account number, so this component might be omitted. -// * `resource`, `resourcetype/resource`, or `resourcetype:resource`: The content of this part of the ARN varies by -// service. It often includes an indicator of the type of resource—for example, an IAM user or Amazon RDS -// database -- followed by a slash (/) or a colon (:), followed by the resource name itself. Some services -// allows paths for resource names, as described in -// http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arns-paths. -// -// For more information on ARNs, please see http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html. -type ARN string - -// Region contains all the valid AWS regions in a convenient union type. -type Region string - -const ( - USEast1Region Region = "us-east-1" // US East (N. Virginia) - USEast2Region Region = "us-east-2" // US East (Ohio) - USWest1Region Region = "us-west-1" // US West (N. California) - USWest2Region Region = "us-west-2" // US West (Oregon) - CACentralRegion Region = "ca-central" // Canada (Central) - APSouth1Region Region = "ap-south-1" // Asia Pacific (Mumbai) - APNortheast1Region Region = "ap-northeast-1" // Asia Pacific (Tokyo) - APNortheast2Region Region = "ap-northeast-2" // Asia Pacific (Seoul) - APSoutheast1Region Region = "ap-southeast-1" // Asia Pacific (Singapore) - APSouthEast2Region Region = "ap-southeast-2" // Asia Pacific (Sydney) - EUCentral1Region Region = "eu-central-1" // EU (Frankfurt) - EUWest1Region Region = "eu-west-1" // EU (Ireland) - EUWest2Region Region = "eu-west-2" // EU (London) - SAEast1Region Region = "sa-east-1" // South America (Sao Paulo) -) diff --git a/lib/aws/pack/.gitignore b/lib/aws/pack/.gitignore deleted file mode 100644 index 6861a90a0..000000000 --- a/lib/aws/pack/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.lumi/ -node_modules/ - diff --git a/lib/aws/pack/Lumi.yaml b/lib/aws/pack/Lumi.yaml deleted file mode 100644 index 836d5053d..000000000 --- a/lib/aws/pack/Lumi.yaml +++ /dev/null @@ -1,6 +0,0 @@ -name: aws -description: A collection of AWS resources as Lumi stacks. -dependencies: - lumi: "*" - lumirt: "*" - diff --git a/lib/aws/pack/apigateway/account.ts b/lib/aws/pack/apigateway/account.ts deleted file mode 100644 index 785c6575b..000000000 --- a/lib/aws/pack/apigateway/account.ts +++ /dev/null @@ -1,32 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Role} from "../iam/role"; - -export class Account extends lumi.NamedResource implements AccountArgs { - public cloudWatchRole?: Role; - - public static get(id: lumi.ID): Account { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Account[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: AccountArgs) { - super(name); - if (args !== undefined) { - this.cloudWatchRole = args.cloudWatchRole; - } - } -} - -export interface AccountArgs { - cloudWatchRole?: Role; -} - diff --git a/lib/aws/pack/apigateway/apiKey.ts b/lib/aws/pack/apigateway/apiKey.ts deleted file mode 100644 index 8a7055b2b..000000000 --- a/lib/aws/pack/apigateway/apiKey.ts +++ /dev/null @@ -1,47 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {RestAPI} from "./restAPI"; -import {Stage} from "./stage"; - -export class APIKey extends lumi.NamedResource implements APIKeyArgs { - public readonly keyName?: string; - public description?: string; - public enabled?: boolean; - public stageKeys?: StageKey; - - public static get(id: lumi.ID): APIKey { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): APIKey[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: APIKeyArgs) { - super(name); - if (args !== undefined) { - this.keyName = args.keyName; - this.description = args.description; - this.enabled = args.enabled; - this.stageKeys = args.stageKeys; - } - } -} - -export interface APIKeyArgs { - readonly keyName?: string; - description?: string; - enabled?: boolean; - stageKeys?: StageKey; -} - -export interface StageKey { - restAPI?: RestAPI; - stage?: Stage; -} - diff --git a/lib/aws/pack/apigateway/authorizer.ts b/lib/aws/pack/apigateway/authorizer.ts deleted file mode 100644 index 2b1ae9dbb..000000000 --- a/lib/aws/pack/apigateway/authorizer.ts +++ /dev/null @@ -1,62 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {RestAPI} from "./restAPI"; -import {Role} from "../iam/role"; - -export let CognitoAuthorizer: AuthorizerType = "COGNITO_USER_POOLS"; -export let TokenAuthorizer: AuthorizerType = "TOKEN"; - -export class Authorizer extends lumi.NamedResource implements AuthorizerArgs { - public type: AuthorizerType; - public authorizerCredentials?: Role; - public authorizerResultTTLInSeconds?: number; - public authorizerURI?: string; - public identitySource?: string; - public identityValidationExpression?: string; - public providers?: lumi.Resource[]; - public restAPI?: RestAPI; - - public static get(id: lumi.ID): Authorizer { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Authorizer[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: AuthorizerArgs) { - super(name); - if (lumirt.defaultIfComputed(args.type, "") === undefined) { - throw new Error("Missing required argument 'type'"); - } - this.type = args.type; - this.authorizerCredentials = args.authorizerCredentials; - this.authorizerResultTTLInSeconds = args.authorizerResultTTLInSeconds; - this.authorizerURI = args.authorizerURI; - this.identitySource = args.identitySource; - this.identityValidationExpression = args.identityValidationExpression; - this.providers = args.providers; - this.restAPI = args.restAPI; - } -} - -export interface AuthorizerArgs { - type: AuthorizerType; - authorizerCredentials?: Role; - authorizerResultTTLInSeconds?: number; - authorizerURI?: string; - identitySource?: string; - identityValidationExpression?: string; - providers?: lumi.Resource[]; - restAPI?: RestAPI; -} - -export type AuthorizerType = - "COGNITO_USER_POOLS" | - "TOKEN"; - diff --git a/lib/aws/pack/apigateway/basePathMapping.ts b/lib/aws/pack/apigateway/basePathMapping.ts deleted file mode 100644 index e5217bb04..000000000 --- a/lib/aws/pack/apigateway/basePathMapping.ts +++ /dev/null @@ -1,46 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {RestAPI} from "./restAPI"; -import {Stage} from "./stage"; - -export class BasePathMapping extends lumi.NamedResource implements BasePathMappingArgs { - public domainName: string; - public restAPI: RestAPI; - public basePath?: string; - public stage?: Stage; - - public static get(id: lumi.ID): BasePathMapping { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): BasePathMapping[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: BasePathMappingArgs) { - super(name); - if (lumirt.defaultIfComputed(args.domainName, "") === undefined) { - throw new Error("Missing required argument 'domainName'"); - } - this.domainName = args.domainName; - if (lumirt.defaultIfComputed(args.restAPI, "") === undefined) { - throw new Error("Missing required argument 'restAPI'"); - } - this.restAPI = args.restAPI; - this.basePath = args.basePath; - this.stage = args.stage; - } -} - -export interface BasePathMappingArgs { - domainName: string; - restAPI: RestAPI; - basePath?: string; - stage?: Stage; -} - diff --git a/lib/aws/pack/apigateway/clientCertificate.ts b/lib/aws/pack/apigateway/clientCertificate.ts deleted file mode 100644 index 95abbcfb8..000000000 --- a/lib/aws/pack/apigateway/clientCertificate.ts +++ /dev/null @@ -1,30 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export class ClientCertificate extends lumi.NamedResource implements ClientCertificateArgs { - public description?: string; - - public static get(id: lumi.ID): ClientCertificate { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): ClientCertificate[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: ClientCertificateArgs) { - super(name); - if (args !== undefined) { - this.description = args.description; - } - } -} - -export interface ClientCertificateArgs { - description?: string; -} - diff --git a/lib/aws/pack/apigateway/deployment.ts b/lib/aws/pack/apigateway/deployment.ts deleted file mode 100644 index b1a91afd7..000000000 --- a/lib/aws/pack/apigateway/deployment.ts +++ /dev/null @@ -1,38 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {RestAPI} from "./restAPI"; - -export class Deployment extends lumi.NamedResource implements DeploymentArgs { - public readonly restAPI: RestAPI; - public description?: string; - public id: string; - public createdDate: string; - - public static get(id: lumi.ID): Deployment { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Deployment[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: DeploymentArgs) { - super(name); - if (lumirt.defaultIfComputed(args.restAPI, "") === undefined) { - throw new Error("Missing required argument 'restAPI'"); - } - this.restAPI = args.restAPI; - this.description = args.description; - } -} - -export interface DeploymentArgs { - readonly restAPI: RestAPI; - description?: string; -} - diff --git a/lib/aws/pack/apigateway/index.ts b/lib/aws/pack/apigateway/index.ts deleted file mode 100644 index 8f1b77240..000000000 --- a/lib/aws/pack/apigateway/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./account"; -export * from "./apiKey"; -export * from "./authorizer"; -export * from "./basePathMapping"; -export * from "./clientCertificate"; -export * from "./deployment"; -export * from "./method"; -export * from "./model"; -export * from "./resource"; -export * from "./restAPI"; -export * from "./stage"; -export * from "./usagePlan"; -export * from "./usagePlanKey"; - diff --git a/lib/aws/pack/apigateway/method.ts b/lib/aws/pack/apigateway/method.ts deleted file mode 100644 index d5c2cfdc1..000000000 --- a/lib/aws/pack/apigateway/method.ts +++ /dev/null @@ -1,147 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Authorizer} from "./authorizer"; -import {Model} from "./model"; -import {Resource} from "./resource"; -import {RestAPI} from "./restAPI"; - -export let AWSIAMAuthorization: AuthorizationType = "AWS_IAM"; -export let AWSIntegration: IntegrationType = "AWS"; -export let AWSProxyIntegration: IntegrationType = "AWS_PROXY"; -export let CognitoAuthorization: AuthorizationType = "COGNITO_USER_POOLS"; -export let CustomAuthorization: AuthorizationType = "CUSTOM"; -export let HTTPIntegration: IntegrationType = "HTTP"; -export let HTTPProxyIntegration: IntegrationType = "HTTP_PROXY"; -export let LoggingErrorLevel: LoggingLevel = "ERROR"; -export let LoggingInfoLevel: LoggingLevel = "INFO"; -export let LoggingOff: LoggingLevel = "OFF"; -export let MockIntegration: IntegrationType = "MOCK"; -export let NoAuthorization: AuthorizationType = "NONE"; -export let PassthroughNever: PassthroughBehavior = "NEVER"; -export let PassthroughWhenNoMatch: PassthroughBehavior = "WHEN_NO_MATCH"; -export let PassthroughWhenNoTemplates: PassthroughBehavior = "WHEN_NO_TEMPLATES"; - -export type AuthorizationType = - "AWS_IAM" | - "COGNITO_USER_POOLS" | - "CUSTOM" | - "NONE"; - -export interface Integration { - type: IntegrationType; - cacheKeyParameters?: string[]; - cacheNamespace?: string; - credentials?: string; - integrationHTTPMethod?: string; - integrationResponse?: IntegrationResponse[]; - passthroughBehavior?: PassthroughBehavior; - requestParameters?: {[key: string]: string}; - requestTemplates?: {[key: string]: string}; - uri?: string; -} - -export interface IntegrationResponse { - responseParameters?: {[key: string]: string}; - responseTemplates?: {[key: string]: string}; - selectionPattern?: string; - statusCode?: string; -} - -export type IntegrationType = - "AWS" | - "AWS_PROXY" | - "HTTP" | - "HTTP_PROXY" | - "MOCK"; - -export type LoggingLevel = - "ERROR" | - "INFO" | - "OFF"; - -export class Method extends lumi.NamedResource implements MethodArgs { - public httpMethod: string; - public apiResource: Resource; - public restAPI: RestAPI; - public apiKeyRequired?: boolean; - public authorizationType?: AuthorizationType; - public authorizer?: Authorizer; - public integration?: Integration; - public methodResponses?: MethodResponse[]; - public requestModels?: {[key: string]: Model}; - public requestParameters?: {[key: string]: boolean}; - - public static get(id: lumi.ID): Method { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Method[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: MethodArgs) { - super(name); - if (lumirt.defaultIfComputed(args.httpMethod, "") === undefined) { - throw new Error("Missing required argument 'httpMethod'"); - } - this.httpMethod = args.httpMethod; - if (lumirt.defaultIfComputed(args.apiResource, "") === undefined) { - throw new Error("Missing required argument 'apiResource'"); - } - this.apiResource = args.apiResource; - if (lumirt.defaultIfComputed(args.restAPI, "") === undefined) { - throw new Error("Missing required argument 'restAPI'"); - } - this.restAPI = args.restAPI; - this.apiKeyRequired = args.apiKeyRequired; - this.authorizationType = args.authorizationType; - this.authorizer = args.authorizer; - this.integration = args.integration; - this.methodResponses = args.methodResponses; - this.requestModels = args.requestModels; - this.requestParameters = args.requestParameters; - } -} - -export interface MethodArgs { - httpMethod: string; - apiResource: Resource; - restAPI: RestAPI; - apiKeyRequired?: boolean; - authorizationType?: AuthorizationType; - authorizer?: Authorizer; - integration?: Integration; - methodResponses?: MethodResponse[]; - requestModels?: {[key: string]: Model}; - requestParameters?: {[key: string]: boolean}; -} - -export interface MethodResponse { - statusCode: string; - responseModels?: {[key: string]: Model}; - responseParameters?: {[key: string]: boolean}; -} - -export interface MethodSetting { - cacheDataEncrypted?: boolean; - cacheTTLInSeconds?: number; - cachingEnabled?: boolean; - dataTraceEnabled?: boolean; - httpMethod?: string; - loggingLevel?: LoggingLevel; - metricsEnabled?: boolean; - resourcePath?: string; - throttlingBurstLimit?: number; - throttlingRateLimit?: number; -} - -export type PassthroughBehavior = - "NEVER" | - "WHEN_NO_MATCH" | - "WHEN_NO_TEMPLATES"; - diff --git a/lib/aws/pack/apigateway/model.ts b/lib/aws/pack/apigateway/model.ts deleted file mode 100644 index 0c8c0a1b7..000000000 --- a/lib/aws/pack/apigateway/model.ts +++ /dev/null @@ -1,51 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {RestAPI} from "./restAPI"; - -export class Model extends lumi.NamedResource implements ModelArgs { - public readonly contentType: string; - public readonly restAPI: RestAPI; - public schema: any; - public readonly modelName?: string; - public description?: string; - - public static get(id: lumi.ID): Model { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Model[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: ModelArgs) { - super(name); - if (lumirt.defaultIfComputed(args.contentType, "") === undefined) { - throw new Error("Missing required argument 'contentType'"); - } - this.contentType = args.contentType; - if (lumirt.defaultIfComputed(args.restAPI, "") === undefined) { - throw new Error("Missing required argument 'restAPI'"); - } - this.restAPI = args.restAPI; - if (lumirt.defaultIfComputed(args.schema, "") === undefined) { - throw new Error("Missing required argument 'schema'"); - } - this.schema = args.schema; - this.modelName = args.modelName; - this.description = args.description; - } -} - -export interface ModelArgs { - readonly contentType: string; - readonly restAPI: RestAPI; - schema: any; - readonly modelName?: string; - description?: string; -} - diff --git a/lib/aws/pack/apigateway/resource.ts b/lib/aws/pack/apigateway/resource.ts deleted file mode 100644 index ef4d2b908..000000000 --- a/lib/aws/pack/apigateway/resource.ts +++ /dev/null @@ -1,45 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {RestAPI} from "./restAPI"; - -export class Resource extends lumi.NamedResource implements ResourceArgs { - public readonly parent: Resource; - public readonly pathPart: string; - public readonly restAPI: RestAPI; - - public static get(id: lumi.ID): Resource { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Resource[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: ResourceArgs) { - super(name); - if (lumirt.defaultIfComputed(args.parent, "") === undefined) { - throw new Error("Missing required argument 'parent'"); - } - this.parent = args.parent; - if (lumirt.defaultIfComputed(args.pathPart, "") === undefined) { - throw new Error("Missing required argument 'pathPart'"); - } - this.pathPart = args.pathPart; - if (lumirt.defaultIfComputed(args.restAPI, "") === undefined) { - throw new Error("Missing required argument 'restAPI'"); - } - this.restAPI = args.restAPI; - } -} - -export interface ResourceArgs { - readonly parent: Resource; - readonly pathPart: string; - readonly restAPI: RestAPI; -} - diff --git a/lib/aws/pack/apigateway/restAPI.ts b/lib/aws/pack/apigateway/restAPI.ts deleted file mode 100644 index 72f3b4d5a..000000000 --- a/lib/aws/pack/apigateway/restAPI.ts +++ /dev/null @@ -1,61 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Object} from "../s3/object"; - -export class RestAPI extends lumi.NamedResource implements RestAPIArgs { - public body?: any; - public bodyS3Location?: S3Location; - public cloneFrom?: RestAPI; - public description?: string; - public failOnWarnings?: boolean; - public apiName?: string; - public parameters?: string[]; - public id: string; - public createdDate: string; - public version: string; - public warnings: string[]; - public binaryMediaTypes: string[]; - - public static get(id: lumi.ID): RestAPI { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): RestAPI[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: RestAPIArgs) { - super(name); - if (args !== undefined) { - this.body = args.body; - this.bodyS3Location = args.bodyS3Location; - this.cloneFrom = args.cloneFrom; - this.description = args.description; - this.failOnWarnings = args.failOnWarnings; - this.apiName = args.apiName; - this.parameters = args.parameters; - } - } -} - -export interface RestAPIArgs { - body?: any; - bodyS3Location?: S3Location; - cloneFrom?: RestAPI; - description?: string; - failOnWarnings?: boolean; - apiName?: string; - parameters?: string[]; -} - -export interface S3Location { - object: Object; - etag?: string; - version?: string; -} - diff --git a/lib/aws/pack/apigateway/stage.ts b/lib/aws/pack/apigateway/stage.ts deleted file mode 100644 index 5cd4cf03e..000000000 --- a/lib/aws/pack/apigateway/stage.ts +++ /dev/null @@ -1,70 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {ClientCertificate} from "./clientCertificate"; -import {Deployment} from "./deployment"; -import {MethodSetting} from "./method"; -import {RestAPI} from "./restAPI"; - -export class Stage extends lumi.NamedResource implements StageArgs { - public readonly restAPI: RestAPI; - public readonly stageName: string; - public deployment: Deployment; - public cacheClusterEnabled?: boolean; - public cacheClusterSize?: string; - public clientCertificate?: ClientCertificate; - public description?: string; - public methodSettings?: MethodSetting[]; - public variables?: {[key: string]: string}; - public createdDate: string; - public lastUpdatedDate: string; - public url: string; - public executionARN: string; - - public static get(id: lumi.ID): Stage { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Stage[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: StageArgs) { - super(name); - if (lumirt.defaultIfComputed(args.restAPI, "") === undefined) { - throw new Error("Missing required argument 'restAPI'"); - } - this.restAPI = args.restAPI; - if (lumirt.defaultIfComputed(args.stageName, "") === undefined) { - throw new Error("Missing required argument 'stageName'"); - } - this.stageName = args.stageName; - if (lumirt.defaultIfComputed(args.deployment, "") === undefined) { - throw new Error("Missing required argument 'deployment'"); - } - this.deployment = args.deployment; - this.cacheClusterEnabled = args.cacheClusterEnabled; - this.cacheClusterSize = args.cacheClusterSize; - this.clientCertificate = args.clientCertificate; - this.description = args.description; - this.methodSettings = args.methodSettings; - this.variables = args.variables; - } -} - -export interface StageArgs { - readonly restAPI: RestAPI; - readonly stageName: string; - deployment: Deployment; - cacheClusterEnabled?: boolean; - cacheClusterSize?: string; - clientCertificate?: ClientCertificate; - description?: string; - methodSettings?: MethodSetting[]; - variables?: {[key: string]: string}; -} - diff --git a/lib/aws/pack/apigateway/usagePlan.ts b/lib/aws/pack/apigateway/usagePlan.ts deleted file mode 100644 index c3a1087d1..000000000 --- a/lib/aws/pack/apigateway/usagePlan.ts +++ /dev/null @@ -1,70 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {RestAPI} from "./restAPI"; -import {Stage} from "./stage"; - -export let QuotaDayPeriod: QuotaPeriod = "DAY"; -export let QuotaMonthPeriod: QuotaPeriod = "MONTH"; -export let QuotaWeekPeriod: QuotaPeriod = "WEEK"; - -export interface APIStage { - api?: RestAPI; - stage?: Stage; -} - -export type QuotaPeriod = - "DAY" | - "MONTH" | - "WEEK"; - -export interface QuotaSettings { - limit?: number; - offset?: number; - period?: QuotaPeriod; -} - -export interface ThrottleSettings { - burstRateLimit?: number; - rateLimit?: number; -} - -export class UsagePlan extends lumi.NamedResource implements UsagePlanArgs { - public apiStages?: APIStage[]; - public description?: string; - public quota?: QuotaSettings; - public throttle?: ThrottleSettings; - public usagePlanName?: string; - - public static get(id: lumi.ID): UsagePlan { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): UsagePlan[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: UsagePlanArgs) { - super(name); - if (args !== undefined) { - this.apiStages = args.apiStages; - this.description = args.description; - this.quota = args.quota; - this.throttle = args.throttle; - this.usagePlanName = args.usagePlanName; - } - } -} - -export interface UsagePlanArgs { - apiStages?: APIStage[]; - description?: string; - quota?: QuotaSettings; - throttle?: ThrottleSettings; - usagePlanName?: string; -} - diff --git a/lib/aws/pack/apigateway/usagePlanKey.ts b/lib/aws/pack/apigateway/usagePlanKey.ts deleted file mode 100644 index 7adca54af..000000000 --- a/lib/aws/pack/apigateway/usagePlanKey.ts +++ /dev/null @@ -1,40 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {APIKey} from "./apiKey"; -import {UsagePlan} from "./usagePlan"; - -export class UsagePlanKey extends lumi.NamedResource implements UsagePlanKeyArgs { - public readonly key: APIKey; - public readonly usagePlan: UsagePlan; - - public static get(id: lumi.ID): UsagePlanKey { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): UsagePlanKey[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: UsagePlanKeyArgs) { - super(name); - if (lumirt.defaultIfComputed(args.key, "") === undefined) { - throw new Error("Missing required argument 'key'"); - } - this.key = args.key; - if (lumirt.defaultIfComputed(args.usagePlan, "") === undefined) { - throw new Error("Missing required argument 'usagePlan'"); - } - this.usagePlan = args.usagePlan; - } -} - -export interface UsagePlanKeyArgs { - readonly key: APIKey; - readonly usagePlan: UsagePlan; -} - diff --git a/lib/aws/pack/cloudwatch/alarm.ts b/lib/aws/pack/cloudwatch/alarm.ts deleted file mode 100644 index 6bc02319d..000000000 --- a/lib/aws/pack/cloudwatch/alarm.ts +++ /dev/null @@ -1,201 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export let AverageStatistic: AlarmStatistic = "Average"; -export let BitsMetric: AlarmMetric = "Bits"; -export let BitsPerSecondMetric: AlarmMetric = "Bits/Second"; -export let BytesMetric: AlarmMetric = "Bytes"; -export let BytesPerSecondMetric: AlarmMetric = "Bytes/Second"; -export let CountMetric: AlarmMetric = "Count"; -export let CountPerSecondMetric: AlarmMetric = "Count/Second"; -export let GigabitsMetric: AlarmMetric = "Gigabits"; -export let GigabitsPerSecondMetric: AlarmMetric = "Gigabits/Second"; -export let GigabytesMetric: AlarmMetric = "Gigabytes"; -export let GigabytesPerSecondMetric: AlarmMetric = "Gigabytes/Second"; -export let KilobitsMetric: AlarmMetric = "Kilobits"; -export let KilobitsPerSecondMetric: AlarmMetric = "Kilobits/Second"; -export let KilobytesMetric: AlarmMetric = "Kilobytes"; -export let KilobytesPerSecondMetric: AlarmMetric = "Kilobytes/Second"; -export let MaximumStatistic: AlarmStatistic = "Maximum"; -export let MegabitsMetric: AlarmMetric = "Megabits"; -export let MegabitsPerSecondMetric: AlarmMetric = "Megabits/Second"; -export let MegabytesMetric: AlarmMetric = "Megabytes"; -export let MegabytesPerSecondMetric: AlarmMetric = "Megabytes/Second"; -export let MicrosecondsMetric: AlarmMetric = "Microseconds"; -export let MillisecondsMetric: AlarmMetric = "Milliseconds"; -export let MinimumStatistic: AlarmStatistic = "Minimum"; -export let NoMetric: AlarmMetric = "None"; -export let PercentMetric: AlarmMetric = "Percent"; -export let SampleCountStatistic: AlarmStatistic = "SampleCount"; -export let SecondsMetric: AlarmMetric = "Seconds"; -export let SumStatistic: AlarmStatistic = "Sum"; -export let TerabitsMetric: AlarmMetric = "Terabits"; -export let TerabitsPerSecondMetric: AlarmMetric = "Terabits/Second"; -export let TerabytesMetric: AlarmMetric = "Terabytes"; -export let TerabytesPerSecondMetric: AlarmMetric = "Terabytes/Second"; -export let ThresholdGreaterThan: AlarmComparisonOperator = "GreaterThanThreshold"; -export let ThresholdGreaterThanOrEqualTo: AlarmComparisonOperator = "GreaterThanOrEqualToThreshold"; -export let ThresholdLessThan: AlarmComparisonOperator = "LessThanThreshold"; -export let ThresholdLessThanOrEqualTo: AlarmComparisonOperator = "LessThanOrEqualToThreshold"; - -export class ActionTarget extends lumi.NamedResource implements ActionTargetArgs { - public readonly topicName?: string; - public displayName?: string; - - public static get(id: lumi.ID): ActionTarget { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): ActionTarget[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: ActionTargetArgs) { - super(name); - if (args !== undefined) { - this.topicName = args.topicName; - this.displayName = args.displayName; - } - } -} - -export interface ActionTargetArgs { - readonly topicName?: string; - displayName?: string; -} - -export class Alarm extends lumi.NamedResource implements AlarmArgs { - public comparisonOperator: AlarmComparisonOperator; - public evaluationPerids: number; - public metricName: string; - public namespace: string; - public period: number; - public statistic: AlarmStatistic; - public threshold: number; - public actionsEnabled?: boolean; - public alarmActions?: ActionTarget[]; - public alarmDescription?: string; - public readonly alarmName?: string; - public dimensions?: AlarmDimension[]; - public insufficientDataActions?: ActionTarget[]; - public okActions?: ActionTarget[]; - public unit?: AlarmMetric; - - public static get(id: lumi.ID): Alarm { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Alarm[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: AlarmArgs) { - super(name); - if (lumirt.defaultIfComputed(args.comparisonOperator, "") === undefined) { - throw new Error("Missing required argument 'comparisonOperator'"); - } - this.comparisonOperator = args.comparisonOperator; - if (lumirt.defaultIfComputed(args.evaluationPerids, "") === undefined) { - throw new Error("Missing required argument 'evaluationPerids'"); - } - this.evaluationPerids = args.evaluationPerids; - if (lumirt.defaultIfComputed(args.metricName, "") === undefined) { - throw new Error("Missing required argument 'metricName'"); - } - this.metricName = args.metricName; - if (lumirt.defaultIfComputed(args.namespace, "") === undefined) { - throw new Error("Missing required argument 'namespace'"); - } - this.namespace = args.namespace; - if (lumirt.defaultIfComputed(args.period, "") === undefined) { - throw new Error("Missing required argument 'period'"); - } - this.period = args.period; - if (lumirt.defaultIfComputed(args.statistic, "") === undefined) { - throw new Error("Missing required argument 'statistic'"); - } - this.statistic = args.statistic; - if (lumirt.defaultIfComputed(args.threshold, "") === undefined) { - throw new Error("Missing required argument 'threshold'"); - } - this.threshold = args.threshold; - this.actionsEnabled = args.actionsEnabled; - this.alarmActions = args.alarmActions; - this.alarmDescription = args.alarmDescription; - this.alarmName = args.alarmName; - this.dimensions = args.dimensions; - this.insufficientDataActions = args.insufficientDataActions; - this.okActions = args.okActions; - this.unit = args.unit; - } -} - -export interface AlarmArgs { - comparisonOperator: AlarmComparisonOperator; - evaluationPerids: number; - metricName: string; - namespace: string; - period: number; - statistic: AlarmStatistic; - threshold: number; - actionsEnabled?: boolean; - alarmActions?: ActionTarget[]; - alarmDescription?: string; - readonly alarmName?: string; - dimensions?: AlarmDimension[]; - insufficientDataActions?: ActionTarget[]; - okActions?: ActionTarget[]; - unit?: AlarmMetric; -} - -export type AlarmComparisonOperator = - "GreaterThanThreshold" | - "GreaterThanOrEqualToThreshold" | - "LessThanThreshold" | - "LessThanOrEqualToThreshold"; - -export interface AlarmDimension { - name: string; - value: any; -} - -export type AlarmMetric = - "Bits" | - "Bits/Second" | - "Bytes" | - "Bytes/Second" | - "Count" | - "Count/Second" | - "Gigabits" | - "Gigabits/Second" | - "Gigabytes" | - "Gigabytes/Second" | - "Kilobits" | - "Kilobits/Second" | - "Kilobytes" | - "Kilobytes/Second" | - "Megabits" | - "Megabits/Second" | - "Megabytes" | - "Megabytes/Second" | - "Microseconds" | - "Milliseconds" | - "None" | - "Percent" | - "Seconds" | - "Terabits" | - "Terabits/Second" | - "Terabytes" | - "Terabytes/Second"; - -export type AlarmStatistic = - "Average" | - "Maximum" | - "Minimum" | - "SampleCount" | - "Sum"; - diff --git a/lib/aws/pack/cloudwatch/index.ts b/lib/aws/pack/cloudwatch/index.ts deleted file mode 100644 index 6a087d7ae..000000000 --- a/lib/aws/pack/cloudwatch/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./alarm"; -export * from "./logGroup"; -export * from "./logSubscriptionFilter"; - diff --git a/lib/aws/pack/cloudwatch/logGroup.ts b/lib/aws/pack/cloudwatch/logGroup.ts deleted file mode 100644 index 3ef12b571..000000000 --- a/lib/aws/pack/cloudwatch/logGroup.ts +++ /dev/null @@ -1,33 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export class LogGroup extends lumi.NamedResource implements LogGroupArgs { - public readonly logGroupName?: string; - public retentionInDays?: number; - - public static get(id: lumi.ID): LogGroup { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): LogGroup[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: LogGroupArgs) { - super(name); - if (args !== undefined) { - this.logGroupName = args.logGroupName; - this.retentionInDays = args.retentionInDays; - } - } -} - -export interface LogGroupArgs { - readonly logGroupName?: string; - retentionInDays?: number; -} - diff --git a/lib/aws/pack/cloudwatch/logSubscriptionFilter.ts b/lib/aws/pack/cloudwatch/logSubscriptionFilter.ts deleted file mode 100644 index b5de56766..000000000 --- a/lib/aws/pack/cloudwatch/logSubscriptionFilter.ts +++ /dev/null @@ -1,59 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {ARN} from "../types"; - -export let ByLogStreamDistribution: LogSubscriptionDistribution = "ByLogStream"; -export let RandomDistribution: LogSubscriptionDistribution = "Random"; - -export type LogSubscriptionDistribution = - "ByLogStream" | - "Random"; - -export class LogSubscriptionFilter extends lumi.NamedResource implements LogSubscriptionFilterArgs { - public readonly logGroupName: string; - public filterPattern: string; - public readonly destinationArn: string; - public roleArn?: ARN; - public distribution?: LogSubscriptionDistribution; - public creationTime: number; - - public static get(id: lumi.ID): LogSubscriptionFilter { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): LogSubscriptionFilter[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: LogSubscriptionFilterArgs) { - super(name); - if (lumirt.defaultIfComputed(args.logGroupName, "") === undefined) { - throw new Error("Missing required argument 'logGroupName'"); - } - this.logGroupName = args.logGroupName; - if (lumirt.defaultIfComputed(args.filterPattern, "") === undefined) { - throw new Error("Missing required argument 'filterPattern'"); - } - this.filterPattern = args.filterPattern; - if (lumirt.defaultIfComputed(args.destinationArn, "") === undefined) { - throw new Error("Missing required argument 'destinationArn'"); - } - this.destinationArn = args.destinationArn; - this.roleArn = args.roleArn; - this.distribution = args.distribution; - } -} - -export interface LogSubscriptionFilterArgs { - readonly logGroupName: string; - filterPattern: string; - readonly destinationArn: string; - roleArn?: ARN; - distribution?: LogSubscriptionDistribution; -} - diff --git a/lib/aws/pack/config/index.ts b/lib/aws/pack/config/index.ts deleted file mode 100644 index d54a7c8fb..000000000 --- a/lib/aws/pack/config/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -import {Region} from "../types"; - -// region configures the target region for a deployment. The provider explicitly does not recognize AWS_REGION, -// to minimize the possibility of accidental deployment differences due to a changing environment variable. -export let region: Region | undefined; - -// requireRegion fetches the AWS region, requiring that it exists; if it has not been configured, an error is thrown. -export function requireRegion(): Region { - if (region === undefined) { - throw new Error("No AWS region has been configured"); - } - return region; -} - -// accessKeyId configures the access key ID used to access AWS. This is a secret. If not provided, the -// provider will look in the standard places (~/.aws/credentials, AWS_ACCESS_KEY_ID, etc). -export let accessKeyId: string | undefined; - -// secretAcessKey configures the secret access key used to access AWS. This is a secret. If not provided, the -// provider will look in the standard places (~/.aws/credentials, AWS_SECRET_ACCESS_KEY, etc). -export let secretAccessKey: string | undefined; // the secret access key used to access AWS. - diff --git a/lib/aws/pack/dynamodb/index.ts b/lib/aws/pack/dynamodb/index.ts deleted file mode 100644 index b272410a7..000000000 --- a/lib/aws/pack/dynamodb/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./table"; - diff --git a/lib/aws/pack/dynamodb/table.ts b/lib/aws/pack/dynamodb/table.ts deleted file mode 100644 index 914afd6f8..000000000 --- a/lib/aws/pack/dynamodb/table.ts +++ /dev/null @@ -1,90 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export let AllProjection: ProjectionType = "ALL"; -export let BinaryAttribute: AttributeType = "B"; -export let IncludeProjection: ProjectionType = "INCLUDE"; -export let KeysOnlyProjection: ProjectionType = "KEYS_ONLY"; -export let NumberAttribute: AttributeType = "N"; -export let StringAttribute: AttributeType = "S"; - -export interface Attribute { - name: string; - type: AttributeType; -} - -export type AttributeType = - "B" | - "N" | - "S"; - -export interface GlobalSecondaryIndex { - indexName: string; - hashKey: string; - rangeKey?: string; - readCapacity: number; - writeCapacity: number; - nonKeyAttributes: string[]; - projectionType: ProjectionType; -} - -export type ProjectionType = - "ALL" | - "INCLUDE" | - "KEYS_ONLY"; - -export class Table extends lumi.NamedResource implements TableArgs { - public readonly hashKey: string; - public attributes: Attribute[]; - public readCapacity: number; - public writeCapacity: number; - public readonly rangeKey?: string; - public readonly tableName?: string; - public globalSecondaryIndexes?: GlobalSecondaryIndex[]; - - public static get(id: lumi.ID): Table { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Table[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: TableArgs) { - super(name); - if (lumirt.defaultIfComputed(args.hashKey, "") === undefined) { - throw new Error("Missing required argument 'hashKey'"); - } - this.hashKey = args.hashKey; - if (lumirt.defaultIfComputed(args.attributes, "") === undefined) { - throw new Error("Missing required argument 'attributes'"); - } - this.attributes = args.attributes; - if (lumirt.defaultIfComputed(args.readCapacity, "") === undefined) { - throw new Error("Missing required argument 'readCapacity'"); - } - this.readCapacity = args.readCapacity; - if (lumirt.defaultIfComputed(args.writeCapacity, "") === undefined) { - throw new Error("Missing required argument 'writeCapacity'"); - } - this.writeCapacity = args.writeCapacity; - this.rangeKey = args.rangeKey; - this.tableName = args.tableName; - this.globalSecondaryIndexes = args.globalSecondaryIndexes; - } -} - -export interface TableArgs { - readonly hashKey: string; - attributes: Attribute[]; - readCapacity: number; - writeCapacity: number; - readonly rangeKey?: string; - readonly tableName?: string; - globalSecondaryIndexes?: GlobalSecondaryIndex[]; -} - diff --git a/lib/aws/pack/ec2/index.ts b/lib/aws/pack/ec2/index.ts deleted file mode 100644 index cc2c4967f..000000000 --- a/lib/aws/pack/ec2/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./instance"; -export * from "./instanceMaps"; -export * from "./internetGateway"; -export * from "./route"; -export * from "./routeTable"; -export * from "./securityGroup"; -export * from "./securityGroupEgress"; -export * from "./securityGroupIngress"; -export * from "./subnet"; -export * from "./vpc"; -export * from "./vpcGatewayAttachment"; -export * from "./vpcPeeringConnection"; - diff --git a/lib/aws/pack/ec2/instance.ts b/lib/aws/pack/ec2/instance.ts deleted file mode 100644 index 8e1c7366e..000000000 --- a/lib/aws/pack/ec2/instance.ts +++ /dev/null @@ -1,172 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {SecurityGroup} from "./securityGroup"; - -export let C3Instance2XLarge: InstanceType = "c3.2xlarge"; -export let C3Instance4XLarge: InstanceType = "c3.4xlarge"; -export let C3Instance8XLarge: InstanceType = "c3.8xlarge"; -export let C3InstanceLarge: InstanceType = "c3.large"; -export let C3InstanceXLarge: InstanceType = "c3.xlarge"; -export let C4Instance2XLarge: InstanceType = "c4.2xlarge"; -export let C4Instance4XLarge: InstanceType = "c4.4xlarge"; -export let C4Instance8XLarge: InstanceType = "c4.8xlarge"; -export let C4InstanceLarge: InstanceType = "c4.large"; -export let C4InstanceXLarge: InstanceType = "c4.xlarge"; -export let D2Instance2XLarge: InstanceType = "d2.2xlarge"; -export let D2Instance4XLarge: InstanceType = "d2.4xlarge"; -export let D2Instance8XLarge: InstanceType = "d2.8xlarge"; -export let D2InstanceXLarge: InstanceType = "d2.xlarge"; -export let F1Instance16XLarge: InstanceType = "f1.16xlarge"; -export let F1Instance2XLarge: InstanceType = "f1.2xlarge"; -export let G2Instance2XLarge: InstanceType = "g2.2xlarge"; -export let G2Instance8XLarge: InstanceType = "g2.8xlarge"; -export let I3Instance16XLarge: InstanceType = "i3.16xlarge"; -export let I3Instance2XLarge: InstanceType = "i3.2xlarge"; -export let I3Instance4XLarge: InstanceType = "i3.4xlarge"; -export let I3Instance8XLarge: InstanceType = "i3.8xlarge"; -export let I3InstanceLarge: InstanceType = "i3.large"; -export let I3InstanceXLarge: InstanceType = "i3.xlarge"; -export let M3Instance2XLarge: InstanceType = "m3.2xlarge"; -export let M3InstanceLarge: InstanceType = "m3.large"; -export let M3InstanceMedium: InstanceType = "m3.medium"; -export let M3InstanceXLarge: InstanceType = "m3.xlarge"; -export let M4Instance10XLarge: InstanceType = "m4.10xlarge"; -export let M4Instance16XLarge: InstanceType = "m4.16xlarge"; -export let M4Instance2XLarge: InstanceType = "m4.2xlarge"; -export let M4Instance4XLarge: InstanceType = "m4.4xlarge"; -export let M4InstanceLarge: InstanceType = "m4.large"; -export let M4InstanceXLarge: InstanceType = "m4.xlarge"; -export let P2Instance16XLarge: InstanceType = "p2.16xlarge"; -export let P2Instance8XLarge: InstanceType = "p2.8xlarge"; -export let P2InstanceXLarge: InstanceType = "p2.xlarge"; -export let R3Instance2XLarge: InstanceType = "r3.2xlarge"; -export let R3Instance4XLarge: InstanceType = "r3.4xlarge"; -export let R3Instance8XLarge: InstanceType = "r3.8xlarge"; -export let R3InstanceLarge: InstanceType = "r3.large"; -export let R3InstanceXLarge: InstanceType = "r3.xlarge"; -export let R4Instance16XLarge: InstanceType = "r4.16xlarge"; -export let R4Instance2XLarge: InstanceType = "r4.2xlarge"; -export let R4Instance4XLarge: InstanceType = "r4.4xlarge"; -export let R4Instance8XLarge: InstanceType = "r4.8xlarge"; -export let R4InstanceLarge: InstanceType = "r4.large"; -export let R4InstanceXLarge: InstanceType = "r4.xlarge"; -export let T2Instance2XLarge: InstanceType = "t2.2xlarge"; -export let T2InstanceLarge: InstanceType = "t2.large"; -export let T2InstanceMedium: InstanceType = "t2.medium"; -export let T2InstanceMicro: InstanceType = "t2.micro"; -export let T2InstanceNano: InstanceType = "t2.nano"; -export let T2InstanceSmall: InstanceType = "t2.small"; -export let T2InstanceXLarge: InstanceType = "t2.xlarge"; -export let X1Instance16XLarge: InstanceType = "x1.16xlarge"; -export let X1Instance32XLarge: InstanceType = "x1.32xlarge"; - -export class Instance extends lumi.NamedResource implements InstanceArgs { - public readonly imageId: string; - public readonly instanceType?: InstanceType; - public readonly securityGroups?: SecurityGroup[]; - public readonly keyName?: string; - public tags?: Tag[]; - public availabilityZone: string; - public privateDNSName?: string; - public publicDNSName?: string; - public privateIP?: string; - public publicIP?: string; - - public static get(id: lumi.ID): Instance { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Instance[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: InstanceArgs) { - super(name); - if (lumirt.defaultIfComputed(args.imageId, "") === undefined) { - throw new Error("Missing required argument 'imageId'"); - } - this.imageId = args.imageId; - this.instanceType = args.instanceType; - this.securityGroups = args.securityGroups; - this.keyName = args.keyName; - this.tags = args.tags; - } -} - -export interface InstanceArgs { - readonly imageId: string; - readonly instanceType?: InstanceType; - readonly securityGroups?: SecurityGroup[]; - readonly keyName?: string; - tags?: Tag[]; -} - -export type InstanceType = - "c3.2xlarge" | - "c3.4xlarge" | - "c3.8xlarge" | - "c3.large" | - "c3.xlarge" | - "c4.2xlarge" | - "c4.4xlarge" | - "c4.8xlarge" | - "c4.large" | - "c4.xlarge" | - "d2.2xlarge" | - "d2.4xlarge" | - "d2.8xlarge" | - "d2.xlarge" | - "f1.16xlarge" | - "f1.2xlarge" | - "g2.2xlarge" | - "g2.8xlarge" | - "i3.16xlarge" | - "i3.2xlarge" | - "i3.4xlarge" | - "i3.8xlarge" | - "i3.large" | - "i3.xlarge" | - "m3.2xlarge" | - "m3.large" | - "m3.medium" | - "m3.xlarge" | - "m4.10xlarge" | - "m4.16xlarge" | - "m4.2xlarge" | - "m4.4xlarge" | - "m4.large" | - "m4.xlarge" | - "p2.16xlarge" | - "p2.8xlarge" | - "p2.xlarge" | - "r3.2xlarge" | - "r3.4xlarge" | - "r3.8xlarge" | - "r3.large" | - "r3.xlarge" | - "r4.16xlarge" | - "r4.2xlarge" | - "r4.4xlarge" | - "r4.8xlarge" | - "r4.large" | - "r4.xlarge" | - "t2.2xlarge" | - "t2.large" | - "t2.medium" | - "t2.micro" | - "t2.nano" | - "t2.small" | - "t2.xlarge" | - "x1.16xlarge" | - "x1.32xlarge"; - -export interface Tag { - key: string; - value: string; -} - diff --git a/lib/aws/pack/ec2/instanceMaps.ts b/lib/aws/pack/ec2/instanceMaps.ts deleted file mode 100644 index 69a767569..000000000 --- a/lib/aws/pack/ec2/instanceMaps.ts +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -// This file defines some maps that correspond to the recommended AWS Marketplace values: -// http://docs.aws.amazon.com/servicecatalog/latest/adminguide/catalogs_marketplace-products.html -// Ultimately, this lets us choose a recommended Amazon Linux AMI; see: -// https://aws.amazon.com/amazon-linux-ami/instance-type-matrix/ - -import * as config from "../config"; - -// instanceTypeArch is a map of instance type to its architecture. -export let instanceTypeArch: { - [instanceType: string]: string, -} = { - "t1.micro" : "PV64" , - "t2.nano" : "HVM64", - "t2.micro" : "HVM64", - "t2.small" : "HVM64", - "t2.medium" : "HVM64", - "t2.large" : "HVM64", - "m1.small" : "PV64" , - "m1.medium" : "PV64" , - "m1.large" : "PV64" , - "m1.xlarge" : "PV64" , - "m2.xlarge" : "PV64" , - "m2.2xlarge" : "PV64" , - "m2.4xlarge" : "PV64" , - "m3.medium" : "HVM64", - "m3.large" : "HVM64", - "m3.xlarge" : "HVM64", - "m3.2xlarge" : "HVM64", - "m4.large" : "HVM64", - "m4.xlarge" : "HVM64", - "m4.2xlarge" : "HVM64", - "m4.4xlarge" : "HVM64", - "m4.10xlarge": "HVM64", - "c1.medium" : "PV64" , - "c1.xlarge" : "PV64" , - "c3.large" : "HVM64", - "c3.xlarge" : "HVM64", - "c3.2xlarge" : "HVM64", - "c3.4xlarge" : "HVM64", - "c3.8xlarge" : "HVM64", - "c4.large" : "HVM64", - "c4.xlarge" : "HVM64", - "c4.2xlarge" : "HVM64", - "c4.4xlarge" : "HVM64", - "c4.8xlarge" : "HVM64", - "g2.2xlarge" : "HVMG2", - "g2.8xlarge" : "HVMG2", - "r3.large" : "HVM64", - "r3.xlarge" : "HVM64", - "r3.2xlarge" : "HVM64", - "r3.4xlarge" : "HVM64", - "r3.8xlarge" : "HVM64", - "i2.xlarge" : "HVM64", - "i2.2xlarge" : "HVM64", - "i2.4xlarge" : "HVM64", - "i2.8xlarge" : "HVM64", - "d2.xlarge" : "HVM64", - "d2.2xlarge" : "HVM64", - "d2.4xlarge" : "HVM64", - "d2.8xlarge" : "HVM64", - "hi1.4xlarge": "HVM64", - "hs1.8xlarge": "HVM64", - "cr1.8xlarge": "HVM64", - "cc2.8xlarge": "HVM64", -}; - -// regionArchLinuxAMI is a map from region to inner maps from architecture to the recommended Linux AMI. -export let regionArchLinuxAMI: { - [region: string]: { [arch: string]: string; }, -} = { - "us-east-1": { - "PV64" : "ami-2a69aa47", - "HVM64": "ami-6869aa05", - "HVMG2": "ami-648d9973", - }, - "us-west-2": { - "PV64" : "ami-7f77b31f", - "HVM64": "ami-7172b611", - "HVMG2": "ami-09cd7a69", - }, - "us-west-1": { - "PV64" : "ami-a2490dc2", - "HVM64": "ami-31490d51", - "HVMG2": "ami-1e5f0e7e", - }, - "eu-west-1": { - "PV64" : "ami-4cdd453f", - "HVM64": "ami-f9dd458a", - "HVMG2": "ami-b4694ac7", - }, - "eu-west-2": { - "PV64" : "NOT_SUPPORTED", - "HVM64": "ami-886369ec", - "HVMG2": "NOT_SUPPORTED", - }, - "eu-central-1": { - "PV64" : "ami-6527cf0a", - "HVM64": "ami-ea26ce85", - "HVMG2": "ami-de5191b1", - }, - "ap-northeast-1": { - "PV64" : "ami-3e42b65f", - "HVM64": "ami-374db956", - "HVMG2": "ami-df9ff4b8", - }, - "ap-northeast-2": { - "PV64" : "NOT_SUPPORTED", - "HVM64": "ami-2b408b45", - "HVMG2": "NOT_SUPPORTED", - }, - "ap-southeast-1": { - "PV64" : "ami-df9e4cbc", - "HVM64": "ami-a59b49c6", - "HVMG2": "ami-8d8d23ee", - }, - "ap-southeast-2": { - "PV64" : "ami-63351d00", - "HVM64": "ami-dc361ebf", - "HVMG2": "ami-cbaf94a8", - }, - "ap-south-1": { - "PV64" : "NOT_SUPPORTED", - "HVM64": "ami-ffbdd790", - "HVMG2": "ami-decdbab1", - }, - "us-east-2": { - "PV64" : "NOT_SUPPORTED", - "HVM64": "ami-f6035893", - "HVMG2": "NOT_SUPPORTED", - }, - "ca-central-1": { - "PV64" : "NOT_SUPPORTED", - "HVM64": "ami-730ebd17", - "HVMG2": "NOT_SUPPORTED", - }, - "sa-east-1": { - "PV64" : "ami-1ad34676", - "HVM64": "ami-6dd04501", - "HVMG2": "NOT_SUPPORTED", - }, - "cn-north-1": { - "PV64" : "ami-77559f1a", - "HVM64": "ami-8e6aa0e3", - "HVMG2": "NOT_SUPPORTED", - }, -}; - -// getLinuxAMI gets the recommended Linux AMI for the given instance in the current AWS region. -export function getLinuxAMI(instanceType: string): string { - let region = config.requireRegion(); - let arch = instanceTypeArch[instanceType]; - return regionArchLinuxAMI[region][arch]; -} - diff --git a/lib/aws/pack/ec2/internetGateway.ts b/lib/aws/pack/ec2/internetGateway.ts deleted file mode 100644 index b0e29781e..000000000 --- a/lib/aws/pack/ec2/internetGateway.ts +++ /dev/null @@ -1,25 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export class InternetGateway extends lumi.NamedResource implements InternetGatewayArgs { - - public static get(id: lumi.ID): InternetGateway { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): InternetGateway[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: InternetGatewayArgs) { - super(name); - } -} - -export interface InternetGatewayArgs { -} - diff --git a/lib/aws/pack/ec2/route.ts b/lib/aws/pack/ec2/route.ts deleted file mode 100644 index 22eec1554..000000000 --- a/lib/aws/pack/ec2/route.ts +++ /dev/null @@ -1,53 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {InternetGateway} from "./internetGateway"; -import {RouteTable} from "./routeTable"; -import {VPCGatewayAttachment} from "./vpcGatewayAttachment"; - -export class Route extends lumi.NamedResource implements RouteArgs { - public readonly destinationCidrBlock: string; - public readonly routeTable: RouteTable; - public readonly internetGateway: InternetGateway; - public readonly vpcGatewayAttachment: VPCGatewayAttachment; - - public static get(id: lumi.ID): Route { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Route[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: RouteArgs) { - super(name); - if (lumirt.defaultIfComputed(args.destinationCidrBlock, "") === undefined) { - throw new Error("Missing required argument 'destinationCidrBlock'"); - } - this.destinationCidrBlock = args.destinationCidrBlock; - if (lumirt.defaultIfComputed(args.routeTable, "") === undefined) { - throw new Error("Missing required argument 'routeTable'"); - } - this.routeTable = args.routeTable; - if (lumirt.defaultIfComputed(args.internetGateway, "") === undefined) { - throw new Error("Missing required argument 'internetGateway'"); - } - this.internetGateway = args.internetGateway; - if (lumirt.defaultIfComputed(args.vpcGatewayAttachment, "") === undefined) { - throw new Error("Missing required argument 'vpcGatewayAttachment'"); - } - this.vpcGatewayAttachment = args.vpcGatewayAttachment; - } -} - -export interface RouteArgs { - readonly destinationCidrBlock: string; - readonly routeTable: RouteTable; - readonly internetGateway: InternetGateway; - readonly vpcGatewayAttachment: VPCGatewayAttachment; -} - diff --git a/lib/aws/pack/ec2/routeTable.ts b/lib/aws/pack/ec2/routeTable.ts deleted file mode 100644 index 7f48ac1f0..000000000 --- a/lib/aws/pack/ec2/routeTable.ts +++ /dev/null @@ -1,33 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {VPC} from "./vpc"; - -export class RouteTable extends lumi.NamedResource implements RouteTableArgs { - public readonly vpc: VPC; - - public static get(id: lumi.ID): RouteTable { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): RouteTable[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: RouteTableArgs) { - super(name); - if (lumirt.defaultIfComputed(args.vpc, "") === undefined) { - throw new Error("Missing required argument 'vpc'"); - } - this.vpc = args.vpc; - } -} - -export interface RouteTableArgs { - readonly vpc: VPC; -} - diff --git a/lib/aws/pack/ec2/securityGroup.ts b/lib/aws/pack/ec2/securityGroup.ts deleted file mode 100644 index 7349a6236..000000000 --- a/lib/aws/pack/ec2/securityGroup.ts +++ /dev/null @@ -1,53 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {VPC} from "./vpc"; - -export class SecurityGroup extends lumi.NamedResource implements SecurityGroupArgs { - public readonly groupDescription: string; - public readonly groupName?: string; - public readonly vpc?: VPC; - public securityGroupEgress?: SecurityGroupRule[]; - public securityGroupIngress?: SecurityGroupRule[]; - public groupID: string; - - public static get(id: lumi.ID): SecurityGroup { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): SecurityGroup[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: SecurityGroupArgs) { - super(name); - if (lumirt.defaultIfComputed(args.groupDescription, "") === undefined) { - throw new Error("Missing required argument 'groupDescription'"); - } - this.groupDescription = args.groupDescription; - this.groupName = args.groupName; - this.vpc = args.vpc; - this.securityGroupEgress = args.securityGroupEgress; - this.securityGroupIngress = args.securityGroupIngress; - } -} - -export interface SecurityGroupArgs { - readonly groupDescription: string; - readonly groupName?: string; - readonly vpc?: VPC; - securityGroupEgress?: SecurityGroupRule[]; - securityGroupIngress?: SecurityGroupRule[]; -} - -export interface SecurityGroupRule { - ipProtocol: string; - cidrIp?: string; - fromPort?: number; - toPort?: number; -} - diff --git a/lib/aws/pack/ec2/securityGroupEgress.ts b/lib/aws/pack/ec2/securityGroupEgress.ts deleted file mode 100644 index 72e5652a0..000000000 --- a/lib/aws/pack/ec2/securityGroupEgress.ts +++ /dev/null @@ -1,63 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {SecurityGroup} from "./securityGroup"; - -export class SecurityGroupEgress extends lumi.NamedResource implements SecurityGroupEgressArgs { - public readonly fromPort: number; - public readonly group: SecurityGroup; - public readonly ipProtocol: string; - public readonly toPort: number; - public readonly cidrIp?: string; - public readonly cidrIpv6?: string; - public readonly destinationPrefixListId?: string; - public readonly destinationSecurityGroup?: SecurityGroup; - - public static get(id: lumi.ID): SecurityGroupEgress { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): SecurityGroupEgress[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: SecurityGroupEgressArgs) { - super(name); - if (lumirt.defaultIfComputed(args.fromPort, "") === undefined) { - throw new Error("Missing required argument 'fromPort'"); - } - this.fromPort = args.fromPort; - if (lumirt.defaultIfComputed(args.group, "") === undefined) { - throw new Error("Missing required argument 'group'"); - } - this.group = args.group; - if (lumirt.defaultIfComputed(args.ipProtocol, "") === undefined) { - throw new Error("Missing required argument 'ipProtocol'"); - } - this.ipProtocol = args.ipProtocol; - if (lumirt.defaultIfComputed(args.toPort, "") === undefined) { - throw new Error("Missing required argument 'toPort'"); - } - this.toPort = args.toPort; - this.cidrIp = args.cidrIp; - this.cidrIpv6 = args.cidrIpv6; - this.destinationPrefixListId = args.destinationPrefixListId; - this.destinationSecurityGroup = args.destinationSecurityGroup; - } -} - -export interface SecurityGroupEgressArgs { - readonly fromPort: number; - readonly group: SecurityGroup; - readonly ipProtocol: string; - readonly toPort: number; - readonly cidrIp?: string; - readonly cidrIpv6?: string; - readonly destinationPrefixListId?: string; - readonly destinationSecurityGroup?: SecurityGroup; -} - diff --git a/lib/aws/pack/ec2/securityGroupIngress.ts b/lib/aws/pack/ec2/securityGroupIngress.ts deleted file mode 100644 index 1f13184f0..000000000 --- a/lib/aws/pack/ec2/securityGroupIngress.ts +++ /dev/null @@ -1,60 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {SecurityGroup} from "./securityGroup"; - -export class SecurityGroupIngress extends lumi.NamedResource implements SecurityGroupIngressArgs { - public readonly ipProtocol: string; - public readonly cidrIp?: string; - public readonly cidrIpv6?: string; - public readonly fromPort?: number; - public readonly group?: SecurityGroup; - public readonly groupName?: string; - public readonly sourceSecurityGroup?: SecurityGroup; - public readonly sourceSecurityGroupName?: string; - public readonly sourceSecurityGroupOwnerId?: string; - public readonly toPort?: number; - - public static get(id: lumi.ID): SecurityGroupIngress { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): SecurityGroupIngress[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: SecurityGroupIngressArgs) { - super(name); - if (lumirt.defaultIfComputed(args.ipProtocol, "") === undefined) { - throw new Error("Missing required argument 'ipProtocol'"); - } - this.ipProtocol = args.ipProtocol; - this.cidrIp = args.cidrIp; - this.cidrIpv6 = args.cidrIpv6; - this.fromPort = args.fromPort; - this.group = args.group; - this.groupName = args.groupName; - this.sourceSecurityGroup = args.sourceSecurityGroup; - this.sourceSecurityGroupName = args.sourceSecurityGroupName; - this.sourceSecurityGroupOwnerId = args.sourceSecurityGroupOwnerId; - this.toPort = args.toPort; - } -} - -export interface SecurityGroupIngressArgs { - readonly ipProtocol: string; - readonly cidrIp?: string; - readonly cidrIpv6?: string; - readonly fromPort?: number; - readonly group?: SecurityGroup; - readonly groupName?: string; - readonly sourceSecurityGroup?: SecurityGroup; - readonly sourceSecurityGroupName?: string; - readonly sourceSecurityGroupOwnerId?: string; - readonly toPort?: number; -} - diff --git a/lib/aws/pack/ec2/subnet.ts b/lib/aws/pack/ec2/subnet.ts deleted file mode 100644 index a17d58b06..000000000 --- a/lib/aws/pack/ec2/subnet.ts +++ /dev/null @@ -1,45 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {VPC} from "./vpc"; - -export class Subnet extends lumi.NamedResource implements SubnetArgs { - public readonly cidrBlock: string; - public readonly vpc: VPC; - public readonly availabilityZone?: string; - public mapPublicIpOnLaunch?: boolean; - - public static get(id: lumi.ID): Subnet { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Subnet[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: SubnetArgs) { - super(name); - if (lumirt.defaultIfComputed(args.cidrBlock, "") === undefined) { - throw new Error("Missing required argument 'cidrBlock'"); - } - this.cidrBlock = args.cidrBlock; - if (lumirt.defaultIfComputed(args.vpc, "") === undefined) { - throw new Error("Missing required argument 'vpc'"); - } - this.vpc = args.vpc; - this.availabilityZone = args.availabilityZone; - this.mapPublicIpOnLaunch = args.mapPublicIpOnLaunch; - } -} - -export interface SubnetArgs { - readonly cidrBlock: string; - readonly vpc: VPC; - readonly availabilityZone?: string; - mapPublicIpOnLaunch?: boolean; -} - diff --git a/lib/aws/pack/ec2/vpc.ts b/lib/aws/pack/ec2/vpc.ts deleted file mode 100644 index 866b656ab..000000000 --- a/lib/aws/pack/ec2/vpc.ts +++ /dev/null @@ -1,49 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export let DedicatedTenancy: InstanceTenancy = "dedicated"; -export let DefaultTenancy: InstanceTenancy = "default"; -export let HostTenancy: InstanceTenancy = "host"; - -export type InstanceTenancy = - "dedicated" | - "default" | - "host"; - -export class VPC extends lumi.NamedResource implements VPCArgs { - public readonly cidrBlock: string; - public readonly instanceTenancy?: InstanceTenancy; - public enableDnsSupport?: boolean; - public enableDnsHostnames?: boolean; - - public static get(id: lumi.ID): VPC { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): VPC[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: VPCArgs) { - super(name); - if (lumirt.defaultIfComputed(args.cidrBlock, "") === undefined) { - throw new Error("Missing required argument 'cidrBlock'"); - } - this.cidrBlock = args.cidrBlock; - this.instanceTenancy = args.instanceTenancy; - this.enableDnsSupport = args.enableDnsSupport; - this.enableDnsHostnames = args.enableDnsHostnames; - } -} - -export interface VPCArgs { - readonly cidrBlock: string; - readonly instanceTenancy?: InstanceTenancy; - enableDnsSupport?: boolean; - enableDnsHostnames?: boolean; -} - diff --git a/lib/aws/pack/ec2/vpcGatewayAttachment.ts b/lib/aws/pack/ec2/vpcGatewayAttachment.ts deleted file mode 100644 index e7db516a1..000000000 --- a/lib/aws/pack/ec2/vpcGatewayAttachment.ts +++ /dev/null @@ -1,40 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {InternetGateway} from "./internetGateway"; -import {VPC} from "./vpc"; - -export class VPCGatewayAttachment extends lumi.NamedResource implements VPCGatewayAttachmentArgs { - public readonly vpc: VPC; - public readonly internetGateway: InternetGateway; - - public static get(id: lumi.ID): VPCGatewayAttachment { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): VPCGatewayAttachment[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: VPCGatewayAttachmentArgs) { - super(name); - if (lumirt.defaultIfComputed(args.vpc, "") === undefined) { - throw new Error("Missing required argument 'vpc'"); - } - this.vpc = args.vpc; - if (lumirt.defaultIfComputed(args.internetGateway, "") === undefined) { - throw new Error("Missing required argument 'internetGateway'"); - } - this.internetGateway = args.internetGateway; - } -} - -export interface VPCGatewayAttachmentArgs { - readonly vpc: VPC; - readonly internetGateway: InternetGateway; -} - diff --git a/lib/aws/pack/ec2/vpcPeeringConnection.ts b/lib/aws/pack/ec2/vpcPeeringConnection.ts deleted file mode 100644 index e9557763d..000000000 --- a/lib/aws/pack/ec2/vpcPeeringConnection.ts +++ /dev/null @@ -1,39 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {VPC} from "./vpc"; - -export class VPCPeeringConnection extends lumi.NamedResource implements VPCPeeringConnectionArgs { - public readonly peerVpc: VPC; - public readonly vpc: VPC; - - public static get(id: lumi.ID): VPCPeeringConnection { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): VPCPeeringConnection[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: VPCPeeringConnectionArgs) { - super(name); - if (lumirt.defaultIfComputed(args.peerVpc, "") === undefined) { - throw new Error("Missing required argument 'peerVpc'"); - } - this.peerVpc = args.peerVpc; - if (lumirt.defaultIfComputed(args.vpc, "") === undefined) { - throw new Error("Missing required argument 'vpc'"); - } - this.vpc = args.vpc; - } -} - -export interface VPCPeeringConnectionArgs { - readonly peerVpc: VPC; - readonly vpc: VPC; -} - diff --git a/lib/aws/pack/elasticbeanstalk/application.ts b/lib/aws/pack/elasticbeanstalk/application.ts deleted file mode 100644 index a9d8602f1..000000000 --- a/lib/aws/pack/elasticbeanstalk/application.ts +++ /dev/null @@ -1,33 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export class Application extends lumi.NamedResource implements ApplicationArgs { - public readonly applicationName?: string; - public description?: string; - - public static get(id: lumi.ID): Application { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Application[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: ApplicationArgs) { - super(name); - if (args !== undefined) { - this.applicationName = args.applicationName; - this.description = args.description; - } - } -} - -export interface ApplicationArgs { - readonly applicationName?: string; - description?: string; -} - diff --git a/lib/aws/pack/elasticbeanstalk/applicationVersion.ts b/lib/aws/pack/elasticbeanstalk/applicationVersion.ts deleted file mode 100644 index e6d1f4eeb..000000000 --- a/lib/aws/pack/elasticbeanstalk/applicationVersion.ts +++ /dev/null @@ -1,46 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Application} from "./application"; -import {Object} from "../s3/object"; - -export class ApplicationVersion extends lumi.NamedResource implements ApplicationVersionArgs { - public readonly application: Application; - public readonly versionLabel?: string; - public description?: string; - public readonly sourceBundle: Object; - - public static get(id: lumi.ID): ApplicationVersion { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): ApplicationVersion[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: ApplicationVersionArgs) { - super(name); - if (lumirt.defaultIfComputed(args.application, "") === undefined) { - throw new Error("Missing required argument 'application'"); - } - this.application = args.application; - this.versionLabel = args.versionLabel; - this.description = args.description; - if (lumirt.defaultIfComputed(args.sourceBundle, "") === undefined) { - throw new Error("Missing required argument 'sourceBundle'"); - } - this.sourceBundle = args.sourceBundle; - } -} - -export interface ApplicationVersionArgs { - readonly application: Application; - readonly versionLabel?: string; - description?: string; - readonly sourceBundle: Object; -} - diff --git a/lib/aws/pack/elasticbeanstalk/environment.ts b/lib/aws/pack/elasticbeanstalk/environment.ts deleted file mode 100644 index 12c10d5d4..000000000 --- a/lib/aws/pack/elasticbeanstalk/environment.ts +++ /dev/null @@ -1,81 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Application} from "./application"; -import {ApplicationVersion} from "./applicationVersion"; - -export let WebServerTier: Tier = "WebServer::Standard::1.0"; -export let WorkerTier: Tier = "Worker::SQS/HTTP::1.0"; - -export class Environment extends lumi.NamedResource implements EnvironmentArgs { - public readonly application: Application; - public readonly cnamePrefix?: string; - public description?: string; - public readonly environmentName?: string; - public optionSettings?: OptionSetting[]; - public readonly solutionStackName?: string; - public readonly tags?: Tag[]; - public templateName?: string; - public readonly tier?: Tier; - public version?: ApplicationVersion; - public endpointURL: string; - public allOptionSettings: OptionSetting[]; - - public static get(id: lumi.ID): Environment { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Environment[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: EnvironmentArgs) { - super(name); - if (lumirt.defaultIfComputed(args.application, "") === undefined) { - throw new Error("Missing required argument 'application'"); - } - this.application = args.application; - this.cnamePrefix = args.cnamePrefix; - this.description = args.description; - this.environmentName = args.environmentName; - this.optionSettings = args.optionSettings; - this.solutionStackName = args.solutionStackName; - this.tags = args.tags; - this.templateName = args.templateName; - this.tier = args.tier; - this.version = args.version; - } -} - -export interface EnvironmentArgs { - readonly application: Application; - readonly cnamePrefix?: string; - description?: string; - readonly environmentName?: string; - optionSettings?: OptionSetting[]; - readonly solutionStackName?: string; - readonly tags?: Tag[]; - templateName?: string; - readonly tier?: Tier; - version?: ApplicationVersion; -} - -export interface OptionSetting { - namespace: string; - optionName: string; - value: string; -} - -export interface Tag { - key: string; - value: string; -} - -export type Tier = - "WebServer::Standard::1.0" | - "Worker::SQS/HTTP::1.0"; - diff --git a/lib/aws/pack/elasticbeanstalk/index.ts b/lib/aws/pack/elasticbeanstalk/index.ts deleted file mode 100644 index 15911076e..000000000 --- a/lib/aws/pack/elasticbeanstalk/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./application"; -export * from "./applicationVersion"; -export * from "./environment"; - diff --git a/lib/aws/pack/iam/awsmanagedpolicies.ts b/lib/aws/pack/iam/awsmanagedpolicies.ts deleted file mode 100644 index c472c16c6..000000000 --- a/lib/aws/pack/iam/awsmanagedpolicies.ts +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -/* tslint:disable:max-line-length ordered-imports variable-name */ -import {ARN} from "../types"; - -export const AWSAccountActivityAccess: ARN = "arn:aws:iam::aws:policy/AWSAccountActivityAccess"; -export const AWSAccountUsageReportAccess: ARN = "arn:aws:iam::aws:policy/AWSAccountUsageReportAccess"; -export const AWSAgentlessDiscoveryService: ARN = "arn:aws:iam::aws:policy/AWSAgentlessDiscoveryService"; -export const AWSApplicationDiscoveryAgentAccess: ARN = "arn:aws:iam::aws:policy/AWSApplicationDiscoveryAgentAccess"; -export const AWSApplicationDiscoveryServiceFullAccess: ARN = "arn:aws:iam::aws:policy/AWSApplicationDiscoveryServiceFullAccess"; -export const AWSBatchFullAccess: ARN = "arn:aws:iam::aws:policy/AWSBatchFullAccess"; -export const AWSBatchServiceRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSBatchServiceRole"; -export const AWSCertificateManagerFullAccess: ARN = "arn:aws:iam::aws:policy/AWSCertificateManagerFullAccess"; -export const AWSCertificateManagerReadOnly: ARN = "arn:aws:iam::aws:policy/AWSCertificateManagerReadOnly"; -export const AWSCloudFormationReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSCloudFormationReadOnlyAccess"; -export const AWSCloudHSMFullAccess: ARN = "arn:aws:iam::aws:policy/AWSCloudHSMFullAccess"; -export const AWSCloudHSMReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSCloudHSMReadOnlyAccess"; -export const AWSCloudHSMRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSCloudHSMRole"; -export const AWSCloudTrailFullAccess: ARN = "arn:aws:iam::aws:policy/AWSCloudTrailFullAccess"; -export const AWSCloudTrailReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSCloudTrailReadOnlyAccess"; -export const AWSCodeBuildAdminAccess: ARN = "arn:aws:iam::aws:policy/AWSCodeBuildAdminAccess"; -export const AWSCodeBuildDeveloperAccess: ARN = "arn:aws:iam::aws:policy/AWSCodeBuildDeveloperAccess"; -export const AWSCodeBuildReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSCodeBuildReadOnlyAccess"; -export const AWSCodeCommitFullAccess: ARN = "arn:aws:iam::aws:policy/AWSCodeCommitFullAccess"; -export const AWSCodeCommitPowerUser: ARN = "arn:aws:iam::aws:policy/AWSCodeCommitPowerUser"; -export const AWSCodeCommitReadOnly: ARN = "arn:aws:iam::aws:policy/AWSCodeCommitReadOnly"; -export const AWSCodeDeployDeployerAccess: ARN = "arn:aws:iam::aws:policy/AWSCodeDeployDeployerAccess"; -export const AWSCodeDeployFullAccess: ARN = "arn:aws:iam::aws:policy/AWSCodeDeployFullAccess"; -export const AWSCodeDeployReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSCodeDeployReadOnlyAccess"; -export const AWSCodeDeployRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSCodeDeployRole"; -export const AWSCodePipelineApproverAccess: ARN = "arn:aws:iam::aws:policy/AWSCodePipelineApproverAccess"; -export const AWSCodePipelineCustomActionAccess: ARN = "arn:aws:iam::aws:policy/AWSCodePipelineCustomActionAccess"; -export const AWSCodePipelineFullAccess: ARN = "arn:aws:iam::aws:policy/AWSCodePipelineFullAccess"; -export const AWSCodePipelineReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSCodePipelineReadOnlyAccess"; -export const AWSCodeStarFullAccess: ARN = "arn:aws:iam::aws:policy/AWSCodeStarFullAccess"; -export const AWSCodeStarServiceRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSCodeStarServiceRole"; -export const AWSConfigRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSConfigRole"; -export const AWSConfigRulesExecutionRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSConfigRulesExecutionRole"; -export const AWSConfigUserAccess: ARN = "arn:aws:iam::aws:policy/AWSConfigUserAccess"; -export const AWSConnector: ARN = "arn:aws:iam::aws:policy/AWSConnector"; -export const AWSDataPipelineRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSDataPipelineRole"; -export const AWSDataPipeline_FullAccess: ARN = "arn:aws:iam::aws:policy/AWSDataPipeline_FullAccess"; -export const AWSDataPipeline_PowerUser: ARN = "arn:aws:iam::aws:policy/AWSDataPipeline_PowerUser"; -export const AWSDeviceFarmFullAccess: ARN = "arn:aws:iam::aws:policy/AWSDeviceFarmFullAccess"; -export const AWSDirectConnectFullAccess: ARN = "arn:aws:iam::aws:policy/AWSDirectConnectFullAccess"; -export const AWSDirectConnectReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSDirectConnectReadOnlyAccess"; -export const AWSDirectoryServiceFullAccess: ARN = "arn:aws:iam::aws:policy/AWSDirectoryServiceFullAccess"; -export const AWSDirectoryServiceReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSDirectoryServiceReadOnlyAccess"; -export const AWSElasticBeanstalkCustomPlatformforEC2Role: ARN = "arn:aws:iam::aws:policy/AWSElasticBeanstalkCustomPlatformforEC2Role"; -export const AWSElasticBeanstalkEnhancedHealth: ARN = "arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth"; -export const AWSElasticBeanstalkFullAccess: ARN = "arn:aws:iam::aws:policy/AWSElasticBeanstalkFullAccess"; -export const AWSElasticBeanstalkMulticontainerDocker: ARN = "arn:aws:iam::aws:policy/AWSElasticBeanstalkMulticontainerDocker"; -export const AWSElasticBeanstalkReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSElasticBeanstalkReadOnlyAccess"; -export const AWSElasticBeanstalkService: ARN = "arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkService"; -export const AWSElasticBeanstalkWebTier: ARN = "arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier"; -export const AWSElasticBeanstalkWorkerTier: ARN = "arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier"; -export const AWSGreengrassFullAccess: ARN = "arn:aws:iam::aws:policy/AWSGreengrassFullAccess"; -export const AWSGreengrassResourceAccessRolePolicy: ARN = "arn:aws:iam::aws:policy/service-role/AWSGreengrassResourceAccessRolePolicy"; -export const AWSHealthFullAccess: ARN = "arn:aws:iam::aws:policy/AWSHealthFullAccess"; -export const AWSImportExportFullAccess: ARN = "arn:aws:iam::aws:policy/AWSImportExportFullAccess"; -export const AWSImportExportReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSImportExportReadOnlyAccess"; -export const AWSIoTConfigAccess: ARN = "arn:aws:iam::aws:policy/AWSIoTConfigAccess"; -export const AWSIoTConfigReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSIoTConfigReadOnlyAccess"; -export const AWSIoTDataAccess: ARN = "arn:aws:iam::aws:policy/AWSIoTDataAccess"; -export const AWSIoTFullAccess: ARN = "arn:aws:iam::aws:policy/AWSIoTFullAccess"; -export const AWSIoTLogging: ARN = "arn:aws:iam::aws:policy/service-role/AWSIoTLogging"; -export const AWSIoTRuleActions: ARN = "arn:aws:iam::aws:policy/service-role/AWSIoTRuleActions"; -export const AWSKeyManagementServicePowerUser: ARN = "arn:aws:iam::aws:policy/AWSKeyManagementServicePowerUser"; -export const AWSLambdaBasicExecutionRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"; -export const AWSLambdaDynamoDBExecutionRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole"; -export const AWSLambdaENIManagementAccess: ARN = "arn:aws:iam::aws:policy/service-role/AWSLambdaENIManagementAccess"; -export const AWSLambdaExecute: ARN = "arn:aws:iam::aws:policy/AWSLambdaExecute"; -export const AWSLambdaFullAccess: ARN = "arn:aws:iam::aws:policy/AWSLambdaFullAccess"; -export const AWSLambdaInvocationDynamoDB: ARN = "arn:aws:iam::aws:policy/AWSLambdaInvocation-DynamoDB"; -export const AWSLambdaKinesisExecutionRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole"; -export const AWSLambdaReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSLambdaReadOnlyAccess"; -export const AWSLambdaRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSLambdaRole"; -export const AWSLambdaVPCAccessExecutionRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"; -export const AWSMarketplaceFullAccess: ARN = "arn:aws:iam::aws:policy/AWSMarketplaceFullAccess"; -export const AWSMarketplaceGetEntitlements: ARN = "arn:aws:iam::aws:policy/AWSMarketplaceGetEntitlements"; -export const AWSMarketplaceManageSubscriptions: ARN = "arn:aws:iam::aws:policy/AWSMarketplaceManageSubscriptions"; -export const AWSMarketplaceMeteringFullAccess: ARN = "arn:aws:iam::aws:policy/AWSMarketplaceMeteringFullAccess"; -export const AWSMarketplaceReadonly: ARN = "arn:aws:iam::aws:policy/AWSMarketplaceRead-only"; -export const AWSMobileHub_FullAccess: ARN = "arn:aws:iam::aws:policy/AWSMobileHub_FullAccess"; -export const AWSMobileHub_ReadOnly: ARN = "arn:aws:iam::aws:policy/AWSMobileHub_ReadOnly"; -export const AWSMobileHub_ServiceUseOnly: ARN = "arn:aws:iam::aws:policy/service-role/AWSMobileHub_ServiceUseOnly"; -export const AWSOpsWorksCMInstanceProfileRole: ARN = "arn:aws:iam::aws:policy/AWSOpsWorksCMInstanceProfileRole"; -export const AWSOpsWorksCMServiceRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSOpsWorksCMServiceRole"; -export const AWSOpsWorksCloudWatchLogs: ARN = "arn:aws:iam::aws:policy/AWSOpsWorksCloudWatchLogs"; -export const AWSOpsWorksFullAccess: ARN = "arn:aws:iam::aws:policy/AWSOpsWorksFullAccess"; -export const AWSOpsWorksInstanceRegistration: ARN = "arn:aws:iam::aws:policy/AWSOpsWorksInstanceRegistration"; -export const AWSOpsWorksRegisterCLI: ARN = "arn:aws:iam::aws:policy/AWSOpsWorksRegisterCLI"; -export const AWSOpsWorksRole: ARN = "arn:aws:iam::aws:policy/service-role/AWSOpsWorksRole"; -export const AWSQuickSightDescribeRDS: ARN = "arn:aws:iam::aws:policy/service-role/AWSQuickSightDescribeRDS"; -export const AWSQuickSightDescribeRedshift: ARN = "arn:aws:iam::aws:policy/service-role/AWSQuickSightDescribeRedshift"; -export const AWSQuickSightListIAM: ARN = "arn:aws:iam::aws:policy/service-role/AWSQuickSightListIAM"; -export const AWSQuicksightAthenaAccess: ARN = "arn:aws:iam::aws:policy/service-role/AWSQuicksightAthenaAccess"; -export const AWSStepFunctionsConsoleFullAccess: ARN = "arn:aws:iam::aws:policy/AWSStepFunctionsConsoleFullAccess"; -export const AWSStepFunctionsFullAccess: ARN = "arn:aws:iam::aws:policy/AWSStepFunctionsFullAccess"; -export const AWSStepFunctionsReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSStepFunctionsReadOnlyAccess"; -export const AWSStorageGatewayFullAccess: ARN = "arn:aws:iam::aws:policy/AWSStorageGatewayFullAccess"; -export const AWSStorageGatewayReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSStorageGatewayReadOnlyAccess"; -export const AWSSupportAccess: ARN = "arn:aws:iam::aws:policy/AWSSupportAccess"; -export const AWSWAFFullAccess: ARN = "arn:aws:iam::aws:policy/AWSWAFFullAccess"; -export const AWSWAFReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSWAFReadOnlyAccess"; -export const AWSXrayFullAccess: ARN = "arn:aws:iam::aws:policy/AWSXrayFullAccess"; -export const AWSXrayReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSXrayReadOnlyAccess"; -export const AWSXrayWriteOnlyAccess: ARN = "arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess"; -export const AdministratorAccess: ARN = "arn:aws:iam::aws:policy/AdministratorAccess"; -export const AmazonAPIGatewayAdministrator: ARN = "arn:aws:iam::aws:policy/AmazonAPIGatewayAdministrator"; -export const AmazonAPIGatewayInvokeFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonAPIGatewayInvokeFullAccess"; -export const AmazonAPIGatewayPushToCloudWatchLogs: ARN = "arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"; -export const AmazonAppStreamFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonAppStreamFullAccess"; -export const AmazonAppStreamReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonAppStreamReadOnlyAccess"; -export const AmazonAppStreamServiceAccess: ARN = "arn:aws:iam::aws:policy/service-role/AmazonAppStreamServiceAccess"; -export const AmazonAthenaFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonAthenaFullAccess"; -export const AmazonCloudDirectoryFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonCloudDirectoryFullAccess"; -export const AmazonCloudDirectoryReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonCloudDirectoryReadOnlyAccess"; -export const AmazonCognitoDeveloperAuthenticatedIdentities: ARN = "arn:aws:iam::aws:policy/AmazonCognitoDeveloperAuthenticatedIdentities"; -export const AmazonCognitoPowerUser: ARN = "arn:aws:iam::aws:policy/AmazonCognitoPowerUser"; -export const AmazonCognitoReadOnly: ARN = "arn:aws:iam::aws:policy/AmazonCognitoReadOnly"; -export const AmazonDMSCloudWatchLogsRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonDMSCloudWatchLogsRole"; -export const AmazonDMSRedshiftS3Role: ARN = "arn:aws:iam::aws:policy/service-role/AmazonDMSRedshiftS3Role"; -export const AmazonDMSVPCManagementRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole"; -export const AmazonDRSVPCManagement: ARN = "arn:aws:iam::aws:policy/AmazonDRSVPCManagement"; -export const AmazonDynamoDBFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess"; -export const AmazonDynamoDBFullAccesswithDataPipeline: ARN = "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccesswithDataPipeline"; -export const AmazonDynamoDBReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonDynamoDBReadOnlyAccess"; -export const AmazonEC2ContainerRegistryFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryFullAccess"; -export const AmazonEC2ContainerRegistryPowerUser: ARN = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryPowerUser"; -export const AmazonEC2ContainerRegistryReadOnly: ARN = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"; -export const AmazonEC2ContainerServiceAutoscaleRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceAutoscaleRole"; -export const AmazonEC2ContainerServiceFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonEC2ContainerServiceFullAccess"; -export const AmazonEC2ContainerServiceRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceRole"; -export const AmazonEC2ContainerServiceforEC2Role: ARN = "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"; -export const AmazonEC2FullAccess: ARN = "arn:aws:iam::aws:policy/AmazonEC2FullAccess"; -export const AmazonEC2ReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess"; -export const AmazonEC2ReportsAccess: ARN = "arn:aws:iam::aws:policy/AmazonEC2ReportsAccess"; -export const AmazonEC2RoleforAWSCodeDeploy: ARN = "arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforAWSCodeDeploy"; -export const AmazonEC2RoleforDataPipelineRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforDataPipelineRole"; -export const AmazonEC2RoleforSSM: ARN = "arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM"; -export const AmazonEC2SpotFleetAutoscaleRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonEC2SpotFleetAutoscaleRole"; -export const AmazonEC2SpotFleetRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonEC2SpotFleetRole"; -export const AmazonESFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonESFullAccess"; -export const AmazonESReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonESReadOnlyAccess"; -export const AmazonElastiCacheFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonElastiCacheFullAccess"; -export const AmazonElastiCacheReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonElastiCacheReadOnlyAccess"; -export const AmazonElasticFileSystemFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonElasticFileSystemFullAccess"; -export const AmazonElasticFileSystemReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonElasticFileSystemReadOnlyAccess"; -export const AmazonElasticMapReduceFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonElasticMapReduceFullAccess"; -export const AmazonElasticMapReduceReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonElasticMapReduceReadOnlyAccess"; -export const AmazonElasticMapReduceRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceRole"; -export const AmazonElasticMapReduceforAutoScalingRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceforAutoScalingRole"; -export const AmazonElasticMapReduceforEC2Role: ARN = "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceforEC2Role"; -export const AmazonElasticTranscoderFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonElasticTranscoderFullAccess"; -export const AmazonElasticTranscoderJobsSubmitter: ARN = "arn:aws:iam::aws:policy/AmazonElasticTranscoderJobsSubmitter"; -export const AmazonElasticTranscoderReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonElasticTranscoderReadOnlyAccess"; -export const AmazonElasticTranscoderRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonElasticTranscoderRole"; -export const AmazonGlacierFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonGlacierFullAccess"; -export const AmazonGlacierReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonGlacierReadOnlyAccess"; -export const AmazonInspectorFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonInspectorFullAccess"; -export const AmazonInspectorReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonInspectorReadOnlyAccess"; -export const AmazonKinesisAnalyticsFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonKinesisAnalyticsFullAccess"; -export const AmazonKinesisAnalyticsReadOnly: ARN = "arn:aws:iam::aws:policy/AmazonKinesisAnalyticsReadOnly"; -export const AmazonKinesisFirehoseFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonKinesisFirehoseFullAccess"; -export const AmazonKinesisFirehoseReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonKinesisFirehoseReadOnlyAccess"; -export const AmazonKinesisFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonKinesisFullAccess"; -export const AmazonKinesisReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonKinesisReadOnlyAccess"; -export const AmazonLexFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonLexFullAccess"; -export const AmazonLexReadOnly: ARN = "arn:aws:iam::aws:policy/AmazonLexReadOnly"; -export const AmazonLexRunBotsOnly: ARN = "arn:aws:iam::aws:policy/AmazonLexRunBotsOnly"; -export const AmazonMachineLearningBatchPredictionsAccess: ARN = "arn:aws:iam::aws:policy/AmazonMachineLearningBatchPredictionsAccess"; -export const AmazonMachineLearningCreateOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonMachineLearningCreateOnlyAccess"; -export const AmazonMachineLearningFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonMachineLearningFullAccess"; -export const AmazonMachineLearningManageRealTimeEndpointOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonMachineLearningManageRealTimeEndpointOnlyAccess"; -export const AmazonMachineLearningReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonMachineLearningReadOnlyAccess"; -export const AmazonMachineLearningRealTimePredictionOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonMachineLearningRealTimePredictionOnlyAccess"; -export const AmazonMachineLearningRoleforRedshiftDataSource: ARN = "arn:aws:iam::aws:policy/service-role/AmazonMachineLearningRoleforRedshiftDataSource"; -export const AmazonMechanicalTurkFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonMechanicalTurkFullAccess"; -export const AmazonMechanicalTurkReadOnly: ARN = "arn:aws:iam::aws:policy/AmazonMechanicalTurkReadOnly"; -export const AmazonMobileAnalyticsFinancialReportAccess: ARN = "arn:aws:iam::aws:policy/AmazonMobileAnalyticsFinancialReportAccess"; -export const AmazonMobileAnalyticsFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonMobileAnalyticsFullAccess"; -export const AmazonMobileAnalyticsNonfinancialReportAccess: ARN = "arn:aws:iam::aws:policy/AmazonMobileAnalyticsNon-financialReportAccess"; -export const AmazonMobileAnalyticsWriteOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonMobileAnalyticsWriteOnlyAccess"; -export const AmazonPollyFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonPollyFullAccess"; -export const AmazonPollyReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonPollyReadOnlyAccess"; -export const AmazonRDSDirectoryServiceAccess: ARN = "arn:aws:iam::aws:policy/service-role/AmazonRDSDirectoryServiceAccess"; -export const AmazonRDSEnhancedMonitoringRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole"; -export const AmazonRDSFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonRDSFullAccess"; -export const AmazonRDSReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonRDSReadOnlyAccess"; -export const AmazonRedshiftFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonRedshiftFullAccess"; -export const AmazonRedshiftReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonRedshiftReadOnlyAccess"; -export const AmazonRekognitionFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonRekognitionFullAccess"; -export const AmazonRekognitionReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonRekognitionReadOnlyAccess"; -export const AmazonRoute53DomainsFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonRoute53DomainsFullAccess"; -export const AmazonRoute53DomainsReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonRoute53DomainsReadOnlyAccess"; -export const AmazonRoute53FullAccess: ARN = "arn:aws:iam::aws:policy/AmazonRoute53FullAccess"; -export const AmazonRoute53ReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonRoute53ReadOnlyAccess"; -export const AmazonS3FullAccess: ARN = "arn:aws:iam::aws:policy/AmazonS3FullAccess"; -export const AmazonS3ReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess"; -export const AmazonSESFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonSESFullAccess"; -export const AmazonSESReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonSESReadOnlyAccess"; -export const AmazonSNSFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonSNSFullAccess"; -export const AmazonSNSReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonSNSReadOnlyAccess"; -export const AmazonSNSRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonSNSRole"; -export const AmazonSQSFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonSQSFullAccess"; -export const AmazonSQSReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonSQSReadOnlyAccess"; -export const AmazonSSMAutomationRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonSSMAutomationRole"; -export const AmazonSSMFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonSSMFullAccess"; -export const AmazonSSMMaintenanceWindowRole: ARN = "arn:aws:iam::aws:policy/service-role/AmazonSSMMaintenanceWindowRole"; -export const AmazonSSMReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess"; -export const AmazonVPCFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonVPCFullAccess"; -export const AmazonVPCReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonVPCReadOnlyAccess"; -export const AmazonWorkMailFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonWorkMailFullAccess"; -export const AmazonWorkMailReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonWorkMailReadOnlyAccess"; -export const AmazonWorkSpacesAdmin: ARN = "arn:aws:iam::aws:policy/AmazonWorkSpacesAdmin"; -export const AmazonWorkSpacesApplicationManagerAdminAccess: ARN = "arn:aws:iam::aws:policy/AmazonWorkSpacesApplicationManagerAdminAccess"; -export const AmazonZocaloFullAccess: ARN = "arn:aws:iam::aws:policy/AmazonZocaloFullAccess"; -export const AmazonZocaloReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AmazonZocaloReadOnlyAccess"; -export const ApplicationAutoScalingForAmazonAppStreamAccess: ARN = "arn:aws:iam::aws:policy/service-role/ApplicationAutoScalingForAmazonAppStreamAccess"; -export const AutoScalingConsoleFullAccess: ARN = "arn:aws:iam::aws:policy/AutoScalingConsoleFullAccess"; -export const AutoScalingConsoleReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AutoScalingConsoleReadOnlyAccess"; -export const AutoScalingFullAccess: ARN = "arn:aws:iam::aws:policy/AutoScalingFullAccess"; -export const AutoScalingNotificationAccessRole: ARN = "arn:aws:iam::aws:policy/service-role/AutoScalingNotificationAccessRole"; -export const AutoScalingReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/AutoScalingReadOnlyAccess"; -export const Billing: ARN = "arn:aws:iam::aws:policy/job-function/Billing"; -export const CloudFrontFullAccess: ARN = "arn:aws:iam::aws:policy/CloudFrontFullAccess"; -export const CloudFrontReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/CloudFrontReadOnlyAccess"; -export const CloudSearchFullAccess: ARN = "arn:aws:iam::aws:policy/CloudSearchFullAccess"; -export const CloudSearchReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/CloudSearchReadOnlyAccess"; -export const CloudWatchActionsEC2Access: ARN = "arn:aws:iam::aws:policy/CloudWatchActionsEC2Access"; -export const CloudWatchEventsBuiltInTargetExecutionAccess: ARN = "arn:aws:iam::aws:policy/service-role/CloudWatchEventsBuiltInTargetExecutionAccess"; -export const CloudWatchEventsFullAccess: ARN = "arn:aws:iam::aws:policy/CloudWatchEventsFullAccess"; -export const CloudWatchEventsInvocationAccess: ARN = "arn:aws:iam::aws:policy/service-role/CloudWatchEventsInvocationAccess"; -export const CloudWatchEventsReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/CloudWatchEventsReadOnlyAccess"; -export const CloudWatchFullAccess: ARN = "arn:aws:iam::aws:policy/CloudWatchFullAccess"; -export const CloudWatchLogsFullAccess: ARN = "arn:aws:iam::aws:policy/CloudWatchLogsFullAccess"; -export const CloudWatchLogsReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/CloudWatchLogsReadOnlyAccess"; -export const CloudWatchReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/CloudWatchReadOnlyAccess"; -export const DataScientist: ARN = "arn:aws:iam::aws:policy/job-function/DataScientist"; -export const DatabaseAdministrator: ARN = "arn:aws:iam::aws:policy/job-function/DatabaseAdministrator"; -export const IAMFullAccess: ARN = "arn:aws:iam::aws:policy/IAMFullAccess"; -export const IAMReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/IAMReadOnlyAccess"; -export const IAMSelfManageServiceSpecificCredentials: ARN = "arn:aws:iam::aws:policy/IAMSelfManageServiceSpecificCredentials"; -export const IAMUserChangePassword: ARN = "arn:aws:iam::aws:policy/IAMUserChangePassword"; -export const IAMUserSSHKeys: ARN = "arn:aws:iam::aws:policy/IAMUserSSHKeys"; -export const NetworkAdministrator: ARN = "arn:aws:iam::aws:policy/job-function/NetworkAdministrator"; -export const PowerUserAccess: ARN = "arn:aws:iam::aws:policy/PowerUserAccess"; -export const RDSCloudHsmAuthorizationRole: ARN = "arn:aws:iam::aws:policy/service-role/RDSCloudHsmAuthorizationRole"; -export const ReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/ReadOnlyAccess"; -export const ResourceGroupsandTagEditorFullAccess: ARN = "arn:aws:iam::aws:policy/ResourceGroupsandTagEditorFullAccess"; -export const ResourceGroupsandTagEditorReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/ResourceGroupsandTagEditorReadOnlyAccess"; -export const SecurityAudit: ARN = "arn:aws:iam::aws:policy/SecurityAudit"; -export const ServerMigrationConnector: ARN = "arn:aws:iam::aws:policy/ServerMigrationConnector"; -export const ServerMigrationServiceRole: ARN = "arn:aws:iam::aws:policy/service-role/ServerMigrationServiceRole"; -export const ServiceCatalogAdminFullAccess: ARN = "arn:aws:iam::aws:policy/ServiceCatalogAdminFullAccess"; -export const ServiceCatalogAdminReadOnlyAccess: ARN = "arn:aws:iam::aws:policy/ServiceCatalogAdminReadOnlyAccess"; -export const ServiceCatalogEndUserAccess: ARN = "arn:aws:iam::aws:policy/ServiceCatalogEndUserAccess"; -export const ServiceCatalogEndUserFullAccess: ARN = "arn:aws:iam::aws:policy/ServiceCatalogEndUserFullAccess"; -export const SimpleWorkflowFullAccess: ARN = "arn:aws:iam::aws:policy/SimpleWorkflowFullAccess"; -export const SupportUser: ARN = "arn:aws:iam::aws:policy/job-function/SupportUser"; -export const SystemAdministrator: ARN = "arn:aws:iam::aws:policy/job-function/SystemAdministrator"; -export const VMImportExportRoleForAWSConnector: ARN = "arn:aws:iam::aws:policy/service-role/VMImportExportRoleForAWSConnector"; -export const ViewOnlyAccess: ARN = "arn:aws:iam::aws:policy/job-function/ViewOnlyAccess"; diff --git a/lib/aws/pack/iam/group.ts b/lib/aws/pack/iam/group.ts deleted file mode 100644 index d11075e03..000000000 --- a/lib/aws/pack/iam/group.ts +++ /dev/null @@ -1,41 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {InlinePolicy, Policy} from "./policy"; - -export class Group extends lumi.NamedResource implements GroupArgs { - public readonly groupName?: string; - public managedPolicies?: Policy[]; - public path?: string; - public policies?: InlinePolicy; - - public static get(id: lumi.ID): Group { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Group[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: GroupArgs) { - super(name); - if (args !== undefined) { - this.groupName = args.groupName; - this.managedPolicies = args.managedPolicies; - this.path = args.path; - this.policies = args.policies; - } - } -} - -export interface GroupArgs { - readonly groupName?: string; - managedPolicies?: Policy[]; - path?: string; - policies?: InlinePolicy; -} - diff --git a/lib/aws/pack/iam/index.ts b/lib/aws/pack/iam/index.ts deleted file mode 100644 index 0a6d99336..000000000 --- a/lib/aws/pack/iam/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./awsmanagedpolicies"; -export * from "./group"; -export * from "./instanceprofile"; -export * from "./policy"; -export * from "./role"; -export * from "./user"; - diff --git a/lib/aws/pack/iam/instanceprofile.ts b/lib/aws/pack/iam/instanceprofile.ts deleted file mode 100644 index 6d3a5268e..000000000 --- a/lib/aws/pack/iam/instanceprofile.ts +++ /dev/null @@ -1,41 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {ARN} from "../types"; -import {Role} from "./role"; - -export class InstanceProfile extends lumi.NamedResource implements InstanceProfileArgs { - public readonly path?: string; - public readonly instanceProfileName?: string; - public roles: Role[]; - public arn: ARN; - - public static get(id: lumi.ID): InstanceProfile { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): InstanceProfile[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: InstanceProfileArgs) { - super(name); - this.path = args.path; - this.instanceProfileName = args.instanceProfileName; - if (lumirt.defaultIfComputed(args.roles, "") === undefined) { - throw new Error("Missing required argument 'roles'"); - } - this.roles = args.roles; - } -} - -export interface InstanceProfileArgs { - readonly path?: string; - readonly instanceProfileName?: string; - roles: Role[]; -} - diff --git a/lib/aws/pack/iam/policy.ts b/lib/aws/pack/iam/policy.ts deleted file mode 100644 index dcda50e7b..000000000 --- a/lib/aws/pack/iam/policy.ts +++ /dev/null @@ -1,55 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Group} from "./group"; -import {Role} from "./role"; -import {User} from "./user"; - -export interface InlinePolicy { - policyDocument: any; - policyName: string; -} - -export class Policy extends lumi.NamedResource implements PolicyArgs { - public policyDocument: any; - public policyName: string; - public groups?: Group[]; - public roles?: Role[]; - public users?: User[]; - - public static get(id: lumi.ID): Policy { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Policy[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: PolicyArgs) { - super(name); - if (lumirt.defaultIfComputed(args.policyDocument, "") === undefined) { - throw new Error("Missing required argument 'policyDocument'"); - } - this.policyDocument = args.policyDocument; - if (lumirt.defaultIfComputed(args.policyName, "") === undefined) { - throw new Error("Missing required argument 'policyName'"); - } - this.policyName = args.policyName; - this.groups = args.groups; - this.roles = args.roles; - this.users = args.users; - } -} - -export interface PolicyArgs { - policyDocument: any; - policyName: string; - groups?: Group[]; - roles?: Role[]; - users?: User[]; -} - diff --git a/lib/aws/pack/iam/role.ts b/lib/aws/pack/iam/role.ts deleted file mode 100644 index 2e2168f0a..000000000 --- a/lib/aws/pack/iam/role.ts +++ /dev/null @@ -1,47 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {ARN} from "../types"; -import {InlinePolicy} from "./policy"; - -export class Role extends lumi.NamedResource implements RoleArgs { - public assumeRolePolicyDocument: any; - public readonly path?: string; - public readonly roleName?: string; - public managedPolicyARNs?: ARN[]; - public policies?: InlinePolicy[]; - public arn: ARN; - - public static get(id: lumi.ID): Role { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Role[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: RoleArgs) { - super(name); - if (lumirt.defaultIfComputed(args.assumeRolePolicyDocument, "") === undefined) { - throw new Error("Missing required argument 'assumeRolePolicyDocument'"); - } - this.assumeRolePolicyDocument = args.assumeRolePolicyDocument; - this.path = args.path; - this.roleName = args.roleName; - this.managedPolicyARNs = args.managedPolicyARNs; - this.policies = args.policies; - } -} - -export interface RoleArgs { - assumeRolePolicyDocument: any; - readonly path?: string; - readonly roleName?: string; - managedPolicyARNs?: ARN[]; - policies?: InlinePolicy[]; -} - diff --git a/lib/aws/pack/iam/user.ts b/lib/aws/pack/iam/user.ts deleted file mode 100644 index 1eacb336b..000000000 --- a/lib/aws/pack/iam/user.ts +++ /dev/null @@ -1,53 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Group} from "./group"; -import {InlinePolicy, Policy} from "./policy"; - -export interface LoginProfile { - password: string; - passwordResetRequired?: boolean; -} - -export class User extends lumi.NamedResource implements UserArgs { - public readonly userName?: string; - public groups?: Group[]; - public loginProfile?: LoginProfile; - public managedPolicies?: Policy[]; - public path?: string; - public policies?: InlinePolicy[]; - - public static get(id: lumi.ID): User { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): User[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: UserArgs) { - super(name); - if (args !== undefined) { - this.userName = args.userName; - this.groups = args.groups; - this.loginProfile = args.loginProfile; - this.managedPolicies = args.managedPolicies; - this.path = args.path; - this.policies = args.policies; - } - } -} - -export interface UserArgs { - readonly userName?: string; - groups?: Group[]; - loginProfile?: LoginProfile; - managedPolicies?: Policy[]; - path?: string; - policies?: InlinePolicy[]; -} - diff --git a/lib/aws/pack/index.ts b/lib/aws/pack/index.ts deleted file mode 100644 index 565e7a355..000000000 --- a/lib/aws/pack/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./types"; - -import * as apigateway from "./apigateway"; -import * as cloudwatch from "./cloudwatch"; -import * as config from "./config"; -import * as dynamodb from "./dynamodb"; -import * as ec2 from "./ec2"; -import * as elasticbeanstalk from "./elasticbeanstalk"; -import * as iam from "./iam"; -import * as kms from "./kms"; -import * as lambda from "./lambda"; -import * as s3 from "./s3"; -import * as serverless from "./serverless"; -import * as sns from "./sns"; -import * as sqs from "./sqs"; -export {apigateway, cloudwatch, config, dynamodb, ec2, elasticbeanstalk, iam, kms, lambda, s3, serverless, sns, sqs}; - diff --git a/lib/aws/pack/kms/index.ts b/lib/aws/pack/kms/index.ts deleted file mode 100644 index 7cee1ffbb..000000000 --- a/lib/aws/pack/kms/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./key"; - diff --git a/lib/aws/pack/kms/key.ts b/lib/aws/pack/kms/key.ts deleted file mode 100644 index 5cac1e5b4..000000000 --- a/lib/aws/pack/kms/key.ts +++ /dev/null @@ -1,40 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export class Key extends lumi.NamedResource implements KeyArgs { - public keyPolicy: any; - public description?: string; - public enabled?: boolean; - public enableKeyRotation?: boolean; - - public static get(id: lumi.ID): Key { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Key[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: KeyArgs) { - super(name); - if (lumirt.defaultIfComputed(args.keyPolicy, "") === undefined) { - throw new Error("Missing required argument 'keyPolicy'"); - } - this.keyPolicy = args.keyPolicy; - this.description = args.description; - this.enabled = args.enabled; - this.enableKeyRotation = args.enableKeyRotation; - } -} - -export interface KeyArgs { - keyPolicy: any; - description?: string; - enabled?: boolean; - enableKeyRotation?: boolean; -} - diff --git a/lib/aws/pack/lambda/function.ts b/lib/aws/pack/lambda/function.ts deleted file mode 100644 index 91bac4a70..000000000 --- a/lib/aws/pack/lambda/function.ts +++ /dev/null @@ -1,111 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {ARN} from "../types"; -import {SecurityGroup} from "../ec2/securityGroup"; -import {Subnet} from "../ec2/subnet"; -import {Role} from "../iam/role"; -import {Key} from "../kms/key"; - -export let DotnetCore1d0Runtime: Runtime = "dotnetcore1.0"; -export let Java8Runtime: Runtime = "java8"; -export let NodeJS4d3EdgeRuntime: Runtime = "nodejs4.3-edge"; -export let NodeJS4d3Runtime: Runtime = "nodejs4.3"; -export let NodeJS6d10Runtime: Runtime = "nodejs6.10"; -export let NodeJSRuntime: Runtime = "nodejs"; -export let Python2d7Runtime: Runtime = "python2.7"; - -export interface DeadLetterConfig { - target: lumi.Resource; -} - -export type Environment = {[key: string]: string}; - -export class Function extends lumi.NamedResource implements FunctionArgs { - public code: lumi.asset.Archive; - public handler: string; - public role: Role; - public runtime: Runtime; - public functionName?: string; - public deadLetterConfig?: DeadLetterConfig; - public description?: string; - public environment?: Environment; - public kmsKey?: Key; - public memorySize?: number; - public timeout?: number; - public vpcConfig?: VPCConfig; - public arn: ARN; - public version: string; - public codeSHA256: string; - public lastModified: string; - - public static get(id: lumi.ID): Function { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Function[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: FunctionArgs) { - super(name); - if (lumirt.defaultIfComputed(args.code, "") === undefined) { - throw new Error("Missing required argument 'code'"); - } - this.code = args.code; - if (lumirt.defaultIfComputed(args.handler, "") === undefined) { - throw new Error("Missing required argument 'handler'"); - } - this.handler = args.handler; - if (lumirt.defaultIfComputed(args.role, "") === undefined) { - throw new Error("Missing required argument 'role'"); - } - this.role = args.role; - if (lumirt.defaultIfComputed(args.runtime, "") === undefined) { - throw new Error("Missing required argument 'runtime'"); - } - this.runtime = args.runtime; - this.functionName = args.functionName; - this.deadLetterConfig = args.deadLetterConfig; - this.description = args.description; - this.environment = args.environment; - this.kmsKey = args.kmsKey; - this.memorySize = args.memorySize; - this.timeout = args.timeout; - this.vpcConfig = args.vpcConfig; - } -} - -export interface FunctionArgs { - code: lumi.asset.Archive; - handler: string; - role: Role; - runtime: Runtime; - functionName?: string; - deadLetterConfig?: DeadLetterConfig; - description?: string; - environment?: Environment; - kmsKey?: Key; - memorySize?: number; - timeout?: number; - vpcConfig?: VPCConfig; -} - -export type Runtime = - "dotnetcore1.0" | - "java8" | - "nodejs4.3-edge" | - "nodejs4.3" | - "nodejs6.10" | - "nodejs" | - "python2.7"; - -export interface VPCConfig { - securityGroups: SecurityGroup[]; - subnets: Subnet[]; -} - diff --git a/lib/aws/pack/lambda/index.ts b/lib/aws/pack/lambda/index.ts deleted file mode 100644 index 995714cb7..000000000 --- a/lib/aws/pack/lambda/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./function"; -export * from "./permission"; - diff --git a/lib/aws/pack/lambda/permission.ts b/lib/aws/pack/lambda/permission.ts deleted file mode 100644 index baf27ad76..000000000 --- a/lib/aws/pack/lambda/permission.ts +++ /dev/null @@ -1,52 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {ARN} from "../types"; -import {Function} from "./function"; - -export class Permission extends lumi.NamedResource implements PermissionArgs { - public readonly action: string; - public readonly function: Function; - public readonly principal: string; - public readonly sourceAccount?: string; - public readonly sourceARN?: ARN; - - public static get(id: lumi.ID): Permission { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Permission[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: PermissionArgs) { - super(name); - if (lumirt.defaultIfComputed(args.action, "") === undefined) { - throw new Error("Missing required argument 'action'"); - } - this.action = args.action; - if (lumirt.defaultIfComputed(args.function, "") === undefined) { - throw new Error("Missing required argument 'function'"); - } - this.function = args.function; - if (lumirt.defaultIfComputed(args.principal, "") === undefined) { - throw new Error("Missing required argument 'principal'"); - } - this.principal = args.principal; - this.sourceAccount = args.sourceAccount; - this.sourceARN = args.sourceARN; - } -} - -export interface PermissionArgs { - readonly action: string; - readonly function: Function; - readonly principal: string; - readonly sourceAccount?: string; - readonly sourceARN?: ARN; -} - diff --git a/lib/aws/pack/package.json b/lib/aws/pack/package.json deleted file mode 100644 index 29a121bd2..000000000 --- a/lib/aws/pack/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "@lumi/aws", - "main": ".lumi/bin/index.js", - "typings": ".lumi/bin/index.d.ts", - "scripts": { - "build": "tsc" - }, - "devDependencies": { - "typescript": "^2.1.4", - "tslint": "^4.2.0" - }, - "peerDependencies": { - "@lumi/lumi": "*" - } -} - diff --git a/lib/aws/pack/s3/acl.ts b/lib/aws/pack/s3/acl.ts deleted file mode 100644 index e89bee554..000000000 --- a/lib/aws/pack/s3/acl.ts +++ /dev/null @@ -1,23 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -export let AWSExecReadACL: CannedACL = "aws-exec-read"; -export let AuthenticatedReadACL: CannedACL = "authenticated-read"; -export let BucketOwnerFullControlACL: CannedACL = "bucket-owner-full-control"; -export let BucketOwnerReadACL: CannedACL = "bucket-owner-read"; -export let LogDeliveryWriteACL: CannedACL = "log-delivery-write"; -export let PrivateACL: CannedACL = "private"; -export let PublicReadACL: CannedACL = "public-read"; -export let PublicReadWriteACL: CannedACL = "public-read-write"; - -export type CannedACL = - "aws-exec-read" | - "authenticated-read" | - "bucket-owner-full-control" | - "bucket-owner-read" | - "log-delivery-write" | - "private" | - "public-read" | - "public-read-write"; - diff --git a/lib/aws/pack/s3/bucket.ts b/lib/aws/pack/s3/bucket.ts deleted file mode 100644 index 692d13980..000000000 --- a/lib/aws/pack/s3/bucket.ts +++ /dev/null @@ -1,35 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {CannedACL} from "./acl"; - -export class Bucket extends lumi.NamedResource implements BucketArgs { - public readonly bucketName?: string; - public accessControl?: CannedACL; - - public static get(id: lumi.ID): Bucket { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Bucket[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: BucketArgs) { - super(name); - if (args !== undefined) { - this.bucketName = args.bucketName; - this.accessControl = args.accessControl; - } - } -} - -export interface BucketArgs { - readonly bucketName?: string; - accessControl?: CannedACL; -} - diff --git a/lib/aws/pack/s3/index.ts b/lib/aws/pack/s3/index.ts deleted file mode 100644 index e6066f92d..000000000 --- a/lib/aws/pack/s3/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./acl"; -export * from "./bucket"; -export * from "./object"; - diff --git a/lib/aws/pack/s3/object.ts b/lib/aws/pack/s3/object.ts deleted file mode 100644 index a146dd49f..000000000 --- a/lib/aws/pack/s3/object.ts +++ /dev/null @@ -1,63 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Bucket} from "./bucket"; - -export class Object extends lumi.Resource implements ObjectArgs { - public readonly key: string; - public readonly bucket: Bucket; - public source: lumi.asset.Asset; - public contentType?: string; - public contentDisposition?: string; - public cacheControl?: string; - public contentEncoding?: string; - public contentLanguage?: string; - public contentLength?: number; - - public static get(id: lumi.ID): Object { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Object[] { - return undefined; // functionality provided by the runtime - } - - constructor(args: ObjectArgs) { - super(); - if (lumirt.defaultIfComputed(args.key, "") === undefined) { - throw new Error("Missing required argument 'key'"); - } - this.key = args.key; - if (lumirt.defaultIfComputed(args.bucket, "") === undefined) { - throw new Error("Missing required argument 'bucket'"); - } - this.bucket = args.bucket; - if (lumirt.defaultIfComputed(args.source, "") === undefined) { - throw new Error("Missing required argument 'source'"); - } - this.source = args.source; - this.contentType = args.contentType; - this.contentDisposition = args.contentDisposition; - this.cacheControl = args.cacheControl; - this.contentEncoding = args.contentEncoding; - this.contentLanguage = args.contentLanguage; - this.contentLength = args.contentLength; - } -} - -export interface ObjectArgs { - readonly key: string; - readonly bucket: Bucket; - source: lumi.asset.Asset; - contentType?: string; - contentDisposition?: string; - cacheControl?: string; - contentEncoding?: string; - contentLanguage?: string; - contentLength?: number; -} - diff --git a/lib/aws/pack/serverless/api.ts b/lib/aws/pack/serverless/api.ts deleted file mode 100644 index 4311baed3..000000000 --- a/lib/aws/pack/serverless/api.ts +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -import { jsonStringify, objectKeys, printf, sha1hash } from "@lumi/lumirt"; -import { Deployment, RestAPI, Stage } from "../apigateway"; -import { requireRegion } from "../config"; -import { Permission } from "../lambda"; -import { Function } from "./function"; - -export interface Route { - method: string; - path: string; - lambda: Function; -} - -interface SwaggerSpec { - swagger: string; - info: SwaggerInfo; - paths: { [path: string]: { [method: string]: SwaggerOperation; }; }; -} - -interface SwaggerInfo { - title: string; - version: string; -} - -interface SwaggerOperation { - "x-amazon-apigateway-integration": { - uri: string; - passthroughBehavior?: string; - httpMethod: string; - type: string; - }; -} - -interface SwaggerParameter { - name: string; - in: string; - required: boolean; - type: string; -} - -interface SwaggerResponse { - statusCode: string; -} - -function createBaseSpec(apiName: string): SwaggerSpec { - return { - swagger: "2.0", - info: { title: apiName, version: "1.0" }, - paths: {}, - }; -} - -function createPathSpec(lambdaARN: string): SwaggerOperation { - let region = requireRegion(); - return { - "x-amazon-apigateway-integration": { - uri: "arn:aws:apigateway:" + region + ":lambda:path/2015-03-31/functions/" + lambdaARN + "/invocations", - passthroughBehavior: "when_no_match", - httpMethod: "POST", - type: "aws_proxy", - }, - }; -} - -// API is a higher level abstraction for working with AWS APIGateway reources. -export class API { - public api: RestAPI; - public deployment: Deployment; - private swaggerSpec: SwaggerSpec; - private apiName: string; - private lambdas: { [key: string]: Function}; - - constructor(apiName: string) { - this.apiName = apiName; - this.swaggerSpec = createBaseSpec(apiName); - this.lambdas = {}; - } - - public route(method: string, path: string, lambda: Function) { - if (this.swaggerSpec.paths[path] === undefined) { - this.swaggerSpec.paths[path] = {}; - } - let swaggerMethod: string; - switch ((method).toLowerCase()) { - case "get": - case "put": - case "post": - case "delete": - case "options": - case "head": - case "patch": - swaggerMethod = (method).toLowerCase(); - break; - case "any": - swaggerMethod = "x-amazon-apigateway-any-method"; - break; - default: - throw new Error("Method not supported: " + method); - } - this.swaggerSpec.paths[path][swaggerMethod] = createPathSpec(lambda.lambda.arn); - this.lambdas[swaggerMethod + ":" + path] = lambda; - } - - public publish(): Stage { - this.api = new RestAPI(this.apiName, { - body: this.swaggerSpec, - }); - let deploymentId = sha1hash(jsonStringify(this.swaggerSpec)); - this.deployment = new Deployment(this.apiName + "_" + deploymentId, { - restAPI: this.api, - description: "Deployment of version " + deploymentId, - }); - let stage = new Stage(this.apiName + "_stage", { - stageName: "stage", - description: "The current deployment of the API.", - restAPI: this.api, - deployment: this.deployment, - }); - - let pathKeys = objectKeys(this.swaggerSpec.paths); - for (let i = 0; i < (pathKeys).length; i++) { - let path = pathKeys[i]; - let methodKeys = objectKeys(this.swaggerSpec.paths[path]); - for (let j = 0; j < (methodKeys).length; j++) { - let method = methodKeys[j]; - let lambda = this.lambdas[method + ":" + path]; - if (method === "x-amazon-apigateway-any-method") { - method = "*"; - } else { - method = (method).toUpperCase(); - } - let invokePermission = new Permission(this.apiName + "_invoke_" + sha1hash(method + path), { - action: "lambda:invokeFunction", - function: lambda.lambda, - principal: "apigateway.amazonaws.com", - sourceARN: stage.executionARN + "/" + method + path, - }); - } - } - return stage; - } -} - diff --git a/lib/aws/pack/serverless/function.ts b/lib/aws/pack/serverless/function.ts deleted file mode 100644 index 44e3054fc..000000000 --- a/lib/aws/pack/serverless/function.ts +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -import { AssetArchive, File, String as StringAsset } from "@lumi/lumi/asset"; -import { - Closure, EnvObj, jsonStringify, objectKeys, printf, serializeClosure, sha1hash, -} from "@lumi/lumirt"; -import { Role } from "../iam/role"; -import { DeadLetterConfig, Function as LambdaFunction } from "../lambda/function"; -import { ARN } from "../types"; - -// Context is the shape of the context object passed to a Function callback. -export interface Context { - callbackWaitsForEmptyEventLoop: boolean; - readonly functionName: string; - readonly functionVersion: string; - readonly invokedFunctionArn: string; - readonly memoryLimitInMB: string; - readonly awsRequestId: string; - readonly logGroupName: string; - readonly logStreamName: string; - readonly identity: any; - readonly clientContext: any; - getRemainingTimeInMillis(): string; -} - -// Handler is the signature for a serverless function. -export type Handler = (event: any, context: Context, callback: (error: any, result: any) => void) => any; - -let policy = { - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Principal": { - "Service": "lambda.amazonaws.com", - }, - "Effect": "Allow", - "Sid": "", - }, - ], -}; - -interface FuncEnv { - code: string; - env: { [key: string]: string; }; -} - -// FuncsForClosure collects all the function defintions needed to -// support serialization of a given Closure object. Note that -// a Closure object can reference other Closure objects and -// can also have cycles, so we recursively walk the graph and -// cache serialized nodes along the way to avoid cycles. -class FuncsForClosure { - public funcs: { [hash: string]: FuncEnv }; - public root: string; - - constructor(closure: Closure) { - this.funcs = {}; - this.root = this.createFuncForClosure(closure); - } - - private createFuncForClosure(closure: Closure): string { - let hash = "__" + sha1hash(closure.code); - if (this.funcs[hash] === undefined) { - this.funcs[hash] = { - code: closure.code, - env: {}, // initialize as empty - update after recursive call - }; - this.funcs[hash].env = this.envFromClosureEnvironment(closure.environment); - } - return hash; - } - - private envFromClosureEnvironment(env: EnvObj): {[key: string]: string} { - let envObj: {[key: string]: string} = {}; - let keys = objectKeys(env); - for (let i = 0; i < (keys).length; i++) { - let key = keys[i]; - let envEntry = env[key]; - if (envEntry.json !== undefined) { - envObj[key] = jsonStringify(envEntry.json); - } else if (envEntry.closure !== undefined) { - let innerHash = this.createFuncForClosure(envEntry.closure); - envObj[key] = innerHash; - } else if (envEntry.obj !== undefined) { - envObj[key] = envObjToString(this.envFromClosureEnvironment(envEntry.obj)); - } else { - // TODO[pulumi/lumi#239]: For now we will skip serialziing when the captured JSON object is - // null/undefined. This is not technically correct, as it will cause references to these to - // fail instead of return undefined. - } - } - return envObj; - } -} - -// Converts an environment object into a string which can be embedded into a serialized -// function body. Note that this is not JSON serialization, as we may have proeprty -// values which are variable references to other global functions. In other words, -// there can be free variables in the resulting object literal. -function envObjToString(envObj: { [key: string]: string; }): string { - let ret = "{"; - let isStart = true; - let keys = objectKeys(envObj); - for (let i = 0; i < (keys).length; i++) { - let key = keys[i]; - let val = envObj[key]; - // Lumi generates the special name `.this` for references to `this`. - // We will rewrite to the name `_this` and then pass that as the - // receiver to `.apply` later on. - if (key === ".this") { - key = "_this"; - } - if (isStart) { - ret += " "; - } else { - ret += ", "; - } - isStart = false; - ret += key + ": " + val; - } - ret += " }"; - return ret; -} - -function createJavaScriptLambda( - functionName: string, - role: Role, - closure: Closure, - opts: FunctionOptions): LambdaFunction { - - let funcsForClosure = new FuncsForClosure(closure); - let funcs = funcsForClosure.funcs; - let str = "exports.handler = " + funcsForClosure.root + ";\n\n"; - let fkeys = objectKeys(funcs); - for (let i = 0; i < (fkeys).length; i++) { - let name = fkeys[i]; - str += - "function " + name + "() {\n" + - " var _this;\n" + - " with(" + envObjToString(funcs[name].env) + ") {\n" + - " return (function() {\n\n" + - funcs[name].code + "\n" + - " }).apply(_this).apply(undefined, arguments);\n" + - " }\n" + - "}\n" + - "\n"; - } - - // Inject some TypeScript runtime helpers that the transpiled code may have dependencies on. - // These are necessary for targeting Node.js runtime environments that do not yet support - // new ECMAScript features like `async`/`await`. - // - // The implementations are sourced from: https://github.com/Microsoft/tslib/blob/master/tslib.es6.js - /*tslint:disable: max-line-length */ - str += ` -function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [0, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} -`; - - let timeout = 180; - if (opts.timeout !== undefined) { - timeout = opts.timeout; - } - - let lambda = new LambdaFunction(functionName, { - code: new AssetArchive({ - "node_modules": new File("node_modules"), - "index.js": new StringAsset(str), - }), - handler: "index.handler", - runtime: "nodejs6.10", - role: role, - timeout: timeout, - memorySize: opts.memorySize, - deadLetterConfig: opts.deadLetterConfig, - }); - - return lambda; -} - -export interface FunctionOptions { - policies: ARN[]; - timeout?: number; - memorySize?: number; - deadLetterConfig?: DeadLetterConfig; -} - -// Function is a higher-level API for creating and managing AWS Lambda Function resources implemented -// by a Lumi lambda expression and with a set of attached policies. -export class Function { - public lambda: LambdaFunction; - public role: Role; - - constructor(name: string, options: FunctionOptions, func: Handler) { - if (name === undefined) { - throw new Error("Missing required resource name"); - } - if (func === undefined) { - throw new Error("Missing required function callback"); - } - let closure = serializeClosure(func); - if (closure === undefined) { - throw new Error("Failed to serialize function."); - } - - this.role = new Role(name + "-role", { - assumeRolePolicyDocument: policy, - managedPolicyARNs: options.policies, - }); - - switch (closure.language) { - case ".js": - this.lambda = createJavaScriptLambda(name, this.role, closure, options); - break; - default: - throw new Error("Language '" + closure.language + "' not yet supported (currently only JavaScript)."); - } - } -} - diff --git a/lib/aws/pack/serverless/index.ts b/lib/aws/pack/serverless/index.ts deleted file mode 100644 index d57bba8d1..000000000 --- a/lib/aws/pack/serverless/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -// The aws.serverless module provides abstractions similar to those available in the Serverless Application Model. -// See: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessapi -// -// In particular, these are similar to the following AWS CloudFormation resource types: -// * AWS::Serverless::Function -// * AWS::Serverless::Api -// * AWS::Serverless::SimpleTable - -export * from "./api"; -export * from "./function"; diff --git a/lib/aws/pack/sns/index.ts b/lib/aws/pack/sns/index.ts deleted file mode 100644 index ce44b5985..000000000 --- a/lib/aws/pack/sns/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./subscription"; -export * from "./topic"; - diff --git a/lib/aws/pack/sns/subscription.ts b/lib/aws/pack/sns/subscription.ts deleted file mode 100644 index afa3ee405..000000000 --- a/lib/aws/pack/sns/subscription.ts +++ /dev/null @@ -1,64 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -import {Topic} from "./topic"; - -export let ApplicationSubscription: Protocol = "application"; -export let EmailJSONSubscription: Protocol = "email-json"; -export let EmailSubscription: Protocol = "email"; -export let HTTPSSubscription: Protocol = "https"; -export let HTTSubscription: Protocol = "http"; -export let LambdaSubscription: Protocol = "lambda"; -export let SMSSubscription: Protocol = "sms"; -export let SQSSubscription: Protocol = "sqs"; - -export type Protocol = - "application" | - "email-json" | - "email" | - "https" | - "http" | - "lambda" | - "sms" | - "sqs"; - -export class Subscription extends lumi.NamedResource implements SubscriptionArgs { - public readonly topic: Topic; - public readonly protocol: Protocol; - public readonly endpoint: string; - - public static get(id: lumi.ID): Subscription { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Subscription[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args: SubscriptionArgs) { - super(name); - if (lumirt.defaultIfComputed(args.topic, "") === undefined) { - throw new Error("Missing required argument 'topic'"); - } - this.topic = args.topic; - if (lumirt.defaultIfComputed(args.protocol, "") === undefined) { - throw new Error("Missing required argument 'protocol'"); - } - this.protocol = args.protocol; - if (lumirt.defaultIfComputed(args.endpoint, "") === undefined) { - throw new Error("Missing required argument 'endpoint'"); - } - this.endpoint = args.endpoint; - } -} - -export interface SubscriptionArgs { - readonly topic: Topic; - readonly protocol: Protocol; - readonly endpoint: string; -} - diff --git a/lib/aws/pack/sns/topic.ts b/lib/aws/pack/sns/topic.ts deleted file mode 100644 index cfb620059..000000000 --- a/lib/aws/pack/sns/topic.ts +++ /dev/null @@ -1,33 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export class Topic extends lumi.NamedResource implements TopicArgs { - public readonly topicName?: string; - public displayName?: string; - - public static get(id: lumi.ID): Topic { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Topic[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: TopicArgs) { - super(name); - if (args !== undefined) { - this.topicName = args.topicName; - this.displayName = args.displayName; - } - } -} - -export interface TopicArgs { - readonly topicName?: string; - displayName?: string; -} - diff --git a/lib/aws/pack/sqs/index.ts b/lib/aws/pack/sqs/index.ts deleted file mode 100644 index 32c101602..000000000 --- a/lib/aws/pack/sqs/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -export * from "./queue"; - diff --git a/lib/aws/pack/sqs/queue.ts b/lib/aws/pack/sqs/queue.ts deleted file mode 100644 index 6233c9500..000000000 --- a/lib/aws/pack/sqs/queue.ts +++ /dev/null @@ -1,59 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -import * as lumi from "@lumi/lumi"; -import * as lumirt from "@lumi/lumirt"; - -export class Queue extends lumi.NamedResource implements QueueArgs { - public readonly fifoQueue?: boolean; - public readonly queueName?: string; - public contentBasedDeduplication?: boolean; - public delaySeconds?: number; - public maximumMessageSize?: number; - public messageRetentionPeriod?: number; - public receiveMessageWaitTimeSeconds?: number; - public redrivePolicy?: RedrivePolicy; - public visibilityTimeout?: number; - - public static get(id: lumi.ID): Queue { - return undefined; // functionality provided by the runtime - } - - public static query(q: any): Queue[] { - return undefined; // functionality provided by the runtime - } - - constructor(name: string, args?: QueueArgs) { - super(name); - if (args !== undefined) { - this.fifoQueue = args.fifoQueue; - this.queueName = args.queueName; - this.contentBasedDeduplication = args.contentBasedDeduplication; - this.delaySeconds = args.delaySeconds; - this.maximumMessageSize = args.maximumMessageSize; - this.messageRetentionPeriod = args.messageRetentionPeriod; - this.receiveMessageWaitTimeSeconds = args.receiveMessageWaitTimeSeconds; - this.redrivePolicy = args.redrivePolicy; - this.visibilityTimeout = args.visibilityTimeout; - } - } -} - -export interface QueueArgs { - readonly fifoQueue?: boolean; - readonly queueName?: string; - contentBasedDeduplication?: boolean; - delaySeconds?: number; - maximumMessageSize?: number; - messageRetentionPeriod?: number; - receiveMessageWaitTimeSeconds?: number; - redrivePolicy?: RedrivePolicy; - visibilityTimeout?: number; -} - -export interface RedrivePolicy { - deadLetterTarget: Queue; - maxReceiveCount: number; -} - diff --git a/lib/aws/pack/tsconfig.json b/lib/aws/pack/tsconfig.json deleted file mode 100644 index 15889cd3f..000000000 --- a/lib/aws/pack/tsconfig.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "compilerOptions": { - "outDir": ".lumi/bin", - "target": "es6", - "module": "commonjs", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "stripInternal": true, - "experimentalDecorators": true, - "pretty": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "forceConsistentCasingInFileNames": true, - "strictNullChecks": true - }, - "files": [ - "index.ts", - "types.ts", - - "apigateway/index.ts", - "apigateway/account.ts", - "apigateway/apiKey.ts", - "apigateway/authorizer.ts", - "apigateway/basePathMapping.ts", - "apigateway/clientCertificate.ts", - "apigateway/deployment.ts", - "apigateway/method.ts", - "apigateway/model.ts", - "apigateway/resource.ts", - "apigateway/restAPI.ts", - "apigateway/stage.ts", - "apigateway/usagePlan.ts", - "apigateway/usagePlanKey.ts", - - "config/index.ts", - - "cloudwatch/index.ts", - "cloudwatch/alarm.ts", - - "dynamodb/index.ts", - "dynamodb/table.ts", - - "ec2/index.ts", - "ec2/instance.ts", - "ec2/instanceMaps.ts", - "ec2/internetGateway.ts", - "ec2/route.ts", - "ec2/routeTable.ts", - "ec2/securityGroup.ts", - "ec2/securityGroupEgress.ts", - "ec2/securityGroupIngress.ts", - "ec2/subnet.ts", - "ec2/vpc.ts", - "ec2/vpcGatewayAttachment.ts", - "ec2/vpcPeeringConnection.ts", - - "elasticbeanstalk/index.ts", - "elasticbeanstalk/application.ts", - "elasticbeanstalk/applicationVersion.ts", - "elasticbeanstalk/environment.ts", - - "iam/index.ts", - "iam/group.ts", - "iam/policy.ts", - "iam/role.ts", - "iam/user.ts", - - "kms/index.ts", - "kms/key.ts", - - "lambda/index.ts", - "lambda/function.ts", - "lambda/permission.ts", - - "s3/index.ts", - "s3/bucket.ts", - "s3/object.ts", - - "sns/index.ts", - "sns/topic.ts", - - "sqs/index.ts", - "sqs/queue.ts" - ] -} - diff --git a/lib/aws/pack/tslint.json b/lib/aws/pack/tslint.json deleted file mode 100644 index e80ab714b..000000000 --- a/lib/aws/pack/tslint.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "rules": { - "align": [ - true, - "parameters", - "arguments", - "statements" - ], - "ban": false, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "eofline": true, - "forin": true, - "indent": [ - true, - "spaces" - ], - "interface-name": false, - "jsdoc-format": false, - "label-position": true, - "max-line-length": [ - true, - 120 - ], - "member-access": false, - "member-ordering": [ - true, - "static-before-instance", - "variables-before-functions" - ], - "no-any": false, - "no-arg": true, - "no-bitwise": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-inferrable-types": false, - "no-internal-module": true, - "no-parameter-properties": false, - "no-require-imports": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "no-var-requires": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-whitespace" - ], - "ordered-imports": true, - "quotemark": [ - true, - "double", - "avoid-escape" - ], - "radix": true, - "semicolon": true, - "switch-default": true, - "trailing-comma": [ - true, - { - "multiline": "always", - "singleline": "never" - } - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef": [ - false, - "call-signature", - "parameter", - "property-declaration", - "variable-declaration", - "member-variable-declaration" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "variable-name": [ - true, - "check-format", - "allow-leading-underscore", - "ban-keywords" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-module", - "check-separator", - "check-type" - ] - } -} \ No newline at end of file diff --git a/lib/aws/pack/types.ts b/lib/aws/pack/types.ts deleted file mode 100644 index 5ad1a872e..000000000 --- a/lib/aws/pack/types.ts +++ /dev/null @@ -1,37 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -/* tslint:disable:ordered-imports variable-name */ -export let APNortheast1Region: Region = "ap-northeast-1"; -export let APNortheast2Region: Region = "ap-northeast-2"; -export let APSouth1Region: Region = "ap-south-1"; -export let APSouthEast2Region: Region = "ap-southeast-2"; -export let APSoutheast1Region: Region = "ap-southeast-1"; -export let CACentralRegion: Region = "ca-central"; -export let EUCentral1Region: Region = "eu-central-1"; -export let EUWest1Region: Region = "eu-west-1"; -export let EUWest2Region: Region = "eu-west-2"; -export let SAEast1Region: Region = "sa-east-1"; -export let USEast1Region: Region = "us-east-1"; -export let USEast2Region: Region = "us-east-2"; -export let USWest1Region: Region = "us-west-1"; -export let USWest2Region: Region = "us-west-2"; - -export type ARN = string; - -export type Region = - "ap-northeast-1" | - "ap-northeast-2" | - "ap-south-1" | - "ap-southeast-2" | - "ap-southeast-1" | - "ca-central" | - "eu-central-1" | - "eu-west-1" | - "eu-west-2" | - "sa-east-1" | - "us-east-1" | - "us-east-2" | - "us-west-1" | - "us-west-2"; - diff --git a/lib/aws/pack/yarn.lock b/lib/aws/pack/yarn.lock deleted file mode 100644 index c6401411b..000000000 --- a/lib/aws/pack/yarn.lock +++ /dev/null @@ -1,542 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -ansi-align@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" - dependencies: - string-width "^2.0.0" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - -babel-code-frame@^6.20.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" - dependencies: - chalk "^1.1.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -boxen@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.1.0.tgz#b1b69dd522305e807a99deee777dbd6e5167b102" - dependencies: - ansi-align "^2.0.0" - camelcase "^4.0.0" - chalk "^1.1.1" - cli-boxes "^1.0.0" - string-width "^2.0.0" - term-size "^0.1.0" - widest-line "^1.0.0" - -brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -camelcase@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" - -capture-stack-trace@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz#4a6fa07399c26bba47f0b2496b4d0fb408c5550d" - -chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -cli-boxes@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - -colors@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -configstore@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.0.tgz#45df907073e26dfa1cf4b2d52f5b60545eaa11d1" - dependencies: - dot-prop "^4.1.0" - graceful-fs "^4.1.2" - make-dir "^1.0.0" - unique-string "^1.0.0" - write-file-atomic "^2.0.0" - xdg-basedir "^3.0.0" - -create-error-class@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" - dependencies: - capture-stack-trace "^1.0.0" - -cross-spawn-async@^2.1.1: - version "2.2.5" - resolved "https://registry.yarnpkg.com/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz#845ff0c0834a3ded9d160daca6d390906bb288cc" - dependencies: - lru-cache "^4.0.0" - which "^1.2.8" - -crypto-random-string@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" - -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" - -diff@^3.0.1: - version "3.2.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" - -dot-prop@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.1.1.tgz#a8493f0b7b5eeec82525b5c7587fa7de7ca859c1" - dependencies: - is-obj "^1.0.0" - -duplexer3@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" - -escape-string-regexp@^1.0.2: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - -execa@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.4.0.tgz#4eb6467a36a095fabb2970ff9d5e3fb7bce6ebc3" - dependencies: - cross-spawn-async "^2.1.1" - is-stream "^1.1.0" - npm-run-path "^1.0.0" - object-assign "^4.0.1" - path-key "^1.0.0" - strip-eof "^1.0.0" - -findup-sync@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-0.3.0.tgz#37930aa5d816b777c03445e1966cc6790a4c0b16" - dependencies: - glob "~5.0.0" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - -glob@^7.1.1: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@~5.0.0: - version "5.0.15" - resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" - dependencies: - inflight "^1.0.4" - inherits "2" - minimatch "2 || 3" - once "^1.3.0" - path-is-absolute "^1.0.0" - -got@^6.7.1: - version "6.7.1" - resolved "https://registry.yarnpkg.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" - dependencies: - create-error-class "^3.0.0" - duplexer3 "^0.1.4" - get-stream "^3.0.0" - is-redirect "^1.0.0" - is-retry-allowed "^1.0.0" - is-stream "^1.0.0" - lowercase-keys "^1.0.0" - safe-buffer "^5.0.1" - timed-out "^4.0.0" - unzip-response "^2.0.1" - url-parse-lax "^1.0.0" - -graceful-fs@^4.1.11, graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - dependencies: - ansi-regex "^2.0.0" - -import-lazy@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -ini@~1.3.0: - version "1.3.4" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - -is-npm@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" - -is-obj@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" - -is-redirect@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" - -is-retry-allowed@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" - -is-stream@^1.0.0, is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -js-tokens@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" - -latest-version@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" - dependencies: - package-json "^4.0.0" - -lowercase-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306" - -lru-cache@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - -make-dir@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.0.0.tgz#97a011751e91dd87cfadef58832ebb04936de978" - dependencies: - pify "^2.3.0" - -"minimatch@2 || 3", minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - -npm-run-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-1.0.0.tgz#f5c32bf595fe81ae927daec52e82f8b000ac3c8f" - dependencies: - path-key "^1.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - -object-assign@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -optimist@~0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" - dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" - -package-json@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" - dependencies: - got "^6.7.1" - registry-auth-token "^3.0.1" - registry-url "^3.0.3" - semver "^5.1.0" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-key@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-1.0.0.tgz#5d53d578019646c0d68800db4e146e6bdc2ac7af" - -path-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" - -pify@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - -prepend-http@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" - -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -rc@^1.0.1, rc@^1.1.6: - version "1.2.1" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95" - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -registry-auth-token@^3.0.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.1.tgz#fb0d3289ee0d9ada2cbb52af5dfe66cb070d3006" - dependencies: - rc "^1.1.6" - safe-buffer "^5.0.1" - -registry-url@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" - dependencies: - rc "^1.0.1" - -resolve@^1.1.7: - version "1.3.3" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5" - dependencies: - path-parse "^1.0.5" - -safe-buffer@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.0.tgz#fe4c8460397f9eaaaa58e73be46273408a45e223" - -semver-diff@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36" - dependencies: - semver "^5.0.3" - -semver@^5.0.3, semver@^5.1.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - -slide@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" - -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -string-width@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^3.0.0" - -strip-ansi@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" - -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -term-size@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/term-size/-/term-size-0.1.1.tgz#87360b96396cab5760963714cda0d0cbeecad9ca" - dependencies: - execa "^0.4.0" - -timed-out@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" - -tslint@^4.2.0: - version "4.5.1" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-4.5.1.tgz#05356871bef23a434906734006fc188336ba824b" - dependencies: - babel-code-frame "^6.20.0" - colors "^1.1.2" - diff "^3.0.1" - findup-sync "~0.3.0" - glob "^7.1.1" - optimist "~0.6.0" - resolve "^1.1.7" - tsutils "^1.1.0" - update-notifier "^2.0.0" - -tsutils@^1.1.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0" - -typescript@^2.1.4: - version "2.2.0" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.2.0.tgz#626f2fc70087d2480f21ebb12c1888288c8614e3" - -unique-string@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-1.0.0.tgz#9e1057cca851abb93398f8b33ae187b99caec11a" - dependencies: - crypto-random-string "^1.0.0" - -unzip-response@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" - -update-notifier@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.2.0.tgz#1b5837cf90c0736d88627732b661c138f86de72f" - dependencies: - boxen "^1.0.0" - chalk "^1.0.0" - configstore "^3.0.0" - import-lazy "^2.1.0" - is-npm "^1.0.0" - latest-version "^3.0.0" - semver-diff "^2.0.0" - xdg-basedir "^3.0.0" - -url-parse-lax@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" - dependencies: - prepend-http "^1.0.1" - -which@^1.2.8: - version "1.2.14" - resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" - dependencies: - isexe "^2.0.0" - -widest-line@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-1.0.0.tgz#0c09c85c2a94683d0d7eaf8ee097d564bf0e105c" - dependencies: - string-width "^1.0.1" - -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -write-file-atomic@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.1.0.tgz#1769f4b551eedce419f0505deae2e26763542d37" - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - slide "^1.1.5" - -xdg-basedir@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" - -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" diff --git a/lib/aws/provider/.gitignore b/lib/aws/provider/.gitignore deleted file mode 100644 index b78747642..000000000 --- a/lib/aws/provider/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/vendor/ - diff --git a/lib/aws/provider/apigateway/deployment.go b/lib/aws/provider/apigateway/deployment.go deleted file mode 100644 index cdb2d011a..000000000 --- a/lib/aws/provider/apigateway/deployment.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "fmt" - "strings" - - "github.com/aws/aws-sdk-go/aws" - awsapigateway "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/apigateway" -) - -const DeploymentToken = apigateway.DeploymentToken - -const ( - gatewayARNService = "apigateway" - gatewayARNRestAPIs = "restapis" - gatewayARNDeployments = "deployments" -) - -// NewDeploymentID returns an AWS APIGateway Deployment ARN ID for the given restAPIID and deploymentID -func NewDeploymentID(region, restAPIID, deploymentID string) resource.ID { - return arn.NewID(gatewayARNService, region, "", - fmt.Sprintf("/%v/%v/%v/%v", gatewayARNRestAPIs, restAPIID, gatewayARNDeployments, deploymentID)) -} - -// ParseDeploymentID parses an AWS APIGateway Deployment ARN ID to extract the restAPIID and deploymentID -func ParseDeploymentID(id resource.ID) (string, string, error) { - res, err := arn.ParseResourceName(id) - if err != nil { - return "", "", err - } - parts := strings.Split(res, "/") - if len(parts) != 4 || parts[0] != gatewayARNRestAPIs || parts[2] != gatewayARNDeployments { - return "", "", fmt.Errorf("expected Deployment ARN of the form %v: %v", - fmt.Sprintf("arn:aws:%v:region::/%v//%v/", - gatewayARNService, gatewayARNRestAPIs, gatewayARNDeployments), - id) - } - return parts[1], parts[3], nil -} - -// NewDeploymentProvider creates a provider that handles APIGateway Deployment operations. -func NewDeploymentProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &deploymentProvider{ctx} - return apigateway.NewDeploymentProvider(ops) -} - -type deploymentProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *deploymentProvider) Check(ctx context.Context, obj *apigateway.Deployment, property string) error { - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *deploymentProvider) Create(ctx context.Context, obj *apigateway.Deployment) (resource.ID, error) { - restAPIID, err := ParseRestAPIID(obj.RestAPI) - if err != nil { - return "", err - } - fmt.Printf("Creating APIGateway Deployment '%v'\n", *obj.Name) - create := &awsapigateway.CreateDeploymentInput{ - RestApiId: aws.String(restAPIID), - Description: obj.Description, - } - deployment, err := p.ctx.APIGateway().CreateDeployment(create) - if err != nil { - return "", err - } - id := NewDeploymentID(p.ctx.Region(), restAPIID, *deployment.Id) - return id, nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *deploymentProvider) Get(ctx context.Context, id resource.ID) (*apigateway.Deployment, error) { - restAPIID, deploymentID, err := ParseDeploymentID(id) - if err != nil { - return nil, err - } - resp, err := p.ctx.APIGateway().GetDeployment(&awsapigateway.GetDeploymentInput{ - RestApiId: aws.String(restAPIID), - DeploymentId: aws.String(deploymentID), - }) - if err != nil { - return nil, err - } - if resp == nil || resp.Id == nil { - return nil, nil - } - return &apigateway.Deployment{ - RestAPI: NewRestAPIID(p.ctx.Region(), restAPIID), - Description: resp.Description, - ID: aws.StringValue(resp.Id), - CreatedDate: resp.CreatedDate.String(), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *deploymentProvider) InspectChange(ctx context.Context, id resource.ID, - new *apigateway.Deployment, old *apigateway.Deployment, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *deploymentProvider) Update(ctx context.Context, id resource.ID, - old *apigateway.Deployment, new *apigateway.Deployment, diff *resource.ObjectDiff) error { - ops, err := patchOperations(diff) - if err != nil { - return err - } - if len(ops) > 0 { - restAPIID, deploymentID, err := ParseDeploymentID(id) - if err != nil { - return err - } - update := &awsapigateway.UpdateDeploymentInput{ - RestApiId: aws.String(restAPIID), - DeploymentId: aws.String(deploymentID), - PatchOperations: ops, - } - _, err = p.ctx.APIGateway().UpdateDeployment(update) - if err != nil { - return err - } - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *deploymentProvider) Delete(ctx context.Context, id resource.ID) error { - fmt.Printf("Deleting APIGateway Deployment '%v'\n", id) - restAPIID, deploymentID, err := ParseDeploymentID(id) - if err != nil { - return err - } - _, delerr := p.ctx.APIGateway().DeleteDeployment(&awsapigateway.DeleteDeploymentInput{ - RestApiId: aws.String(restAPIID), - DeploymentId: aws.String(deploymentID), - }) - return delerr -} diff --git a/lib/aws/provider/apigateway/patchoperations.go b/lib/aws/provider/apigateway/patchoperations.go deleted file mode 100644 index 2664edf96..000000000 --- a/lib/aws/provider/apigateway/patchoperations.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "fmt" - "strconv" - - "github.com/aws/aws-sdk-go/aws" - "github.com/pulumi/lumi/pkg/resource" - - awsapigateway "github.com/aws/aws-sdk-go/service/apigateway" -) - -// patchOperations is a utility function to compute a set of PatchOperations to perform based on the diffs -// for a provided map of properties and new values. Any provided ignoreProps are skipped from being considered -// as sources of patch operations. -func patchOperations(diff *resource.ObjectDiff, ignoreProps ...resource.PropertyKey) ( - []*awsapigateway.PatchOperation, error) { - - ignores := map[resource.PropertyKey]bool{} - for _, p := range ignoreProps { - ignores[p] = true - } - - return patchOperationsForObject("", diff, ignores) -} - -func patchOperationsForObject(path string, diff *resource.ObjectDiff, ignores map[resource.PropertyKey]bool) ( - []*awsapigateway.PatchOperation, error) { - - var ops []*awsapigateway.PatchOperation - if diff == nil { - return ops, nil - } - for _, name := range diff.Keys() { - if ignores != nil && ignores[name] { - continue - } - if diff.Added(name) { - v, err := jsonStringify(diff.Adds[name]) - if err != nil { - return nil, err - } - ops = append(ops, &awsapigateway.PatchOperation{ - Op: aws.String("add"), - Path: aws.String(path + "/" + string(name)), - Value: v, - }) - } - if diff.Updated(name) { - update := diff.Updates[name] - arrayOps, err := patchOperationsForValue(path+"/"+string(name), &update) - if err != nil { - return nil, err - } - ops = append(ops, arrayOps...) - } - if diff.Deleted(name) { - ops = append(ops, &awsapigateway.PatchOperation{ - Op: aws.String("remove"), - Path: aws.String(path + "/" + string(name)), - }) - } - } - return ops, nil -} - -func patchOperationsForValue(path string, diff *resource.ValueDiff) ([]*awsapigateway.PatchOperation, error) { - var ops []*awsapigateway.PatchOperation - if diff.Array != nil { - return patchOperationsForArray(path, diff.Array) - } else if diff.Object != nil { - return patchOperationsForObject(path, diff.Object, nil) - } else { - v, err := jsonStringify(diff.New) - if err != nil { - return nil, err - } - ops = append(ops, &awsapigateway.PatchOperation{ - Op: aws.String("replace"), - Path: aws.String(path), - Value: v, - }) - } - return ops, nil -} - -func patchOperationsForArray(path string, diff *resource.ArrayDiff) ([]*awsapigateway.PatchOperation, error) { - var ops []*awsapigateway.PatchOperation - if diff == nil { - return ops, nil - } - for i, add := range diff.Adds { - addOp, err := newOp("add", path+"/"+strconv.Itoa(i), &add) - if err != nil { - return nil, err - } - ops = append(ops, addOp) - } - for i, update := range diff.Updates { - arrayOps, err := patchOperationsForValue(path+"/"+strconv.Itoa(i), &update) - if err != nil { - return nil, err - } - ops = append(ops, arrayOps...) - } - for i := range diff.Deletes { - deleteOp, err := newOp("delete", path+"/"+strconv.Itoa(i), nil) - if err != nil { - return nil, err - } - ops = append(ops, deleteOp) - } - return ops, nil -} - -func newOp(op string, path string, i *resource.PropertyValue) (*awsapigateway.PatchOperation, error) { - patchOp := awsapigateway.PatchOperation{ - Op: aws.String(op), - Path: aws.String(path), - } - if i != nil { - v, err := jsonStringify(*i) - if err != nil { - return nil, err - } - patchOp.Value = v - } - return &patchOp, nil -} - -func jsonStringify(i resource.PropertyValue) (*string, error) { - var s string - switch v := i.V.(type) { - case nil: - return nil, nil - case bool: - if v { - s = "true" - } else { - s = "false" - } - case float64: - s = strconv.Itoa(int(v)) - case string: - s = v - case []resource.PropertyValue: - s = "[" - isFirst := true - for _, pv := range v { - pvj, err := jsonStringify(pv) - if pvj == nil { - tmp := "null" - pvj = &tmp - } - if err != nil { - return nil, err - } - if !isFirst { - s += ", " - } - s += *pvj - } - s += "]" - case resource.PropertyMap: - s = "{" - isFirst := true - for pk, pv := range v { - pvj, err := jsonStringify(pv) - if pvj != nil { - if err != nil { - return nil, err - } - if !isFirst { - s += ", " - } - s += "\"" + string(pk) + "\": " + *pvj - } - } - s += "}" - case resource.URN: - s = string(v) - default: - return nil, fmt.Errorf("unexpected diff type %v", v) - } - return &s, nil -} diff --git a/lib/aws/provider/apigateway/patchoperations_test.go b/lib/aws/provider/apigateway/patchoperations_test.go deleted file mode 100644 index cd29c1286..000000000 --- a/lib/aws/provider/apigateway/patchoperations_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/pulumi/lumi/pkg/resource" - "github.com/stretchr/testify/assert" -) - -type TestStruct struct { - Number float64 `json:"number"` - OptionalString *string `json:"optionalString,omitempty"` - OptionalNumber *float64 `json:"optionalNumber,omitempty"` - OptionalBool *bool `json:"optionalBool,omitempty"` - OptionalArray *[]TestStruct `json:"optionalArray,omitempty"` - OptionalObject *TestStruct `json:"optionalObject,omitempty"` -} - -func Test(t *testing.T) { - before := TestStruct{ - Number: 1, - OptionalString: aws.String("hello"), - OptionalNumber: nil, - OptionalBool: aws.Bool(true), - OptionalArray: &[]TestStruct{ - {Number: 1}, - }, - } - after := TestStruct{ - Number: 1, - OptionalString: aws.String("goodbye"), - OptionalNumber: aws.Float64(3), - OptionalArray: &[]TestStruct{ - { - Number: 3, - OptionalBool: aws.Bool(true), - }, - { - Number: 1, - }, - }, - } - expectedPatchOps := []*apigateway.PatchOperation{ - { - Op: aws.String("add"), - Path: aws.String("/optionalArray/1"), - Value: aws.String("{\"number\": 1}"), - }, - { - Op: aws.String("replace"), - Path: aws.String("/optionalArray/0/number"), - Value: aws.String("3"), - }, - { - Op: aws.String("add"), - Path: aws.String("/optionalArray/0/optionalBool"), - Value: aws.String("true"), - }, - { - Op: aws.String("remove"), - Path: aws.String("/optionalBool"), - }, - { - Op: aws.String("add"), - Path: aws.String("/optionalNumber"), - Value: aws.String("3"), - }, - { - Op: aws.String("replace"), - Path: aws.String("/optionalString"), - Value: aws.String("goodbye"), - }, - } - beforeProps := resource.NewPropertyMap(before) - afterProps := resource.NewPropertyMap(after) - diff := beforeProps.Diff(afterProps) - assert.NotEqual(t, nil, diff, "expected diff should not be nil") - - patchOps, err := patchOperations(diff) - assert.Nil(t, err, "expected no error generating patch operations") - assert.EqualValues(t, expectedPatchOps, patchOps) -} diff --git a/lib/aws/provider/apigateway/restapi.go b/lib/aws/provider/apigateway/restapi.go deleted file mode 100644 index 34cc3d632..000000000 --- a/lib/aws/provider/apigateway/restapi.go +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "crypto/sha1" - "encoding/json" - "errors" - "fmt" - "strings" - - "github.com/aws/aws-sdk-go/aws" - awsapigateway "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/apigateway" -) - -const RestAPIToken = apigateway.RestAPIToken - -// constants for the various restAPI limits. -const ( - maxRestAPIName = 255 -) - -// NewRestAPIID returns an AWS APIGateway RestAPI ARN ID for the given restAPIID -func NewRestAPIID(region, restAPIID string) resource.ID { - return arn.NewID("apigateway", region, "", "/restapis/"+restAPIID) -} - -// ParseRestAPIID parses an AWS APIGateway RestAPI ARN ID to extract the restAPIID -func ParseRestAPIID(id resource.ID) (string, error) { - res, err := arn.ParseResourceName(id) - if err != nil { - return "", err - } - parts := strings.Split(res, "/") - if len(parts) != 2 || parts[0] != "restapis" { - return "", fmt.Errorf("expected RestAPI ARN of the form arn:aws:apigateway:region::/restapis/api-id: %v", id) - } - return parts[1], nil -} - -// NewRestAPIProvider creates a provider that handles APIGateway RestAPI operations. -func NewRestAPIProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &restAPIProvider{ctx} - return apigateway.NewRestAPIProvider(ops) -} - -type restAPIProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *restAPIProvider) Check(ctx context.Context, obj *apigateway.RestAPI, property string) error { - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *restAPIProvider) Create(ctx context.Context, obj *apigateway.RestAPI) (resource.ID, error) { - // If an explicit name is given, use it. Otherwise, auto-generate a name in part based on the resource name. - var apiName string - if obj.APIName != nil { - apiName = *obj.APIName - } else { - apiName = resource.NewUniqueHex(*obj.Name+"-", maxRestAPIName, sha1.Size) - } - - // Marshal the body ahead of creating the gateway objects, so that we don't orphan state during failure. - var body []byte - if obj.Body != nil { - bodyJSON, err := json.Marshal(*obj.Body) - if err != nil { - return "", err - } - body = bodyJSON - } - - // First create the API Gateway - fmt.Printf("Creating APIGateway RestAPI '%v' with name '%v'\n", *obj.Name, apiName) - create := &awsapigateway.CreateRestApiInput{ - Name: aws.String(apiName), - Description: obj.Description, - CloneFrom: obj.CloneFrom.StringPtr(), - } - var restAPI *awsapigateway.RestApi - succ, err := awsctx.RetryUntilLong(p.ctx, func() (bool, error) { - var err error - fmt.Printf("Waiting for RestAPI %v to be created\n", apiName) - restAPI, err = p.ctx.APIGateway().CreateRestApi(create) - if err != nil { - if awsctx.IsAWSError(err, "TooManyRequestsException") { - return false, nil - } - return false, err - } - return true, nil - }) - if err != nil { - return "", err - } - if !succ { - return "", fmt.Errorf("Timed out waiting for RestAPI to become ready") - } - - // Next, if a body is specified, put the rest api contents - if body != nil { - fmt.Printf("APIGateway RestAPI created: %v; putting API contents from OpenAPI specification\n", restAPI.Id) - put := &awsapigateway.PutRestApiInput{ - RestApiId: restAPI.Id, - Body: body, - Mode: aws.String("overwrite"), - } - _, err := p.ctx.APIGateway().PutRestApi(put) - if err != nil { - return "", err - } - } - - return NewRestAPIID(p.ctx.Region(), *restAPI.Id), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *restAPIProvider) Get(ctx context.Context, id resource.ID) (*apigateway.RestAPI, error) { - restAPIID, err := ParseRestAPIID(id) - if err != nil { - return nil, err - } - resp, err := p.ctx.APIGateway().GetRestApi(&awsapigateway.GetRestApiInput{ - RestApiId: aws.String(restAPIID), - }) - if err != nil { - return nil, err - } - if resp == nil || resp.Id == nil { - return nil, nil - } - - return &apigateway.RestAPI{ - ID: aws.StringValue(resp.Id), - APIName: resp.Name, - Description: resp.Description, - CreatedDate: resp.CreatedDate.String(), - Version: aws.StringValue(resp.Version), - Warnings: aws.StringValueSlice(resp.Warnings), - BinaryMediaTypes: aws.StringValueSlice(resp.BinaryMediaTypes), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *restAPIProvider) InspectChange(ctx context.Context, id resource.ID, - new *apigateway.RestAPI, old *apigateway.RestAPI, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *restAPIProvider) Update(ctx context.Context, id resource.ID, - old *apigateway.RestAPI, new *apigateway.RestAPI, diff *resource.ObjectDiff) error { - restAPIID, err := ParseRestAPIID(id) - if err != nil { - return err - } - if diff.Updated(apigateway.RestAPI_Body) { - if new.Body != nil { - body := *new.Body - bodyJSON, marerr := json.Marshal(body) - if marerr != nil { - return fmt.Errorf("Could not convert Swagger definition object to JSON: %v", marerr) - } - fmt.Printf("Updating API definition for %v from OpenAPI specification\n", id) - put := &awsapigateway.PutRestApiInput{ - RestApiId: aws.String(restAPIID), - Body: bodyJSON, - Mode: aws.String("overwrite"), - } - newAPI, puterr := p.ctx.APIGateway().PutRestApi(put) - if puterr != nil { - return puterr - } - fmt.Printf("Updated to: %v\n", newAPI) - } else { - return errors.New("Cannot remove Body from Rest API which previously had one") - } - } - ops, err := patchOperations(diff, apigateway.RestAPI_Body) - if err != nil { - return err - } - if len(ops) > 0 { - update := &awsapigateway.UpdateRestApiInput{ - RestApiId: aws.String(restAPIID), - PatchOperations: ops, - } - _, err := p.ctx.APIGateway().UpdateRestApi(update) - if err != nil { - return err - } - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *restAPIProvider) Delete(ctx context.Context, id resource.ID) error { - restAPIID, err := ParseRestAPIID(id) - if err != nil { - return err - } - fmt.Printf("Deleting APIGateway RestAPI '%v'\n", id) - succ, err := awsctx.RetryUntilLong(p.ctx, func() (bool, error) { - fmt.Printf("Waiting for RestAPI %v to be deleted\n", id) - _, err = p.ctx.APIGateway().DeleteRestApi(&awsapigateway.DeleteRestApiInput{ - RestApiId: aws.String(restAPIID), - }) - if err != nil { - if awsctx.IsAWSError(err, "TooManyRequestsException") { - return false, nil - } - return false, err - } - return true, nil - }) - if err != nil { - return err - } - if !succ { - return fmt.Errorf("Timed out waiting for RestAPI to become ready") - } - return nil -} diff --git a/lib/aws/provider/apigateway/stage.go b/lib/aws/provider/apigateway/stage.go deleted file mode 100644 index 448295acc..000000000 --- a/lib/aws/provider/apigateway/stage.go +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package apigateway - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - awsapigateway "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "strings" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/apigateway" -) - -const StageToken = apigateway.StageToken - -// NewStageID returns an AWS APIGateway Stage ARN ID for the given restAPIID and stageID -func NewStageID(region, restAPIID, stageID string) resource.ID { - return arn.NewID("apigateway", region, "", "/restapis/"+restAPIID+"/stages/"+stageID) -} - -// ParseStageID parses an AWS APIGateway Stage ARN ID to extract the restAPIID and stageID -func ParseStageID(id resource.ID) (string, string, error) { - res, err := arn.ParseResourceName(id) - if err != nil { - return "", "", err - } - parts := strings.Split(res, "/") - if len(parts) != 4 || parts[0] != "restapis" || parts[2] != "stages" { - return "", "", fmt.Errorf( - "expected Stage ARN of the form arn:aws:apigateway:region::/restapis/api-id/stages/stage-id: %v", id) - } - return parts[1], parts[3], nil -} - -// NewStageProvider creates a provider that handles APIGateway Stage operations. -func NewStageProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &stageProvider{ctx} - return apigateway.NewStageProvider(ops) -} - -type stageProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *stageProvider) Check(ctx context.Context, obj *apigateway.Stage, property string) error { - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *stageProvider) Create(ctx context.Context, obj *apigateway.Stage) (resource.ID, error) { - if obj.MethodSettings != nil || obj.ClientCertificate != nil { - return "", fmt.Errorf("Not yet supported - MethodSettings or ClientCertificate") - } - fmt.Printf("Creating APIGateway Stage '%v' with stage name '%v'\n", *obj.Name, obj.StageName) - restAPIID, deploymentID, err := ParseDeploymentID(obj.Deployment) - if err != nil { - return "", err - } - create := &awsapigateway.CreateStageInput{ - StageName: aws.String(obj.StageName), - RestApiId: aws.String(restAPIID), - DeploymentId: aws.String(deploymentID), - Description: obj.Description, - CacheClusterEnabled: obj.CacheClusterEnabled, - CacheClusterSize: obj.CacheClusterSize, - } - if obj.Variables != nil { - create.Variables = aws.StringMap(*obj.Variables) - } - stage, err := p.ctx.APIGateway().CreateStage(create) - if err != nil { - return "", err - } - return NewStageID(p.ctx.Region(), restAPIID, *stage.StageName), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *stageProvider) Get(ctx context.Context, id resource.ID) (*apigateway.Stage, error) { - restAPIID, stageName, err := ParseStageID(id) - if err != nil { - return nil, err - } - - resp, err := p.ctx.APIGateway().GetStage(&awsapigateway.GetStageInput{ - RestApiId: aws.String(restAPIID), - StageName: aws.String(stageName), - }) - if err != nil { - return nil, err - } - if resp == nil || resp.DeploymentId == nil { - return nil, nil - } - variables := aws.StringValueMap(resp.Variables) - - url := "https://" + restAPIID + ".execute-api." + p.ctx.Region() + ".amazonaws.com/" + stageName - executionARN := "arn:aws:execute-api:" + p.ctx.Region() + ":" + p.ctx.AccountID() + ":" + restAPIID + "/" + stageName - - return &apigateway.Stage{ - RestAPI: NewRestAPIID(p.ctx.Region(), restAPIID), - Deployment: NewDeploymentID(p.ctx.Region(), restAPIID, aws.StringValue(resp.DeploymentId)), - CacheClusterEnabled: resp.CacheClusterEnabled, - CacheClusterSize: resp.CacheClusterSize, - StageName: aws.StringValue(resp.StageName), - Variables: &variables, - Description: resp.Description, - CreatedDate: resp.CreatedDate.String(), - LastUpdatedDate: resp.LastUpdatedDate.String(), - URL: url, - ExecutionARN: executionARN, - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *stageProvider) InspectChange(ctx context.Context, id resource.ID, - new *apigateway.Stage, old *apigateway.Stage, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *stageProvider) Update(ctx context.Context, id resource.ID, - old *apigateway.Stage, new *apigateway.Stage, diff *resource.ObjectDiff) error { - ops, err := patchOperations(diff, apigateway.Stage_Deployment) - if err != nil { - return err - } - - if diff.Updated(apigateway.Stage_Deployment) { - _, deploymentID, deperr := ParseDeploymentID(new.Deployment) - if deperr != nil { - return deperr - } - ops = append(ops, &awsapigateway.PatchOperation{ - Op: aws.String("replace"), - Path: aws.String("/deploymentId"), - Value: aws.String(deploymentID), - }) - } - - restAPIId, stageName, err := ParseStageID(id) - if err != nil { - return err - } - if len(ops) > 0 { - update := &awsapigateway.UpdateStageInput{ - StageName: aws.String(stageName), - RestApiId: aws.String(restAPIId), - PatchOperations: ops, - } - _, err := p.ctx.APIGateway().UpdateStage(update) - if err != nil { - return err - } - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *stageProvider) Delete(ctx context.Context, id resource.ID) error { - fmt.Printf("Deleting APIGateway Stage '%v'\n", id) - restAPIID, stageName, err := ParseStageID(id) - if err != nil { - return err - } - _, delerr := p.ctx.APIGateway().DeleteStage(&awsapigateway.DeleteStageInput{ - RestApiId: aws.String(restAPIID), - StageName: aws.String(stageName), - }) - return delerr -} diff --git a/lib/aws/provider/arn/arn.go b/lib/aws/provider/arn/arn.go deleted file mode 100644 index 5a6524f30..000000000 --- a/lib/aws/provider/arn/arn.go +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package arn - -import ( - "fmt" - "strings" - - "github.com/pkg/errors" - "github.com/pulumi/lumi/pkg/resource" - - aws "github.com/pulumi/lumi/lib/aws/rpc" -) - -const ( - arnPrefix = "arn" - arnDefaultPartition = "aws" - arnDefaultResourceSeparator = ":" - arnAlternativeResourceSeparator = "/" - arnPathDelimiter = "/" -) - -// ARN is a string representation of an Amazon Resource Name (ARN). -type ARN string - -// New creates a new AWS ARN string from the given account and service information. For more information about the ARN -// format, see http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html. -func New(service string, region string, accountID string, res string) ARN { - parts := Parts{ - Partition: arnDefaultPartition, - Service: service, - Region: region, - AccountID: accountID, - Resource: res, - } - return parts.ARN() -} - -// NewResource creates a new AWS ARN string from the given service information. This handles the canonical use case -// of delimiting the resource type and name with a ":". For "/" delimiters, see the NewResourceAltARN function. -func NewResource(service string, region string, accountID string, restype string, resname string) ARN { - return New(service, region, accountID, restype+arnDefaultResourceSeparator+resname) -} - -// NewResourceAlt creates a new AWS ARN string from the given service information. This handles the canonical use -// case of delimiting the resource type, but, unlike NewResourceARN, uses "/" as the delimiter instead of ":". -func NewResourceAlt(service string, region string, accountID string, restype string, resname string) ARN { - return New(service, region, accountID, restype+arnAlternativeResourceSeparator+resname) -} - -// NewID is the same as New except that it returns a string suitable as a Lumi resource ID. -func NewID(service string, region string, accountID string, res string) resource.ID { - return resource.ID(New(service, region, accountID, res)) -} - -// NewResourceID is the same as NewResource except that it returns a string suitable as a Lumi resource ID. -func NewResourceID(service string, region string, accountID string, restype string, resname string) resource.ID { - return resource.ID(NewResource(service, region, accountID, restype, resname)) -} - -// NewResourceAltID is the same as NewResourceAltARN except that it returns a string suitable as a Lumi resource ID. -func NewResourceAltID(service string, region string, accountID string, restype string, resname string) resource.ID { - return resource.ID(NewResourceAlt(service, region, accountID, restype, resname)) -} - -// RPC turns an ARN into its marshalable form. -func (arn ARN) RPC() aws.ARN { return aws.ARN(arn) } - -// Parse turns a string formatted ARN into the consistuent ARN parts for inspection purposes. -func (arn ARN) Parse() (Parts, error) { - var parts Parts - ps := strings.Split(string(arn), ":") - if len(ps) == 0 { - return parts, errors.Errorf("Missing ARN prefix of '%v:'", arnPrefix) - } else if ps[0] != arnPrefix { - return parts, errors.Errorf("Unexpected ARN prefix of '%v'; expected '%v'", ps[0], arnPrefix) - } - if len(ps) > 1 { - parts.Partition = ps[1] - } - if len(ps) > 2 { - parts.Service = ps[2] - } - if len(ps) > 3 { - parts.Region = ps[3] - } - if len(ps) > 4 { - parts.AccountID = ps[4] - } - if len(ps) > 5 { - parts.Resource = ps[5] - } - for i := 6; i < len(ps); i++ { - parts.Resource = parts.Resource + ":" + ps[i] - } - return parts, nil -} - -// ParseResourceName parses an entire ARN and extracts its resource name part, returning an error if the process -// fails or if the resource name is missing. -func (arn ARN) ParseResourceName() (string, error) { - parts, err := arn.Parse() - if err != nil { - return "", err - } - resname := parts.ResourceName() - if resname == "" { - return "", errors.Errorf("Missing resource name in ARN '%v'", arn) - } - return resname, nil -} - -// ParseResourceNamePair parses an entire ARN and extracts its resource name part, returning an error if the process -// fails or if the resource name is missing. -func (arn ARN) ParseResourceNamePair() (string, string, error) { - parts, err := arn.Parse() - if err != nil { - return "", "", err - } - name1, name2 := parts.ResourceNamePair() - if name1 == "" || name2 == "" { - return "", "", errors.Errorf("ARN did not contain a name pair '%v'", arn) - } - return name1, name2, nil -} - -// Parts is a structure containing an ARN's distinct parts. Normally ARNs flow around as strings in the format -// described at http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html, however, when it comes time -// to creating or inspecting them, this first class structure can come in handy. -type Parts struct { - Partition string - Service string - Region string - AccountID string - Resource string -} - -// ARN turns the ARN parts into a single string in the canonical ARN format. Some or all parts may be missing. -func (a Parts) ARN() ARN { - return ARN(fmt.Sprintf("%v:%v:%v:%v:%v:%v", - arnPrefix, a.Partition, a.Service, a.Region, a.AccountID, a.Resource)) -} - -// ResourceType parses an ARN and returns the resource type. This detects both kinds of resource delimiters (":" and -// "/"), although, if called on an ARN not formatted as type, delimiter, and then ID, this may return the wrong thing. -func (a Parts) ResourceType() string { - res := a.Resource - if idx := strings.Index(res, arnDefaultResourceSeparator); idx != -1 { - return res[:idx] - } - if idx := strings.Index(res, arnAlternativeResourceSeparator); idx != -1 { - return res[:idx] - } - return res -} - -// ResourceName parses an ARN and returns the resource name. This detects both kinds of resource delimiters (":" and -// "/"); if called on an ARN not formatted as type, delimiter, followed by ID, this may return the wrong thing. -func (a Parts) ResourceName() string { - res := a.Resource - if idx := strings.Index(res, arnDefaultResourceSeparator); idx != -1 { - return res[idx+1:] - } - if idx := strings.Index(res, arnAlternativeResourceSeparator); idx != -1 { - return res[idx+1:] - } - return res -} - -// ResourceNamePair parses an ARN in the format of a name pair delimited by "/". An example is an S3 object, whose -// whose ARN is of the form "arn:aws:s3:::bucket_name/key_name". This function will return the "bucket_name" and -// "key_name" parts as independent parts, for convenient parsing as a single atomic operation. -func (a Parts) ResourceNamePair() (string, string) { - name := a.ResourceName() - if ix := strings.Index(name, "/"); ix != -1 { - return name[:ix], name[ix+1:] - } - return name, "" -} - -// ParseResourceName parses a resource ID to obtain its resource name which, for the entire AWS package, is the ARN. -func ParseResourceName(id resource.ID) (string, error) { - return ARN(id).ParseResourceName() -} - -// ParseResourceNamePair parses a resource ID to obtain a pair of resource names. See ResourceNamePair for details. -func ParseResourceNamePair(id resource.ID) (string, string, error) { - return ARN(id).ParseResourceNamePair() -} diff --git a/lib/aws/provider/arn/arn_test.go b/lib/aws/provider/arn/arn_test.go deleted file mode 100644 index 764ff19ff..000000000 --- a/lib/aws/provider/arn/arn_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package arn - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestNewParse(t *testing.T) { - t.Parallel() - - // basic ARN parsing/extraction: - a1 := New("ec2", "us-west-2", "123456789", "instance:i-0011223344") - assert.Equal(t, "arn:aws:ec2:us-west-2:123456789:instance:i-0011223344", string(a1)) - a1p, err := a1.Parse() - assert.Nil(t, err) - assert.Equal(t, "aws", a1p.Partition) - assert.Equal(t, "ec2", a1p.Service) - assert.Equal(t, "us-west-2", a1p.Region) - assert.Equal(t, "123456789", a1p.AccountID) - assert.Equal(t, "instance:i-0011223344", a1p.Resource) - a1prn1, err := a1.ParseResourceName() - assert.Nil(t, err) - assert.Equal(t, "i-0011223344", a1prn1) - assert.Equal(t, "instance", a1p.ResourceType()) - assert.Equal(t, "i-0011223344", a1p.ResourceName()) - - // basic ARN parsing/extraction (variant #2: "/" delimiter for resource) - a2 := New("elasticloadbalancing", "us-west-2", "123456789", "loadbalancer/mylb-123") - assert.Equal(t, "arn:aws:elasticloadbalancing:us-west-2:123456789:loadbalancer/mylb-123", string(a2)) - a2p, err := a2.Parse() - assert.Nil(t, err) - assert.Equal(t, "aws", a2p.Partition) - assert.Equal(t, "elasticloadbalancing", a2p.Service) - assert.Equal(t, "us-west-2", a2p.Region) - assert.Equal(t, "123456789", a2p.AccountID) - assert.Equal(t, "loadbalancer/mylb-123", a2p.Resource) - a2prn1, err := a2.ParseResourceName() - assert.Nil(t, err) - assert.Equal(t, "mylb-123", a2prn1) - assert.Equal(t, "loadbalancer", a2p.ResourceType()) - assert.Equal(t, "mylb-123", a2p.ResourceName()) - - // basic ARN parsing/extraction (variant #3: "/" delimited resource name pairs) - a3 := New("elasticbeanstalk", "us-east-2", "123456789", "environment/My App/MyEnvironment") - assert.Equal(t, "arn:aws:elasticbeanstalk:us-east-2:123456789:environment/My App/MyEnvironment", string(a3)) - a3p, err := a3.Parse() - assert.Nil(t, err) - assert.Equal(t, "aws", a3p.Partition) - assert.Equal(t, "elasticbeanstalk", a3p.Service) - assert.Equal(t, "us-east-2", a3p.Region) - assert.Equal(t, "123456789", a3p.AccountID) - assert.Equal(t, "environment/My App/MyEnvironment", a3p.Resource) - a3prn1, err := a3.ParseResourceName() - assert.Nil(t, err) - assert.Equal(t, "My App/MyEnvironment", a3prn1) - assert.Equal(t, "environment", a3p.ResourceType()) - assert.Equal(t, "My App/MyEnvironment", a3p.ResourceName()) - a3name1, a3name2, err := a3.ParseResourceNamePair() - assert.Nil(t, err) - assert.Equal(t, "My App", a3name1) - assert.Equal(t, "MyEnvironment", a3name2) - a3name1b, a3name2b := a3p.ResourceNamePair() - assert.Equal(t, "My App", a3name1b) - assert.Equal(t, "MyEnvironment", a3name2b) -} diff --git a/lib/aws/provider/arn/resources.go b/lib/aws/provider/arn/resources.go deleted file mode 100644 index f6f280eab..000000000 --- a/lib/aws/provider/arn/resources.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package arn - -import ( - "github.com/pulumi/lumi/pkg/resource" -) - -// This file contains constants and factories for all sorts of AWS resource ARNs. In the fullness of time, it should -// contain all of those listed at http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html. We are -// implementing them "as we go", however, so please feel free to add any that you need and which are presently missing. - -const ( - EC2 = "ec2" - EC2Instance = "instance" - EC2SecurityGroup = "security-group" - EC2VPC = "vpc" -) - -func NewEC2Instance(region, accountID, id string) ARN { - return NewResource(EC2, region, accountID, EC2Instance, id) -} - -func NewEC2InstanceID(region, accountID, id string) resource.ID { - return resource.ID(NewEC2Instance(region, accountID, id)) -} - -func NewEC2SecurityGroup(region, accountID, id string) ARN { - return NewResource(EC2, region, accountID, EC2SecurityGroup, id) -} - -func NewEC2SecurityGroupID(region, accountID, id string) resource.ID { - return resource.ID(NewEC2SecurityGroup(region, accountID, id)) -} - -func NewEC2VPC(region, accountID, id string) ARN { - return NewResource(EC2, region, accountID, EC2VPC, id) -} - -func NewEC2VPCID(region, accountID, id string) resource.ID { - return resource.ID(NewEC2VPC(region, accountID, id)) -} - -const ( - ElasticBeanstalk = "elasticbeanstalk" - ElasticBeanstalkApplication = "application" - ElasticBeanstalkApplicationVersion = "applicationversion" - ElasticBeanstalkEnvironment = "environment" -) - -func NewElasticBeanstalkApplication(region, accountID, name string) ARN { - return NewResourceAlt(ElasticBeanstalk, region, accountID, ElasticBeanstalkApplication, name) -} - -func NewElasticBeanstalkApplicationID(region, accountID, name string) resource.ID { - return resource.ID(NewElasticBeanstalkApplication(region, accountID, name)) -} - -func NewElasticBeanstalkApplicationVersion(region, accountID, appname, versionlabel string) ARN { - return NewResourceAlt(ElasticBeanstalk, region, accountID, - ElasticBeanstalkApplicationVersion, appname+arnPathDelimiter+versionlabel) -} - -func NewElasticBeanstalkApplicationVersionID(region, accountID, appname, versionlabel string) resource.ID { - return resource.ID(NewElasticBeanstalkApplicationVersion(region, accountID, appname, versionlabel)) -} - -func NewElasticBeanstalkEnvironment(region, accountID, appname, envname string) ARN { - return NewResourceAlt(ElasticBeanstalk, region, accountID, - ElasticBeanstalkEnvironment, appname+arnPathDelimiter+envname) -} - -const ( - S3 = "S3" -) - -func NewElasticBeanstalkEnvironmentID(region, accountID, appname, envname string) resource.ID { - return resource.ID(NewElasticBeanstalkApplicationVersion(region, accountID, appname, envname)) -} - -func NewS3Bucket(bucket string) ARN { - return NewResource(S3, "", "", "", bucket) -} - -func NewS3BucketID(bucket string) resource.ID { - return resource.ID(NewS3Bucket(bucket)) -} - -func NewS3Object(bucket, key string) ARN { - return NewResource(S3, "", "", "", bucket+arnPathDelimiter+key) -} - -func NewS3ObjectID(bucket, key string) resource.ID { - return resource.ID(NewS3Object(bucket, key)) -} diff --git a/lib/aws/provider/awsctx/context.go b/lib/aws/provider/awsctx/context.go deleted file mode 100644 index 42e220042..000000000 --- a/lib/aws/provider/awsctx/context.go +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package awsctx - -import ( - "context" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/aws/aws-sdk-go/service/cloudwatchlogs" - "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/aws/aws-sdk-go/service/ec2" - "github.com/aws/aws-sdk-go/service/elasticbeanstalk" - "github.com/aws/aws-sdk-go/service/iam" - "github.com/aws/aws-sdk-go/service/lambda" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/aws/aws-sdk-go/service/sns" - "github.com/aws/aws-sdk-go/service/sts" - "github.com/golang/glog" - "github.com/pkg/errors" - "github.com/pulumi/lumi/pkg/resource/provider" - "github.com/pulumi/lumi/pkg/util/contract" -) - -// Context represents state shared amongst all parties in this process. In particular, it wraps an AWS session -// object and offers convenient wrappers for creating connections to the various sub-services (EC2, S3, etc). -type Context struct { - sess *session.Session // a global session object, shared amongst all service connections. - - accountID string // the currently authenticated account's ID. - accountRole string // the currently authenticated account's IAM role. - - // per-service connections (lazily allocated and reused); - apigateway *apigateway.APIGateway - cloudwatchlogs *cloudwatchlogs.CloudWatchLogs - dynamodb *dynamodb.DynamoDB - ec2 *ec2.EC2 - elasticbeanstalk *elasticbeanstalk.ElasticBeanstalk - iam *iam.IAM - lambda *lambda.Lambda - s3 *s3.S3 - sns *sns.SNS - sts *sts.STS -} - -const regionConfig = "aws:config:region" - -func New(host *provider.HostClient) (*Context, error) { - // Create an AWS session; note that this is safe to share among many operations. - glog.V(5).Infof("Creating a new AWS session object w/ default credentials") - // IDEA: consider verifying credentials, region, etc. here. - // IDEA: currently we just inherit the standard AWS SDK credentials logic; eventually we will want more - // flexibility, I assume, including possibly reading from configuration dynamically. - var config []*aws.Config - if host != nil { - reg, err := host.ReadLocation(regionConfig) - if err != nil { - return nil, err - } else if !reg.IsNull() { - if !reg.IsString() { - return nil, errors.Errorf("Expected a string for AWS region config '%v'; got %v", regionConfig, reg) - } - config = append(config, &aws.Config{Region: aws.String(reg.StringValue())}) - } - } - sess, err := session.NewSession(config...) - if err != nil { - return nil, err - } - contract.Assert(sess != nil) - - // Allocate the context early since we are about to use it to access the IAM service. Its usage is inherently - // limited until we have finished construction (in other words, completion of the present function). - ctx := &Context{sess: sess} - // Query the IAM service to fetch the IAM user and role information. - glog.V(5).Infof("Querying AWS STS for profile metadata") - identity, err := ctx.STS().GetCallerIdentity(nil) - if err != nil { - return nil, err - } - contract.Assert(identity != nil) - ctx.accountID = aws.StringValue(identity.Account) - ctx.accountRole = aws.StringValue(identity.Arn) - user := aws.StringValue(identity.UserId) - glog.V(7).Infof("AWS STS identity received: %v (id=%v role=%v)", user, ctx.accountID, ctx.accountRole) - - return ctx, nil -} - -func (ctx *Context) AccountID() string { return ctx.accountID } -func (ctx *Context) Region() string { return *ctx.sess.Config.Region } - -func (ctx *Context) APIGateway() *apigateway.APIGateway { - contract.Assert(ctx.sess != nil) - if ctx.apigateway == nil { - ctx.apigateway = apigateway.New(ctx.sess) - } - return ctx.apigateway -} - -func (ctx *Context) CloudwatchLogs() *cloudwatchlogs.CloudWatchLogs { - contract.Assert(ctx.sess != nil) - if ctx.cloudwatchlogs == nil { - ctx.cloudwatchlogs = cloudwatchlogs.New(ctx.sess) - } - return ctx.cloudwatchlogs -} - -func (ctx *Context) DynamoDB() *dynamodb.DynamoDB { - contract.Assert(ctx.sess != nil) - if ctx.dynamodb == nil { - ctx.dynamodb = dynamodb.New(ctx.sess) - } - return ctx.dynamodb -} - -func (ctx *Context) EC2() *ec2.EC2 { - contract.Assert(ctx.sess != nil) - if ctx.ec2 == nil { - ctx.ec2 = ec2.New(ctx.sess) - } - return ctx.ec2 -} - -func (ctx *Context) ElasticBeanstalk() *elasticbeanstalk.ElasticBeanstalk { - contract.Assert(ctx.sess != nil) - if ctx.elasticbeanstalk == nil { - ctx.elasticbeanstalk = elasticbeanstalk.New(ctx.sess) - } - return ctx.elasticbeanstalk -} - -func (ctx *Context) IAM() *iam.IAM { - contract.Assert(ctx.sess != nil) - if ctx.iam == nil { - ctx.iam = iam.New(ctx.sess) - } - return ctx.iam -} - -func (ctx *Context) Lambda() *lambda.Lambda { - contract.Assert(ctx.sess != nil) - if ctx.lambda == nil { - ctx.lambda = lambda.New(ctx.sess) - } - return ctx.lambda -} - -func (ctx *Context) S3() *s3.S3 { - contract.Assert(ctx.sess != nil) - if ctx.s3 == nil { - ctx.s3 = s3.New(ctx.sess) - } - return ctx.s3 -} - -func (ctx *Context) SNS() *sns.SNS { - contract.Assert(ctx.sess != nil) - if ctx.sns == nil { - ctx.sns = sns.New(ctx.sess) - } - return ctx.sns -} - -func (ctx *Context) STS() *sts.STS { - contract.Assert(ctx.sess != nil) - if ctx.sts == nil { - ctx.sts = sts.New(ctx.sess) - } - return ctx.sts -} - -// Request manufactures a standard Golang context object for a request within this overall AWS context. -func (ctx *Context) Request() context.Context { - // IDEA: unify this with the gRPC context; this will be easier once gRPC moves to the standard Golang context. - return context.Background() -} diff --git a/lib/aws/provider/awsctx/errors.go b/lib/aws/provider/awsctx/errors.go deleted file mode 100644 index b81e21724..000000000 --- a/lib/aws/provider/awsctx/errors.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package awsctx - -import ( - "github.com/aws/aws-sdk-go/aws/awserr" -) - -// IsAWSError returns true if the given error is an AWS error; if codes is non-zero in length, an AWS error with any one -// of these codes will return true; if codes is empty, then any AWS error is accepted. -func IsAWSError(err error, codes ...string) bool { - if erraws, iserraws := err.(awserr.Error); iserraws { - if len(codes) == 0 { - return true - } - for _, code := range codes { - if erraws.Code() == code { - return true - } - } - } - return false -} - -// IsAWSErrorMessage returns true if the given error is an AWS error with the given code and message. -func IsAWSErrorMessage(err error, code string, message string) bool { - if erraws, iserraws := err.(awserr.Error); iserraws { - if erraws.Code() == code && erraws.Message() == message { - return true - } - } - return false -} diff --git a/lib/aws/provider/awsctx/hashset.go b/lib/aws/provider/awsctx/hashset.go deleted file mode 100644 index f870eb876..000000000 --- a/lib/aws/provider/awsctx/hashset.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package awsctx - -// HashSet is a set of items with set identity determined by a key hash, and with the ability to compute the -// set-based add/delete/update diff based on a value hash. -// -// For many AWS resources, array-valued properties are actually logically treated as sets key'd by some subset of the -// element object properties. See TODO[pulumi/lumi#178] for additional work to support this pattern in Lumi. -type HashSet struct { - items map[Hash]Hashable -} - -// Hash represents a hash value for use in a HashSet -type Hash string - -// Hashable is the element type for HashSets -type Hashable interface { - // Compute a key hash used to track identity in a HashSet - HashKey() Hash - // Compute a value hash used to track updates of items with the same key hash across HashSets - HashValue() Hash -} - -// Add an item to a HashSet. If an item with the same key hash was already present, it is overwritten and the -// conflicting Hash is returned. If there was no item with the same key has already present, nil is returned. -func (set *HashSet) Add(item Hashable) *Hash { - key := item.HashKey() - _, existed := set.items[key] - set.items[key] = item - if existed { - return &key - } - return nil -} - -// Length returns the size of the set -func (set *HashSet) Length() int { return len(set.items) } - -// Diff computes the add/update/delete changes from an old to a new HashSet -func (set *HashSet) Diff(new *HashSet) *HashSetDiff { return newHashSetDiff(set, new) } - -// NewHashSet creates a new empty HashSet -func NewHashSet() *HashSet { return &HashSet{map[Hash]Hashable{}} } - -// HashSetDiff represents the add/update/delete diff between two HashSets -type HashSetDiff struct { - adds []Hashable - updates []Hashable - deletes []Hashable -} - -// Adds returns the items from the new HashSet whose key hash was not in the old HashSet -func (diff *HashSetDiff) Adds() []Hashable { return diff.adds } - -// Updates returns the items with the same key hash, but different value hashs in the old and new HashSet -func (diff *HashSetDiff) Updates() []Hashable { return diff.updates } - -// Deletes returns the items from the old HashSet whose key hash was not in the new HashSet -func (diff *HashSetDiff) Deletes() []Hashable { return diff.deletes } - -// AddOrUpdates returns all items tht were added or updates in the new HashSet -func (diff *HashSetDiff) AddOrUpdates() []Hashable { - result := make([]Hashable, 0, len(diff.updates)+len(diff.adds)) - result = append(result, diff.updates...) - result = append(result, diff.adds...) - return result -} - -func newHashSetDiff(old *HashSet, new *HashSet) *HashSetDiff { - hashSetDiff := HashSetDiff{ - adds: []Hashable{}, - updates: []Hashable{}, - deletes: []Hashable{}, - } - for key, val := range new.items { - oldVal, exists := old.items[key] - if exists { - if oldVal.HashValue() != val.HashValue() { - // If it exists in both, but with different values, it's an update - hashSetDiff.updates = append(hashSetDiff.updates, val) - } - } else { - // If it exists in new but not in old, its an add - hashSetDiff.adds = append(hashSetDiff.adds, val) - } - } - for key, val := range old.items { - _, exists := new.items[key] - if !exists { - // If it exists in old but not in new, its a delete - hashSetDiff.deletes = append(hashSetDiff.deletes, val) - } - } - return &hashSetDiff -} diff --git a/lib/aws/provider/awsctx/hashset_test.go b/lib/aws/provider/awsctx/hashset_test.go deleted file mode 100644 index 4a214adfe..000000000 --- a/lib/aws/provider/awsctx/hashset_test.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package awsctx - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -type Setting struct { - Namespace string - Name string - Value string -} - -var _ Hashable = Setting{} - -func (s Setting) HashKey() Hash { - return Hash(s.Namespace + ":" + s.Name) -} -func (s Setting) HashValue() Hash { - return Hash(s.Namespace + ":" + s.Name + ":" + s.Value) -} -func NewSettingHashSet(options *[]Setting) *HashSet { - set := NewHashSet() - if options == nil { - return set - } - for _, option := range *options { - set.Add(option) - } - return set -} - -func TestHashSetSimple(t *testing.T) { - items := &[]Setting{ - { - Namespace: "a", - Name: "b", - Value: "x", - }, - { - Namespace: "a", - Name: "c", - Value: "y", - }, - } - - set := NewSettingHashSet(items) - assert.Equal(t, 2, set.Length(), "expected length is 2") -} - -func TestHashSetConflicts(t *testing.T) { - items := &[]Setting{ - { - Namespace: "a", - Name: "b", - Value: "x", - }, - { - Namespace: "a", - Name: "b", - Value: "y", - }, - } - - set := NewSettingHashSet(items) - assert.Equal(t, 1, set.Length(), "expected length is 1") -} - -func TestHashSetDiffReorder(t *testing.T) { - itemsOld := &[]Setting{ - { - Namespace: "a", - Name: "b", - Value: "x", - }, - { - Namespace: "a", - Name: "c", - Value: "y", - }, - } - itemsNew := &[]Setting{ - { - Namespace: "a", - Name: "c", - Value: "y", - }, - { - Namespace: "a", - Name: "b", - Value: "x", - }, - } - - oldSet := NewSettingHashSet(itemsOld) - newSet := NewSettingHashSet(itemsNew) - d := oldSet.Diff(newSet) - assert.Equal(t, 0, len(d.Deletes()), "expected no deletes") - assert.Equal(t, 0, len(d.Adds()), "expected no adds") - assert.Equal(t, 0, len(d.Updates()), "expected no updates") -} - -func TestHashSetDiffUpdate(t *testing.T) { - itemsOld := &[]Setting{ - { - Namespace: "a", - Name: "b", - Value: "x", - }, - { - Namespace: "a", - Name: "c", - Value: "y", - }, - } - itemsNew := &[]Setting{ - { - Namespace: "a", - Name: "c", - Value: "z", - }, - { - Namespace: "a", - Name: "b", - Value: "x", - }, - } - - oldSet := NewSettingHashSet(itemsOld) - newSet := NewSettingHashSet(itemsNew) - d := oldSet.Diff(newSet) - assert.Equal(t, 0, len(d.Deletes()), "expected no deletes") - assert.Equal(t, 0, len(d.Adds()), "expected no adds") - assert.Equal(t, 1, len(d.Updates()), "expected 1 update") -} - -func TestHashSetDiffUpdateDeleteAndAdd(t *testing.T) { - itemsOld := &[]Setting{ - { // this is deleted - Namespace: "a", - Name: "b", - Value: "x", - }, - { // this is updated - Namespace: "a", - Name: "c", - Value: "y", - }, - } - itemsNew := &[]Setting{ - { - Namespace: "a", - Name: "c", - Value: "z", - }, - { // This is added - Namespace: "b", - Name: "a", - Value: "x", - }, - } - - oldSet := NewSettingHashSet(itemsOld) - newSet := NewSettingHashSet(itemsNew) - d := oldSet.Diff(newSet) - assert.Equal(t, 1, len(d.Deletes()), "expected 1 delete") - assert.Equal(t, 1, len(d.Adds()), "expected 1 add1") - assert.Equal(t, 1, len(d.Updates()), "expected 1 update") -} diff --git a/lib/aws/provider/awsctx/retry.go b/lib/aws/provider/awsctx/retry.go deleted file mode 100644 index 2d74a6eec..000000000 --- a/lib/aws/provider/awsctx/retry.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package awsctx - -import ( - "time" - - "github.com/pulumi/lumi/pkg/util/retry" -) - -const DefaultTimeout time.Duration = 1 * time.Minute // by default, wait at most 1 minute for things. -const DefaultTimeoutLong time.Duration = 20 * time.Minute // for really long operations, wait at most 20 minutes. - -// RetryUntil is a wrapper atop util.retry.Until that uses standard retry and backoff values for AWS operations. -func RetryUntil(ctx *Context, acc retry.Acceptance) (bool, error) { - return retry.UntilTimeout(ctx.Request(), retry.Acceptor{ - Accept: acc, - Progress: nil, - }, DefaultTimeout) -} - -// RetryProgUntil is a wrapper atop util.retry.Until that uses standard retry and backoff values for AWS operations. -// It is identical to RetryUntil except that it also accepts a progress reporter. -func RetryProgUntil(ctx *Context, acc retry.Acceptance, progress retry.Progress) (bool, error) { - return retry.UntilTimeout(ctx.Request(), retry.Acceptor{ - Accept: acc, - Progress: progress, - }, DefaultTimeout) -} - -// RetryUntilLong is a wrapper atop util.retry.Until that uses standard retry and backoff values for AWS operations. -func RetryUntilLong(ctx *Context, acc retry.Acceptance) (bool, error) { - return retry.UntilTimeout(ctx.Request(), retry.Acceptor{ - Accept: acc, - Progress: nil, - }, DefaultTimeoutLong) -} - -// RetryProgUntilLong is a wrapper atop util.retry.Until that uses standard retry and backoff values for AWS operations. -// It is identical to RetryUntilLong except that it also accepts a progress reporter. -func RetryProgUntilLong(ctx *Context, acc retry.Acceptance, progress retry.Progress) (bool, error) { - return retry.UntilTimeout(ctx.Request(), retry.Acceptor{ - Accept: acc, - Progress: progress, - }, DefaultTimeoutLong) -} diff --git a/lib/aws/provider/cloudwatch/logGroup.go b/lib/aws/provider/cloudwatch/logGroup.go deleted file mode 100644 index 253adaebf..000000000 --- a/lib/aws/provider/cloudwatch/logGroup.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package cloudwatch - -import ( - "crypto/sha1" - "fmt" - "regexp" - - "github.com/aws/aws-sdk-go/aws" - awscloudwatch "github.com/aws/aws-sdk-go/service/cloudwatchlogs" - "github.com/pkg/errors" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/convutil" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/cloudwatch" -) - -const LogGroupToken = cloudwatch.LogGroupToken - -// constants for the various logGroup limits. -const ( - minLogGroupName = 1 - maxLogGroupName = 512 -) - -var ( - logGroupNameRegexp = regexp.MustCompile(`^[\.\-_/#A-Za-z0-9]+$`) -) - -// NewLogGroupProvider creates a provider that handles Cloudwatch LogGroup operations. -func NewLogGroupProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &logGroupProvider{ctx} - return cloudwatch.NewLogGroupProvider(ops) -} - -type logGroupProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *logGroupProvider) Check(ctx context.Context, obj *cloudwatch.LogGroup, - property string) error { - switch property { - case cloudwatch.LogGroup_LogGroupName: - if obj.LogGroupName != nil { - if len(*obj.LogGroupName) < minLogGroupName { - return fmt.Errorf("less than minimum length of %v", minLogGroupName) - } else if len(*obj.LogGroupName) > maxLogGroupName { - return fmt.Errorf("exceeded the maximum length of %v", maxLogGroupName) - } else if !logGroupNameRegexp.MatchString(*obj.LogGroupName) { - return fmt.Errorf("contains invalid characters (must match '%v')", logGroupNameRegexp) - } - } - case cloudwatch.LogGroup_RetentionInDays: - if obj.RetentionInDays != nil { - switch int(*obj.RetentionInDays) { - case 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653: - default: - return fmt.Errorf("not an allowed value for retentionInDays '%v'", int(*obj.RetentionInDays)) - } - } - } - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *logGroupProvider) Create(ctx context.Context, - obj *cloudwatch.LogGroup) (resource.ID, error) { - // If an explicit name is given, use it. Otherwise, auto-generate a name in part based on the resource name. - var name string - if obj.LogGroupName != nil { - name = *obj.LogGroupName - } else { - name = resource.NewUniqueHex(*obj.Name+"-", maxLogGroupName, sha1.Size) - } - - _, err := p.ctx.CloudwatchLogs().CreateLogGroup(&awscloudwatch.CreateLogGroupInput{ - LogGroupName: aws.String(name), - }) - if err != nil { - return "", err - } - - if obj.RetentionInDays != nil { - _, err := p.ctx.CloudwatchLogs().PutRetentionPolicy(&awscloudwatch.PutRetentionPolicyInput{ - LogGroupName: aws.String(name), - RetentionInDays: convutil.Float64PToInt64P(obj.RetentionInDays), - }) - if err != nil { - return "", err - } - } - - return arn.NewResourceID("logs", p.ctx.Region(), p.ctx.AccountID(), "log-group", name), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *logGroupProvider) Get(ctx context.Context, - id resource.ID) (*cloudwatch.LogGroup, error) { - logGroupName, err := arn.ParseResourceName(id) - if err != nil { - return nil, err - } - - resp, err := p.ctx.CloudwatchLogs().DescribeLogGroups(&awscloudwatch.DescribeLogGroupsInput{ - LogGroupNamePrefix: aws.String(logGroupName), - }) - if err != nil { - return nil, err - } else if resp == nil { - return nil, errors.New("Cloudwatch query returned an empty response") - } - var logGroup *awscloudwatch.LogGroup - for _, group := range resp.LogGroups { - if *group.LogGroupName == logGroupName { - logGroup = group - } - } - if logGroup == nil { - return nil, nil - } - - return &cloudwatch.LogGroup{ - LogGroupName: aws.String(logGroupName), - RetentionInDays: convutil.Int64PToFloat64P(logGroup.RetentionInDays), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *logGroupProvider) InspectChange(ctx context.Context, id resource.ID, - old *cloudwatch.LogGroup, new *cloudwatch.LogGroup, - diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *logGroupProvider) Update(ctx context.Context, id resource.ID, - old *cloudwatch.LogGroup, new *cloudwatch.LogGroup, diff *resource.ObjectDiff) error { - logGroupName, err := arn.ParseResourceName(id) - if err != nil { - return err - } - if diff.Changed(cloudwatch.LogGroup_RetentionInDays) { - if new.RetentionInDays != nil { - _, err := p.ctx.CloudwatchLogs().PutRetentionPolicy(&awscloudwatch.PutRetentionPolicyInput{ - LogGroupName: aws.String(logGroupName), - RetentionInDays: convutil.Float64PToInt64P(new.RetentionInDays), - }) - if err != nil { - return err - } - } - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *logGroupProvider) Delete(ctx context.Context, id resource.ID) error { - logGroupName, err := arn.ParseResourceName(id) - if err != nil { - return err - } - fmt.Printf("Deleting Cloudwatch LogGroup '%v'\n", id) - _, err = p.ctx.CloudwatchLogs().DeleteLogGroup(&awscloudwatch.DeleteLogGroupInput{ - LogGroupName: aws.String(logGroupName), - }) - return err -} diff --git a/lib/aws/provider/cloudwatch/logSubscriptionFilter.go b/lib/aws/provider/cloudwatch/logSubscriptionFilter.go deleted file mode 100644 index 88289f2bf..000000000 --- a/lib/aws/provider/cloudwatch/logSubscriptionFilter.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package cloudwatch - -import ( - "crypto/sha1" - "fmt" - "strings" - - "github.com/aws/aws-sdk-go/aws" - awscloudwatch "github.com/aws/aws-sdk-go/service/cloudwatchlogs" - "github.com/pkg/errors" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/convutil" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - awscommon "github.com/pulumi/lumi/lib/aws/rpc" - "github.com/pulumi/lumi/lib/aws/rpc/cloudwatch" -) - -const LogSubscriptionFilterToken = cloudwatch.LogSubscriptionFilterToken - -// constants for the various logSubscriptionFilter limits. -const ( - maxLogSubscriptionFilterName = 512 -) - -// NewLogSubscriptionFilterProvider creates a provider that handles Cloudwatch LogSubscriptionFilter operations. -func NewLogSubscriptionFilterProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &logSubscriptionFilterProvider{ctx} - return cloudwatch.NewLogSubscriptionFilterProvider(ops) -} - -type logSubscriptionFilterProvider struct { - ctx *awsctx.Context -} - -func (p *logSubscriptionFilterProvider) newLogSubscriptionFilterID(logGroupName string, - filterName string) resource.ID { - return arn.NewResourceID("logs", p.ctx.Region(), p.ctx.AccountID(), "log-group", - logGroupName+":subscription-filter:"+filterName) -} - -func (p *logSubscriptionFilterProvider) parseLogSubscriptionFilterID(id resource.ID) (string, string, error) { - parts, err := arn.ARN(id).Parse() - if err != nil { - return "", "", err - } - resParts := strings.Split(parts.Resource, ":") - contract.Assert(len(resParts) == 4) - logGroupName := resParts[1] - filterName := resParts[3] - return logGroupName, filterName, nil -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *logSubscriptionFilterProvider) Check(ctx context.Context, obj *cloudwatch.LogSubscriptionFilter, - property string) error { - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *logSubscriptionFilterProvider) Create(ctx context.Context, - obj *cloudwatch.LogSubscriptionFilter) (resource.ID, error) { - name := resource.NewUniqueHex(*obj.Name+"-", maxLogSubscriptionFilterName, sha1.Size) - - var roleArn *string - if obj.RoleARN != nil { - tmp := string(*obj.RoleARN) - roleArn = &tmp - } - var distribution *string - if obj.Distribution != nil { - tmp := string(*obj.Distribution) - distribution = &tmp - } - - filter := &awscloudwatch.PutSubscriptionFilterInput{ - FilterName: aws.String(name), - LogGroupName: aws.String(obj.LogGroupName), - DestinationArn: aws.String(obj.DestinationArn), - FilterPattern: aws.String(obj.FilterPattern), - RoleArn: roleArn, - Distribution: distribution, - } - - _, err := p.ctx.CloudwatchLogs().PutSubscriptionFilter(filter) - if err != nil { - return "", err - } - - return p.newLogSubscriptionFilterID(obj.LogGroupName, name), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *logSubscriptionFilterProvider) Get(ctx context.Context, - id resource.ID) (*cloudwatch.LogSubscriptionFilter, error) { - logGroupName, filterName, err := p.parseLogSubscriptionFilterID(id) - if err != nil { - return nil, err - } - - resp, err := p.ctx.CloudwatchLogs().DescribeSubscriptionFilters(&awscloudwatch.DescribeSubscriptionFiltersInput{ - LogGroupName: aws.String(logGroupName), - }) - if err != nil { - return nil, err - } else if resp == nil { - return nil, errors.New("Cloudwatch query returned an empty response") - } else if len(resp.SubscriptionFilters) == 0 { - return nil, nil - } else if len(resp.SubscriptionFilters) > 1 { - return nil, errors.New("Only one subscription filter expected per log group") - } - filter := resp.SubscriptionFilters[0] - contract.Assert(*filter.FilterName == filterName) - - var distribution *cloudwatch.LogSubscriptionDistribution - if filter.Distribution != nil { - tmp := cloudwatch.LogSubscriptionDistribution(*filter.Distribution) - distribution = &tmp - } - var roleARN *awscommon.ARN - if filter.RoleArn != nil { - tmp := awscommon.ARN(*filter.RoleArn) - roleARN = &tmp - } - return &cloudwatch.LogSubscriptionFilter{ - LogGroupName: logGroupName, - DestinationArn: aws.StringValue(filter.DestinationArn), - CreationTime: convutil.Int64PToFloat64P(filter.CreationTime), - Distribution: distribution, - RoleARN: roleARN, - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *logSubscriptionFilterProvider) InspectChange(ctx context.Context, id resource.ID, - old *cloudwatch.LogSubscriptionFilter, new *cloudwatch.LogSubscriptionFilter, - diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *logSubscriptionFilterProvider) Update(ctx context.Context, id resource.ID, - old *cloudwatch.LogSubscriptionFilter, new *cloudwatch.LogSubscriptionFilter, diff *resource.ObjectDiff) error { - contract.Failf("Not yet implemented - log subscription filter update") - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *logSubscriptionFilterProvider) Delete(ctx context.Context, id resource.ID) error { - logGroupName, filterName, err := p.parseLogSubscriptionFilterID(id) - if err != nil { - return err - } - fmt.Printf("Deleting Cloudwatch LogSubscriptionFilter '%v'\n", id) - _, err = p.ctx.CloudwatchLogs().DeleteSubscriptionFilter(&awscloudwatch.DeleteSubscriptionFilterInput{ - LogGroupName: aws.String(logGroupName), - FilterName: aws.String(filterName), - }) - return err -} diff --git a/lib/aws/provider/dynamodb/table.go b/lib/aws/provider/dynamodb/table.go deleted file mode 100644 index 928b1f4b6..000000000 --- a/lib/aws/provider/dynamodb/table.go +++ /dev/null @@ -1,552 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package dynamodb - -import ( - "crypto/sha1" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - awsdynamodb "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/pkg/errors" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/dynamodb" -) - -const TableToken = dynamodb.TableToken - -// constants for the various table limits. -const ( - minTableName = 3 - maxTableName = 255 - minTableAttributeName = 1 - maxTableAttributeName = 255 - minReadCapacity = 1 - minWriteCapacity = 1 - maxGlobalSecondaryIndexes = 5 -) - -const ( - // hashKeyAttribute is a partition key, also known as its hash attribute. The term "hash attribute" derives from - // DynamoDB's usage of an internal hash function to evenly distribute data items across partitions based on their - // partition key values. - hashKeyAttribute = "HASH" - // rangeKeyType is a sort key, also known as its range attribute. The term "range attribute" derives from the way - // DynamoDB stores items with the same partition key physically close together, sorted by the sort key value. - rangeKeyAttribute = "RANGE" -) - -// NewTableProvider creates a provider that handles DynamoDB Table operations. -func NewTableProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &tableProvider{ctx} - return dynamodb.NewTableProvider(ops) -} - -type tableProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *tableProvider) Check(ctx context.Context, obj *dynamodb.Table, property string) error { - switch property { - case dynamodb.Table_Name: - if name := obj.TableName; name != nil { - if len(*name) < minTableName { - return fmt.Errorf("less than minimum length of %v", minTableName) - } - if len(*name) > maxTableName { - return fmt.Errorf("exceeded maximum length of %v", maxTableName) - } - // TODO[pulumi/lumi#216]: check the vailidity of names ([a-zA-Z0-9_.-]+). - } - case dynamodb.Table_ReadCapacity: - if obj.ReadCapacity < minReadCapacity { - return fmt.Errorf("less than minimum of %v", minReadCapacity) - } - case dynamodb.Table_WriteCapacity: - if obj.WriteCapacity < minWriteCapacity { - return fmt.Errorf("less than minimum of %v", minWriteCapacity) - } - case dynamodb.Table_Attributes: - for _, attr := range obj.Attributes { - if len(attr.Name) < minTableAttributeName { - return fmt.Errorf("attribute name '%v' less than minimum length of %v", - attr.Name, minTableAttributeName) - } - if len(attr.Name) > maxTableAttributeName { - return fmt.Errorf("attribute name '%v' exceeded maximum length of %v", - attr.Name, maxTableAttributeName) - } - if attr.Type != "S" && attr.Type != "N" && attr.Type != "B" { - return fmt.Errorf( - "attribute type '%v' not one of valid values S (string), N (number) or B (binary)", attr.Type) - } - } - case dynamodb.Table_GlobalSecondaryIndexes: - if obj.GlobalSecondaryIndexes != nil { - gsis := *obj.GlobalSecondaryIndexes - if len(gsis) > maxGlobalSecondaryIndexes { - return fmt.Errorf("more than %v global secondary indexes requested", maxGlobalSecondaryIndexes) - } - for _, gsi := range gsis { - name := gsi.IndexName - if len(name) < minTableName { - return fmt.Errorf("index name '%v' less than minimum length of %v", name, minTableName) - } - if len(name) > maxTableName { - return fmt.Errorf("index name '%v' exceeded maximum length of %v", name, maxTableName) - } - if gsi.ReadCapacity < minReadCapacity { - return fmt.Errorf("read capacity %v less than minimum of %v", gsi.ReadCapacity, minReadCapacity) - } - if gsi.WriteCapacity < minWriteCapacity { - return fmt.Errorf("write capacity %v less than minimum of %v", gsi.WriteCapacity, minWriteCapacity) - } - } - } - } - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *tableProvider) Create(ctx context.Context, obj *dynamodb.Table) (resource.ID, error) { - // If an explicit name is given, use it. Otherwise, auto-generate a name in part based on the resource name. - var name string - if obj.TableName != nil { - name = *obj.TableName - } else { - name = resource.NewUniqueHex(*obj.Name+"-", maxTableName, sha1.Size) - } - - var attributeDefinitions []*awsdynamodb.AttributeDefinition - for _, attr := range obj.Attributes { - attributeDefinitions = append(attributeDefinitions, &awsdynamodb.AttributeDefinition{ - AttributeName: aws.String(attr.Name), - AttributeType: aws.String(string(attr.Type)), - }) - } - - fmt.Printf("Creating DynamoDB Table '%v' with name '%v'\n", *obj.Name, name) - keySchema := []*awsdynamodb.KeySchemaElement{ - { - AttributeName: aws.String(obj.HashKey), - KeyType: aws.String(hashKeyAttribute), - }, - } - if obj.RangeKey != nil { - keySchema = append(keySchema, &awsdynamodb.KeySchemaElement{ - AttributeName: obj.RangeKey, - KeyType: aws.String(rangeKeyAttribute), - }) - } - create := &awsdynamodb.CreateTableInput{ - TableName: aws.String(name), - AttributeDefinitions: attributeDefinitions, - KeySchema: keySchema, - ProvisionedThroughput: &awsdynamodb.ProvisionedThroughput{ - ReadCapacityUnits: aws.Int64(int64(obj.ReadCapacity)), - WriteCapacityUnits: aws.Int64(int64(obj.WriteCapacity)), - }, - } - if obj.GlobalSecondaryIndexes != nil { - var gsis []*awsdynamodb.GlobalSecondaryIndex - for _, gsi := range *obj.GlobalSecondaryIndexes { - keySchema := []*awsdynamodb.KeySchemaElement{ - { - AttributeName: aws.String(gsi.HashKey), - KeyType: aws.String(hashKeyAttribute), - }, - } - if gsi.RangeKey != nil { - keySchema = append(keySchema, &awsdynamodb.KeySchemaElement{ - AttributeName: gsi.RangeKey, - KeyType: aws.String(rangeKeyAttribute), - }) - } - gsis = append(gsis, &awsdynamodb.GlobalSecondaryIndex{ - IndexName: aws.String(gsi.IndexName), - KeySchema: keySchema, - ProvisionedThroughput: &awsdynamodb.ProvisionedThroughput{ - ReadCapacityUnits: aws.Int64(int64(gsi.ReadCapacity)), - WriteCapacityUnits: aws.Int64(int64(gsi.WriteCapacity)), - }, - Projection: &awsdynamodb.Projection{ - NonKeyAttributes: aws.StringSlice(gsi.NonKeyAttributes), - ProjectionType: aws.String(string(gsi.ProjectionType)), - }, - }) - } - create.GlobalSecondaryIndexes = gsis - } - - // Now go ahead and perform the action. - var arn string - if resp, err := p.ctx.DynamoDB().CreateTable(create); err != nil { - return "", err - } else if resp == nil || resp.TableDescription == nil || resp.TableDescription.TableArn == nil { - return "", errors.New("DynamoDB table created, but AWS did not return an ARN for it") - } else { - arn = *resp.TableDescription.TableArn - } - - // Wait for the table to be ready and then return the ID (just its name). - fmt.Printf("DynamoDB Table created: %v; waiting for it to become active\n", name) - if err := p.waitForTableState(name, true); err != nil { - return "", err - } - return resource.ID(arn), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *tableProvider) Get(ctx context.Context, id resource.ID) (*dynamodb.Table, error) { - name, err := arn.ParseResourceName(id) - if err != nil { - if awsctx.IsAWSError(err, "ResourceNotFoundException") { - return nil, nil - } - return nil, err - } - resp, err := p.ctx.DynamoDB().DescribeTable(&awsdynamodb.DescribeTableInput{TableName: aws.String(name)}) - if err != nil { - return nil, err - } else if resp == nil || resp.Table == nil { - return nil, errors.New("DynamoDB query returned an empty response or table") - } - - // The object was found, we need to reverse map a bunch of properties into the structure form. - tab := resp.Table - - var attributes []dynamodb.Attribute - for _, attr := range tab.AttributeDefinitions { - attributes = append(attributes, dynamodb.Attribute{ - Name: aws.StringValue(attr.AttributeName), - Type: dynamodb.AttributeType(aws.StringValue(attr.AttributeType)), - }) - } - - hashKey, rangeKey := getHashRangeKeys(tab.KeySchema) - if hashKey == nil { - return nil, errors.New("Missing hash key in table schema") - } - - var gsis *[]dynamodb.GlobalSecondaryIndex - if len(tab.GlobalSecondaryIndexes) > 0 { - var gis []dynamodb.GlobalSecondaryIndex - for _, gsid := range tab.GlobalSecondaryIndexes { - hk, rk := getHashRangeKeys(gsid.KeySchema) - if hk == nil { - return nil, errors.New("Missing hash key in table global secondary index") - } - gis = append(gis, dynamodb.GlobalSecondaryIndex{ - IndexName: aws.StringValue(gsid.IndexName), - HashKey: *hk, - ReadCapacity: float64(aws.Int64Value(gsid.ProvisionedThroughput.ReadCapacityUnits)), - WriteCapacity: float64(aws.Int64Value(gsid.ProvisionedThroughput.WriteCapacityUnits)), - RangeKey: rk, - NonKeyAttributes: aws.StringValueSlice(gsid.Projection.NonKeyAttributes), - ProjectionType: dynamodb.ProjectionType(*gsid.Projection.ProjectionType), - }) - } - gsis = &gis - } - - return &dynamodb.Table{ - HashKey: *hashKey, - Attributes: attributes, - ReadCapacity: float64(aws.Int64Value(tab.ProvisionedThroughput.ReadCapacityUnits)), - WriteCapacity: float64(aws.Int64Value(tab.ProvisionedThroughput.WriteCapacityUnits)), - RangeKey: rangeKey, - TableName: tab.TableName, - GlobalSecondaryIndexes: gsis, - }, nil -} - -func getHashRangeKeys(schema []*awsdynamodb.KeySchemaElement) (*string, *string) { - var hashKey *string - var rangeKey *string - for _, elem := range schema { - switch aws.StringValue(elem.KeyType) { - case hashKeyAttribute: - hashKey = elem.AttributeName - case rangeKeyAttribute: - rangeKey = elem.AttributeName - default: - contract.Failf("Unexpected key schema attribute type: %v", *elem.KeyType) - } - } - return hashKey, rangeKey -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *tableProvider) InspectChange(ctx context.Context, id resource.ID, - old *dynamodb.Table, new *dynamodb.Table, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *tableProvider) Update(ctx context.Context, id resource.ID, - old *dynamodb.Table, new *dynamodb.Table, diff *resource.ObjectDiff) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - // Note: Changing dynamodb.Table_Attributes alone does not trigger an update on the resource, it must be changed - // along with using the new attributes in an index. The latter will process the update. - - // Per DynamoDB documention at http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html: - - // You can only perform one of the following operations at once: - // * Modify the provisioned throughput settings of the table. - // * Enable or disable Streams on the table. - // * Remove a global secondary index from the table. - // * Create a new global secondary index on the table. Once the index begins backfilling, you can use - // UpdateTable to perform other operations. - - // So we have to serialize each of the requested updates and potentially make multiple calls to UpdateTable, waiting - // for the Table to reach the ready state between calls. - - // First modify provisioned throughput if needed. - if diff.Changed(dynamodb.Table_ReadCapacity) || diff.Changed(dynamodb.Table_WriteCapacity) { - fmt.Printf("Updating provisioned capacity for DynamoDB Table %v\n", aws.String(name)) - update := &awsdynamodb.UpdateTableInput{ - TableName: aws.String(name), - ProvisionedThroughput: &awsdynamodb.ProvisionedThroughput{ - ReadCapacityUnits: aws.Int64(int64(new.ReadCapacity)), - WriteCapacityUnits: aws.Int64(int64(new.WriteCapacity)), - }, - } - if err := p.updateTable(name, update); err != nil { - return err - } - } - - // Next, delete and create global secondary indexes. - if diff.Changed(dynamodb.Table_GlobalSecondaryIndexes) { - newGlobalSecondaryIndexes := newGlobalSecondaryIndexHashSet(new.GlobalSecondaryIndexes) - oldGlobalSecondaryIndexes := newGlobalSecondaryIndexHashSet(old.GlobalSecondaryIndexes) - d := oldGlobalSecondaryIndexes.Diff(newGlobalSecondaryIndexes) - // First, add any new indexes - for _, o := range d.Adds() { - gsi := o.(globalSecondaryIndexHash).item - fmt.Printf("Adding new global secondary index %v for DynamoDB Table %v\n", gsi.IndexName, name) - keySchema := []*awsdynamodb.KeySchemaElement{ - { - AttributeName: aws.String(gsi.HashKey), - KeyType: aws.String(hashKeyAttribute), - }, - } - if gsi.RangeKey != nil { - keySchema = append(keySchema, &awsdynamodb.KeySchemaElement{ - AttributeName: gsi.RangeKey, - KeyType: aws.String(rangeKeyAttribute), - }) - } - var attributeDefinitions []*awsdynamodb.AttributeDefinition - for _, attr := range new.Attributes { - attributeDefinitions = append(attributeDefinitions, &awsdynamodb.AttributeDefinition{ - AttributeName: aws.String(attr.Name), - AttributeType: aws.String(string(attr.Type)), - }) - } - update := &awsdynamodb.UpdateTableInput{ - TableName: aws.String(name), - AttributeDefinitions: attributeDefinitions, - GlobalSecondaryIndexUpdates: []*awsdynamodb.GlobalSecondaryIndexUpdate{ - { - Create: &awsdynamodb.CreateGlobalSecondaryIndexAction{ - IndexName: aws.String(gsi.IndexName), - KeySchema: keySchema, - ProvisionedThroughput: &awsdynamodb.ProvisionedThroughput{ - ReadCapacityUnits: aws.Int64(int64(gsi.ReadCapacity)), - WriteCapacityUnits: aws.Int64(int64(gsi.WriteCapacity)), - }, - Projection: &awsdynamodb.Projection{ - NonKeyAttributes: aws.StringSlice(gsi.NonKeyAttributes), - ProjectionType: aws.String(string(gsi.ProjectionType)), - }, - }, - }, - }, - } - if err := p.updateTable(name, update); err != nil { - return err - } - } - // Next, modify provisioned throughput on any updated indexes - for _, o := range d.Updates() { - gsi := o.(globalSecondaryIndexHash).item - fmt.Printf("Updating capacity for global secondary index %v for DynamoDB Table %v\n", gsi.IndexName, name) - update := &awsdynamodb.UpdateTableInput{ - TableName: aws.String(name), - GlobalSecondaryIndexUpdates: []*awsdynamodb.GlobalSecondaryIndexUpdate{ - { - Update: &awsdynamodb.UpdateGlobalSecondaryIndexAction{ - IndexName: aws.String(gsi.IndexName), - ProvisionedThroughput: &awsdynamodb.ProvisionedThroughput{ - ReadCapacityUnits: aws.Int64(int64(gsi.ReadCapacity)), - WriteCapacityUnits: aws.Int64(int64(gsi.WriteCapacity)), - }, - }, - }, - }, - } - if err := p.updateTable(name, update); err != nil { - return err - } - } - // Finally, delete and removed indexes - for _, o := range d.Deletes() { - gsi := o.(globalSecondaryIndexHash).item - fmt.Printf("Deleting global secondary index %v for DynamoDB Table %v\n", gsi.IndexName, name) - update := &awsdynamodb.UpdateTableInput{ - TableName: aws.String(name), - GlobalSecondaryIndexUpdates: []*awsdynamodb.GlobalSecondaryIndexUpdate{ - { - Delete: &awsdynamodb.DeleteGlobalSecondaryIndexAction{ - IndexName: aws.String(gsi.IndexName), - }, - }, - }, - } - if err := p.updateTable(name, update); err != nil { - return err - } - } - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *tableProvider) Delete(ctx context.Context, id resource.ID) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - // First, perform the deletion. - fmt.Printf("Deleting DynamoDB Table '%v'\n", name) - if succ, err := awsctx.RetryUntilLong( - p.ctx, - func() (bool, error) { - if _, delerr := p.ctx.DynamoDB().DeleteTable(&awsdynamodb.DeleteTableInput{ - TableName: aws.String(name), - }); delerr != nil { - if awsctx.IsAWSError(delerr, awsdynamodb.ErrCodeResourceNotFoundException) { - return true, nil - } else if awsctx.IsAWSError(delerr, awsdynamodb.ErrCodeResourceInUseException) { - return false, nil - } - return false, delerr // anything else is a real error; propagate it. - } - return true, nil - }, - ); err != nil { - return err - } else if !succ { - return fmt.Errorf("DynamoDB table '%v' could not be deleted", name) - } - - // Wait for the table to actually become deleted before returning. - fmt.Printf("DynamoDB Table delete request submitted; waiting for it to delete\n") - return p.waitForTableState(name, false) -} - -func (p *tableProvider) updateTable(name string, update *awsdynamodb.UpdateTableInput) error { - succ, err := awsctx.RetryUntil( - p.ctx, - func() (bool, error) { - _, err := p.ctx.DynamoDB().UpdateTable(update) - if err != nil { - if awsctx.IsAWSError(err, "ResourceNotFoundException", "ResourceInUseException") { - fmt.Printf("Waiting to update resource '%v': %v", name, err.(awserr.Error).Message()) - return false, nil - } - return false, err // anything else is a real error; propagate it. - } - return true, nil - }, - ) - if err != nil { - return err - } - if !succ { - return fmt.Errorf("DynamoDB table '%v' could not be updated", name) - } - if err := p.waitForTableState(name, true); err != nil { - return err - } - return nil -} - -func (p *tableProvider) waitForTableState(name string, exist bool) error { - succ, err := awsctx.RetryUntilLong( - p.ctx, - func() (bool, error) { - description, err := p.ctx.DynamoDB().DescribeTable(&awsdynamodb.DescribeTableInput{ - TableName: aws.String(name), - }) - - if err != nil { - if awsctx.IsAWSError(err, "ResourceNotFoundException") { - // The table is missing; if exist==false, we're good, otherwise keep retrying. - return !exist, nil - } - return false, err // anything other than "ResourceNotFoundException" is a real error; propagate it. - } - - if exist && aws.StringValue(description.Table.TableStatus) != "ACTIVE" { - return false, nil - } - - // If we got here, the table was found and was ACTIVE if exist is true; if exist==true, we're good; else, - // keep retrying. - return exist, nil - }, - ) - if err != nil { - return err - } - if !succ { - var reason string - if exist { - reason = "active" - } else { - reason = "deleted" - } - return fmt.Errorf("DynamoDB table '%v' did not become %v", name, reason) - } - return nil -} - -type globalSecondaryIndexHash struct { - item dynamodb.GlobalSecondaryIndex -} - -var _ awsctx.Hashable = globalSecondaryIndexHash{} - -func (option globalSecondaryIndexHash) HashKey() awsctx.Hash { - return awsctx.Hash(option.item.IndexName) -} -func (option globalSecondaryIndexHash) HashValue() awsctx.Hash { - return awsctx.Hash(string(int(option.item.ReadCapacity)) + ":" + string(int(option.item.WriteCapacity))) -} -func newGlobalSecondaryIndexHashSet(options *[]dynamodb.GlobalSecondaryIndex) *awsctx.HashSet { - set := awsctx.NewHashSet() - if options == nil { - return set - } - for _, option := range *options { - set.Add(globalSecondaryIndexHash{option}) - } - return set -} diff --git a/lib/aws/provider/dynamodb/table_test.go b/lib/aws/provider/dynamodb/table_test.go deleted file mode 100644 index e6ba7b92f..000000000 --- a/lib/aws/provider/dynamodb/table_test.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package dynamodb - -import ( - "fmt" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - awsdynamodb "github.com/aws/aws-sdk-go/service/dynamodb" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/provider/testutil" - "github.com/pulumi/lumi/lib/aws/rpc/dynamodb" - "github.com/pulumi/lumi/pkg/resource" - "github.com/stretchr/testify/assert" -) - -func Test(t *testing.T) { - t.Parallel() - - prefix := resource.NewUniqueHex("lumitest", 20, 20) - ctx := testutil.CreateContext(t) - defer func() { - err := cleanup(prefix, ctx) - assert.Nil(t, err) - }() - - testutil.ProviderTestSimple(t, NewTableProvider(ctx), TableToken, []interface{}{ - &dynamodb.Table{ - Name: aws.String(prefix), - Attributes: []dynamodb.Attribute{ - {Name: "Album", Type: "S"}, - {Name: "Artist", Type: "S"}, - {Name: "Sales", Type: "N"}, - }, - HashKey: "Album", - RangeKey: aws.String("Artist"), - ReadCapacity: 2, - WriteCapacity: 2, - GlobalSecondaryIndexes: &[]dynamodb.GlobalSecondaryIndex{ - { - IndexName: "myGSI", - HashKey: "Sales", - RangeKey: aws.String("Artist"), - ReadCapacity: 1, - WriteCapacity: 1, - NonKeyAttributes: []string{"Album"}, - ProjectionType: "INCLUDE", - }, - }, - }, - &dynamodb.Table{ - Name: aws.String(prefix), - Attributes: []dynamodb.Attribute{ - {Name: "Album", Type: "S"}, - {Name: "Artist", Type: "S"}, - {Name: "NumberOfSongs", Type: "N"}, - {Name: "Sales", Type: "N"}, - }, - HashKey: "Album", - RangeKey: aws.String("Artist"), - ReadCapacity: 1, - WriteCapacity: 1, - GlobalSecondaryIndexes: &[]dynamodb.GlobalSecondaryIndex{ - { - IndexName: "myGSI", - HashKey: "Sales", - RangeKey: aws.String("Artist"), - ReadCapacity: 1, - WriteCapacity: 1, - NonKeyAttributes: []string{"Album"}, - ProjectionType: "INCLUDE", - }, - { - IndexName: "myGSI2", - HashKey: "NumberOfSongs", - RangeKey: aws.String("Sales"), - NonKeyAttributes: []string{"Album", "Artist"}, - ProjectionType: "INCLUDE", - ReadCapacity: 1, - WriteCapacity: 1, - }, - }, - }, - }) -} - -func cleanup(prefix string, ctx *awsctx.Context) error { - fmt.Printf("Cleaning up tables with prefix: %v\n", prefix) - list, err := ctx.DynamoDB().ListTables(&awsdynamodb.ListTablesInput{}) - if err != nil { - return err - } - cleaned := 0 - for _, table := range list.TableNames { - if strings.HasPrefix(aws.StringValue(table), prefix) { - if _, delerr := ctx.DynamoDB().DeleteTable(&awsdynamodb.DeleteTableInput{ - TableName: table, - }); delerr != nil { - return delerr - } - cleaned++ - } - } - fmt.Printf("Cleaned up %v tables\n", cleaned) - return nil -} diff --git a/lib/aws/provider/ec2/instance.go b/lib/aws/provider/ec2/instance.go deleted file mode 100644 index a53728749..000000000 --- a/lib/aws/provider/ec2/instance.go +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "errors" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - awsec2 "github.com/aws/aws-sdk-go/service/ec2" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/ec2" -) - -const InstanceToken = ec2.InstanceToken - -// NewInstanceProvider creates a provider that handles EC2 instance operations. -func NewInstanceProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &instanceProvider{ctx} - return ec2.NewInstanceProvider(ops) -} - -type instanceProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *instanceProvider) Check(ctx context.Context, obj *ec2.Instance, property string) error { - switch property { - case ec2.Instance_ImageID: - // Check that the AMI exists; this catches misspellings, AMI region mismatches, accessibility problems, etc. - result, err := p.ctx.EC2().DescribeImages(&awsec2.DescribeImagesInput{ - ImageIds: []*string{aws.String(obj.ImageID)}, - }) - if err != nil { - return err - } - if len(result.Images) == 0 { - return fmt.Errorf("missing image: %v", obj.ImageID) - } - } - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *instanceProvider) Create(ctx context.Context, obj *ec2.Instance) (resource.ID, error) { - // Create the create instances request object. - var secgrpIDs []*string - if obj.SecurityGroups != nil { - for _, secgrpARN := range *obj.SecurityGroups { - secgrpID, err := arn.ParseResourceName(secgrpARN) - if err != nil { - return "", err - } - secgrpIDs = append(secgrpIDs, aws.String(secgrpID)) - } - } - var instanceType *string - if obj.InstanceType != nil { - its := string(*obj.InstanceType) - instanceType = &its - } - var tagSpecifications []*awsec2.TagSpecification - if obj.Tags != nil { - var tags []*awsec2.Tag - for _, tag := range *obj.Tags { - tags = append(tags, &awsec2.Tag{ - Key: aws.String(tag.Key), - Value: aws.String(tag.Value), - }) - } - tagSpecifications = []*awsec2.TagSpecification{{ - ResourceType: aws.String("instance"), - Tags: tags, - }} - } - create := &awsec2.RunInstancesInput{ - ImageId: aws.String(obj.ImageID), - InstanceType: instanceType, - SecurityGroupIds: secgrpIDs, - KeyName: obj.KeyName, - MinCount: aws.Int64(int64(1)), - MaxCount: aws.Int64(int64(1)), - TagSpecifications: tagSpecifications, - } - - // Now go ahead and perform the action. - fmt.Print("Creating new EC2 instance resource\n") - result, err := p.ctx.EC2().RunInstances(create) - if err != nil { - return "", err - } else if result == nil || len(result.Instances) == 0 { - return "", errors.New("EC2 instance created, but AWS did not return an instance ID for it") - } - - // Get the unique ID from the created instance. - contract.Assert(len(result.Instances) == 1) - contract.Assert(result.Instances[0] != nil) - contract.Assert(result.Instances[0].InstanceId != nil) - id := aws.StringValue(result.Instances[0].InstanceId) - - // Before returning that all is okay, wait for the instance to reach the running state. - fmt.Printf("EC2 instance '%v' created; now waiting for it to become 'running'\n", id) - // TODO[pulumi/lumi#219]: if this fails, but the creation succeeded, we will have an orphaned resource; report this - // differently than other "benign" errors. - if err = p.ctx.EC2().WaitUntilInstanceRunning( - &awsec2.DescribeInstancesInput{InstanceIds: []*string{aws.String(id)}}); err != nil { - return "", err - } - - return arn.NewEC2InstanceID(p.ctx.Region(), p.ctx.AccountID(), id), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an nil if not found. -func (p *instanceProvider) Get(ctx context.Context, id resource.ID) (*ec2.Instance, error) { - idarn, err := arn.ARN(id).Parse() - if err != nil { - return nil, err - } - iid := idarn.ResourceName() - resp, err := p.ctx.EC2().DescribeInstances( - &awsec2.DescribeInstancesInput{InstanceIds: []*string{aws.String(iid)}}) - if err != nil { - if awsctx.IsAWSError(err, "InvalidInstanceID.NotFound") { - return nil, nil - } - return nil, err - } else if resp == nil || len(resp.Reservations) == 0 { - return nil, nil - } - - // If we are here, we know that there is a reservation that matched; read its fields and populate the object. - contract.Assert(len(resp.Reservations) == 1) - contract.Assert(resp.Reservations[0] != nil) - contract.Assert(resp.Reservations[0].Instances != nil) - contract.Assert(len(resp.Reservations[0].Instances) == 1) - inst := resp.Reservations[0].Instances[0] - - var secgrpIDs *[]resource.ID - if len(inst.SecurityGroups) > 0 { - var ids []resource.ID - for _, group := range inst.SecurityGroups { - ids = append(ids, - arn.NewEC2SecurityGroupID(idarn.Region, idarn.AccountID, aws.StringValue(group.GroupId))) - } - secgrpIDs = &ids - } - - var instanceTags *[]ec2.Tag - if len(inst.Tags) > 0 { - var tags []ec2.Tag - for _, tag := range inst.Tags { - tags = append(tags, ec2.Tag{ - Key: aws.StringValue(tag.Key), - Value: aws.StringValue(tag.Value), - }) - } - instanceTags = &tags - } - - instanceType := ec2.InstanceType(aws.StringValue(inst.InstanceType)) - return &ec2.Instance{ - ImageID: aws.StringValue(inst.ImageId), - InstanceType: &instanceType, - SecurityGroups: secgrpIDs, - KeyName: inst.KeyName, - AvailabilityZone: aws.StringValue(inst.Placement.AvailabilityZone), - PrivateDNSName: inst.PrivateDnsName, - PublicDNSName: inst.PublicDnsName, - PrivateIP: inst.PrivateIpAddress, - PublicIP: inst.PublicIpAddress, - Tags: instanceTags, - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *instanceProvider) InspectChange(ctx context.Context, id resource.ID, - old *ec2.Instance, new *ec2.Instance, diff *resource.ObjectDiff) ([]string, error) { - // TODO[pulumi/lumi#187]: we should permit changes to security groups for non-EC2-classic VMs that are in VPCs. - // TODO[pulumi/lumi#241]: we should permit changes to instance type for EBS-backed instances. - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *instanceProvider) Update(ctx context.Context, id resource.ID, - old *ec2.Instance, new *ec2.Instance, diff *resource.ObjectDiff) error { - iid, err := arn.ParseResourceName(id) - if err != nil { - return err - } - if diff.Changed(ec2.Instance_Tags) { - newTagSet := newTagHashSet(new.Tags) - oldTagSet := newTagHashSet(old.Tags) - d := oldTagSet.Diff(newTagSet) - var addOrUpdateTags []*awsec2.Tag - for _, o := range d.AddOrUpdates() { - option := o.(tagHash).item - addOrUpdateTags = append(addOrUpdateTags, &awsec2.Tag{ - Key: aws.String(option.Key), - Value: aws.String(option.Value), - }) - } - if len(addOrUpdateTags) > 0 { - if _, tagerr := p.ctx.EC2().CreateTags(&awsec2.CreateTagsInput{ - Resources: []*string{aws.String(iid)}, - Tags: addOrUpdateTags, - }); tagerr != nil { - return tagerr - } - } - var deleteTags []*awsec2.Tag - for _, o := range d.Deletes() { - option := o.(tagHash).item - deleteTags = append(deleteTags, &awsec2.Tag{ - Key: aws.String(option.Key), - Value: nil, - }) - } - if len(deleteTags) > 0 { - _, err = p.ctx.EC2().DeleteTags(&awsec2.DeleteTagsInput{ - Resources: []*string{aws.String(iid)}, - Tags: deleteTags, - }) - if err != nil { - return err - } - } - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *instanceProvider) Delete(ctx context.Context, id resource.ID) error { - iid, err := arn.ParseResourceName(id) - if err != nil { - return err - } - delete := &awsec2.TerminateInstancesInput{InstanceIds: []*string{aws.String(iid)}} - fmt.Printf("Terminating EC2 instance '%v'\n", id) - if _, err := p.ctx.EC2().TerminateInstances(delete); err != nil { - return err - } - - fmt.Print("EC2 instance termination request submitted; waiting for it to terminate\n") - return p.ctx.EC2().WaitUntilInstanceTerminated( - &awsec2.DescribeInstancesInput{InstanceIds: []*string{aws.String(iid)}}) -} - -type tagHash struct { - item ec2.Tag -} - -var _ awsctx.Hashable = tagHash{} - -func (option tagHash) HashKey() awsctx.Hash { - return awsctx.Hash(option.item.Key) -} -func (option tagHash) HashValue() awsctx.Hash { - return awsctx.Hash(option.item.Key + ":" + option.item.Value) -} -func newTagHashSet(options *[]ec2.Tag) *awsctx.HashSet { - set := awsctx.NewHashSet() - if options == nil { - return set - } - for _, option := range *options { - set.Add(tagHash{option}) - } - return set -} diff --git a/lib/aws/provider/ec2/instance_test.go b/lib/aws/provider/ec2/instance_test.go deleted file mode 100644 index b4eec16e2..000000000 --- a/lib/aws/provider/ec2/instance_test.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "fmt" - "testing" - - "github.com/aws/aws-sdk-go/aws" - awsec2 "github.com/aws/aws-sdk-go/service/ec2" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/provider/testutil" - "github.com/pulumi/lumi/lib/aws/rpc/ec2" - "github.com/pulumi/lumi/pkg/resource" -) - -var amis = map[string]string{ - "us-east-1": "ami-6869aa05", - "us-west-2": "ami-7172b611", - "us-west-1": "ami-31490d51", - "eu-west-1": "ami-f9dd458a", - "eu-west-2": "ami-886369ec", - "eu-central-1": "ami-ea26ce85", - "ap-northeast-1": "ami-374db956", - "ap-northeast-2": "ami-2b408b45", - "ap-southeast-1": "ami-a59b49c6", - "ap-southeast-2": "ami-dc361ebf", - "ap-south-1": "ami-ffbdd790", - "us-east-2": "ami-f6035893", - "ca-central-1": "ami-730ebd17", - "sa-east-1": "ami-6dd04501", - "cn-north-1": "ami-8e6aa0e3", -} - -func Test(t *testing.T) { - t.Parallel() - - prefix := resource.NewUniqueHex("lumitest", 20, 20) - ctx := testutil.CreateContext(t) - defer cleanup(prefix, ctx) - instanceType := ec2.InstanceType("t2.nano") - - testutil.ProviderTestSimple(t, NewInstanceProvider(ctx), InstanceToken, []interface{}{ - &ec2.Instance{ - Name: aws.String(prefix), - InstanceType: &instanceType, - ImageID: amis[ctx.Region()], - Tags: &[]ec2.Tag{{ - Key: prefix, - Value: prefix, - }}, - }, - &ec2.Instance{ - Name: aws.String(prefix), - InstanceType: &instanceType, - ImageID: amis[ctx.Region()], - Tags: &[]ec2.Tag{{ - Key: prefix, - Value: prefix, - }, { - Key: "Hello", - Value: "World", - }}, - }, - }) - -} - -func cleanup(prefix string, ctx *awsctx.Context) { - fmt.Printf("Cleaning up instances with tag:%v=%v\n", prefix, prefix) - list, err := ctx.EC2().DescribeInstances(&awsec2.DescribeInstancesInput{ - Filters: []*awsec2.Filter{{ - Name: aws.String("tag:" + prefix), - Values: []*string{aws.String(prefix)}, - }}, - }) - if err != nil { - return - } - cleaned := 0 - instanceIds := []*string{} - for _, reservation := range list.Reservations { - for _, instance := range reservation.Instances { - if aws.StringValue(instance.State.Name) != awsec2.InstanceStateNameTerminated { - instanceIds = append(instanceIds, instance.InstanceId) - cleaned++ - } - } - } - if len(instanceIds) > 0 { - _, err = ctx.EC2().TerminateInstances(&awsec2.TerminateInstancesInput{ - InstanceIds: instanceIds, - }) - if err != nil { - fmt.Printf("Failed cleaning up %v tables: %v\n", cleaned, err) - } else { - fmt.Printf("Cleaned up %v tables\n", cleaned) - } - } -} diff --git a/lib/aws/provider/ec2/security_group.go b/lib/aws/provider/ec2/security_group.go deleted file mode 100644 index d66ca3094..000000000 --- a/lib/aws/provider/ec2/security_group.go +++ /dev/null @@ -1,432 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package ec2 - -import ( - "crypto/sha1" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - awsec2 "github.com/aws/aws-sdk-go/service/ec2" - "github.com/pkg/errors" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/convutil" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/ec2" -) - -const SecurityGroupToken = ec2.SecurityGroupToken - -// constants for the various security group limits. -const ( - maxSecurityGroupName = 255 - maxSecurityGroupDescription = 255 -) - -// NewSecurityGroupProvider creates a provider that handles EC2 security group operations. -func NewSecurityGroupProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &sgProvider{ctx} - return ec2.NewSecurityGroupProvider(ops) -} - -type sgProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *sgProvider) Check(ctx context.Context, obj *ec2.SecurityGroup, property string) error { - switch property { - case ec2.SecurityGroup_GroupDescription: - if len(obj.GroupDescription) > maxSecurityGroupDescription { - return fmt.Errorf("exceeded maximum length of %v", maxSecurityGroupDescription) - } - case ec2.SecurityGroup_SecurityGroupEgress: - if obj.VPC == nil && obj.SecurityGroupEgress != nil && len(*obj.SecurityGroupEgress) > 0 { - return fmt.Errorf("custom egress rules are not supported on EC2-Classic groups (those without a VPC)") - } - } - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *sgProvider) Create(ctx context.Context, obj *ec2.SecurityGroup) (resource.ID, error) { - // Make the security group creation parameters. If the developer specified a name, we will honor it, although we - // prefer to auto-generate it from the Lumi resource name, suffixed with a hash, to avoid collisions. - var name string - if obj.GroupName == nil { - name = resource.NewUniqueHex(*obj.Name+"-", maxSecurityGroupName, sha1.Size) - } else { - name = *obj.GroupName - } - var vpcID *string - if obj.VPC != nil { - vpc, err := arn.ParseResourceName(*obj.VPC) - if err != nil { - return "", err - } - vpcID = &vpc - } - - fmt.Printf("Creating EC2 security group with name '%v'\n", name) - create := &awsec2.CreateSecurityGroupInput{ - GroupName: aws.String(name), - Description: &obj.GroupDescription, - VpcId: vpcID, - } - - // Now go ahead and perform the action. - result, err := p.ctx.EC2().CreateSecurityGroup(create) - if err != nil { - return "", err - } else if result == nil || result.GroupId == nil { - return "", errors.New("EC2 security group created, but AWS did not return an ID for it") - } - - id := aws.StringValue(result.GroupId) - - // Don't proceed until the security group exists. - fmt.Printf("EC2 security group created: %v; waiting for it to become active\n", id) - if err = p.waitForSecurityGroupState(id, true); err != nil { - return "", err - } - - // Authorize ingress rules if any exist. - if ingress := obj.SecurityGroupIngress; ingress != nil && len(*ingress) > 0 { - fmt.Printf("Authorizing %v security group ingress (inbound) rules\n", len(*ingress)) - for _, rule := range *ingress { - if err := p.createSecurityGroupIngressRule(id, rule); err != nil { - return "", err - } - } - } - - // Authorize egress rules if any exist. - if egress := obj.SecurityGroupEgress; egress != nil && len(*egress) > 0 { - fmt.Printf("Authorizing %v security group egress (outbound) rules\n", len(*egress)) - for _, rule := range *egress { - if err := p.createSecurityGroupEgressRule(id, rule); err != nil { - return "", err - } - } - } - - return arn.NewEC2SecurityGroupID(p.ctx.Region(), p.ctx.AccountID(), id), nil -} - -func createSecurityGroupRulesFromIPPermissions(perms []*awsec2.IpPermission) *[]ec2.SecurityGroupRule { - var ret *[]ec2.SecurityGroupRule - if len(perms) > 0 { - var rules []ec2.SecurityGroupRule - for _, perm := range perms { - rule := ec2.SecurityGroupRule{ - IPProtocol: *perm.IpProtocol, - FromPort: convutil.Int64PToFloat64P(perm.FromPort), - ToPort: convutil.Int64PToFloat64P(perm.FromPort), - } - - // Although each unique entry is authorized individually, describe groups them together. We must ungroup - // them here in order for the output and input sets to match (i.e., one entry per IP address). - contract.Assertf(len(perm.Ipv6Ranges) == 0, "IPv6 ranges not yet supported") - if len(perm.IpRanges) > 0 { - for _, rang := range perm.IpRanges { - rule.CIDRIP = rang.CidrIp - rules = append(rules, rule) - } - } else { - rules = append(rules, rule) - } - } - ret = &rules - } - return ret -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *sgProvider) Get(ctx context.Context, id resource.ID) (*ec2.SecurityGroup, error) { - gid, err := arn.ParseResourceName(id) - if err != nil { - return nil, err - } - resp, err := p.ctx.EC2().DescribeSecurityGroups(&awsec2.DescribeSecurityGroupsInput{ - GroupIds: []*string{aws.String(gid)}, - }) - if err != nil { - if awsctx.IsAWSError(err, "InvalidSecurityGroupID.NotFound") { - return nil, nil - } - return nil, err - } else if resp == nil || len(resp.SecurityGroups) == 0 { - return nil, nil - } - - // If we found one, fetch all the requisite properties and store them on the output. - grp := resp.SecurityGroups[0] - - var vpcID *resource.ID - if grp.VpcId != nil { - vpc := arn.NewEC2VPCID(p.ctx.Region(), p.ctx.AccountID(), aws.StringValue(grp.VpcId)) - vpcID = &vpc - } - - return &ec2.SecurityGroup{ - GroupID: aws.StringValue(grp.GroupId), - GroupName: grp.GroupName, - GroupDescription: aws.StringValue(grp.Description), - VPC: vpcID, - SecurityGroupEgress: createSecurityGroupRulesFromIPPermissions(grp.IpPermissionsEgress), - SecurityGroupIngress: createSecurityGroupRulesFromIPPermissions(grp.IpPermissions), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *sgProvider) InspectChange(ctx context.Context, id resource.ID, - old *ec2.SecurityGroup, new *ec2.SecurityGroup, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *sgProvider) Update(ctx context.Context, id resource.ID, - old *ec2.SecurityGroup, new *ec2.SecurityGroup, diff *resource.ObjectDiff) error { - gid, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - // If only the ingress and/or egress rules changed, we can incrementally apply the updates. - gresses := []struct { - key resource.PropertyKey - olds *[]ec2.SecurityGroupRule - news *[]ec2.SecurityGroupRule - create func(string, ec2.SecurityGroupRule) error - delete func(string, ec2.SecurityGroupRule) error - }{ - { - ec2.SecurityGroup_SecurityGroupIngress, - new.SecurityGroupIngress, - old.SecurityGroupIngress, - p.createSecurityGroupIngressRule, - p.deleteSecurityGroupIngressRule, - }, - { - ec2.SecurityGroup_SecurityGroupEgress, - new.SecurityGroupEgress, - old.SecurityGroupEgress, - p.createSecurityGroupEgressRule, - p.deleteSecurityGroupEgressRule, - }, - } - for _, gress := range gresses { - if diff.Changed(gress.key) { - // First accumulate the diffs. - var creates []ec2.SecurityGroupRule - var deletes []ec2.SecurityGroupRule - if diff.Added(gress.key) { - contract.Assert(gress.news != nil && len(*gress.news) > 0) - creates = append(creates, *gress.news...) - } else if diff.Deleted(gress.key) { - contract.Assert(gress.olds != nil && len(*gress.olds) > 0) - deletes = append(deletes, *gress.olds...) - } else if diff.Updated(gress.key) { - update := diff.Updates[gress.key] - contract.Assert(update.Array != nil) - for _, add := range update.Array.Adds { - contract.Assert(add.IsObject()) - var rule ec2.SecurityGroupRule - if err := mapper.MapIU(add.ObjectValue().Mappable(), &rule); err != nil { - return err - } - creates = append(creates, rule) - } - for _, delete := range update.Array.Deletes { - contract.Assert(delete.IsObject()) - var rule ec2.SecurityGroupRule - if err := mapper.MapIU(delete.ObjectValue().Mappable(), &rule); err != nil { - return err - } - deletes = append(deletes, rule) - } - for _, change := range update.Array.Updates { - // We can't update individual fields of a rule; simply delete and recreate. - var before ec2.SecurityGroupRule - contract.Assert(change.Old.IsObject()) - if err := mapper.MapIU(change.Old.ObjectValue().Mappable(), &before); err != nil { - return err - } - deletes = append(deletes, before) - var after ec2.SecurityGroupRule - contract.Assert(change.New.IsObject()) - if err := mapper.MapIU(change.New.ObjectValue().Mappable(), &after); err != nil { - return err - } - creates = append(creates, after) - } - } - - // And now actually perform the create and delete operations. - for _, delete := range deletes { - if err := p.deleteSecurityGroupIngressRule(gid, delete); err != nil { - return err - } - } - for _, create := range creates { - if err := p.createSecurityGroupIngressRule(gid, create); err != nil { - return err - } - } - } - } - - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *sgProvider) Delete(ctx context.Context, id resource.ID) error { - gid, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - // First, perform the deletion. - fmt.Printf("Terminating EC2 SecurityGroup '%v'\n", id) - delete := &awsec2.DeleteSecurityGroupInput{GroupId: aws.String(gid)} - if _, err := p.ctx.EC2().DeleteSecurityGroup(delete); err != nil { - return err - } - - fmt.Printf("EC2 Security Group delete request submitted; waiting for it to terminate\n") - - // Don't finish the operation until the security group exists. - return p.waitForSecurityGroupState(gid, false) -} - -func (p *sgProvider) crudSecurityGroupRule(prefix, kind string, rule ec2.SecurityGroupRule, - action func(from *int64, to *int64) error) error { - // First print a little status to stdout. - fmt.Printf("%v security group %v rule: IPProtocol=%v", prefix, kind, rule.IPProtocol) - if rule.CIDRIP != nil { - fmt.Printf(", CIDRIP=%v", *rule.CIDRIP) - } - fromPort := convutil.Float64PToInt64P(rule.FromPort) - if fromPort != nil { - fmt.Printf(", FromPort=%v", *fromPort) - } - toPort := convutil.Float64PToInt64P(rule.ToPort) - if toPort != nil { - fmt.Printf(", ToPort=%v", *toPort) - } - fmt.Printf("\n") - - // Now perform the action and return its error (or nil) as our result. - return action(fromPort, toPort) -} - -func (p *sgProvider) createSecurityGroupIngressRule(groupID string, rule ec2.SecurityGroupRule) error { - return p.crudSecurityGroupRule("Authorizing", "ingress (inbound)", rule, func(from *int64, to *int64) error { - _, err := p.ctx.EC2().AuthorizeSecurityGroupIngress(&awsec2.AuthorizeSecurityGroupIngressInput{ - GroupId: aws.String(groupID), - IpProtocol: aws.String(rule.IPProtocol), - CidrIp: rule.CIDRIP, - FromPort: from, - ToPort: to, - }) - return err - }) -} - -func (p *sgProvider) deleteSecurityGroupIngressRule(groupID string, rule ec2.SecurityGroupRule) error { - return p.crudSecurityGroupRule("Revoking", "ingress (inbound)", rule, func(from *int64, to *int64) error { - _, err := p.ctx.EC2().RevokeSecurityGroupIngress(&awsec2.RevokeSecurityGroupIngressInput{ - GroupId: aws.String(groupID), - IpProtocol: aws.String(rule.IPProtocol), - CidrIp: rule.CIDRIP, - FromPort: from, - ToPort: to, - }) - return err - }) -} - -func (p *sgProvider) createSecurityGroupEgressRule(groupID string, rule ec2.SecurityGroupRule) error { - return p.crudSecurityGroupRule("Authorizing", "egress (outbound)", rule, func(from *int64, to *int64) error { - _, err := p.ctx.EC2().AuthorizeSecurityGroupEgress(&awsec2.AuthorizeSecurityGroupEgressInput{ - GroupId: aws.String(groupID), - IpProtocol: aws.String(rule.IPProtocol), - CidrIp: rule.CIDRIP, - FromPort: from, - ToPort: to, - }) - return err - }) -} - -func (p *sgProvider) deleteSecurityGroupEgressRule(groupID string, rule ec2.SecurityGroupRule) error { - return p.crudSecurityGroupRule("Revoking", "egress (outbound)", rule, func(from *int64, to *int64) error { - _, err := p.ctx.EC2().RevokeSecurityGroupEgress(&awsec2.RevokeSecurityGroupEgressInput{ - GroupId: aws.String(groupID), - IpProtocol: aws.String(rule.IPProtocol), - CidrIp: rule.CIDRIP, - FromPort: from, - ToPort: to, - }) - return err - }) -} - -func (p *sgProvider) waitForSecurityGroupState(id string, exist bool) error { - succ, err := awsctx.RetryUntil( - p.ctx, - func() (bool, error) { - req := &awsec2.DescribeSecurityGroupsInput{GroupIds: []*string{aws.String(id)}} - missing := true - res, err := p.ctx.EC2().DescribeSecurityGroups(req) - if err != nil { - if !isSecurityGroupNotExistErr(err) { - return false, err // quit and propagate the error - } - } else if res != nil && len(res.SecurityGroups) > 0 { - contract.Assert(len(res.SecurityGroups) == 1) - contract.Assert(*res.SecurityGroups[0].GroupId == id) - missing = false // we found one - } - - if missing { - // If missing and exist==true, keep retrying; else, we're good. - return !exist, nil - } - - // If not missing and exist==true, we're good; else, keep retrying. - return exist, nil - }, - ) - if err != nil { - return err - } else if !succ { - var reason string - if exist { - reason = "become active" - } else { - reason = "terminate" - } - return fmt.Errorf("EC2 security group '%v' did not %v", id, reason) - } - return nil -} - -func isSecurityGroupNotExistErr(err error) bool { - return awsctx.IsAWSError(err, - // The specified security group does not eixst; this error can occur because the ID of a recently created - // security group has not propagated through the system. - "InvalidGroup.NotFound", - // The specified security group does not exist; if you are creating a network interface, ensure that - // you specify a VPC security group, and not an EC2-Classic security group. - "InvalidSecurityGroupID.NotFound", - ) -} diff --git a/lib/aws/provider/elasticbeanstalk/application.go b/lib/aws/provider/elasticbeanstalk/application.go deleted file mode 100644 index f0c01a4ae..000000000 --- a/lib/aws/provider/elasticbeanstalk/application.go +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package elasticbeanstalk - -import ( - "crypto/sha1" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - awselasticbeanstalk "github.com/aws/aws-sdk-go/service/elasticbeanstalk" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/elasticbeanstalk" -) - -const ApplicationToken = elasticbeanstalk.ApplicationToken - -// constants for the various application limits. -const ( - minApplicationName = 1 - maxApplicationName = 100 - maxDescription = 200 -) - -// NewApplicationProvider creates a provider that handles ElasticBeanstalk application operations. -func NewApplicationProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &applicationProvider{ctx} - return elasticbeanstalk.NewApplicationProvider(ops) -} - -type applicationProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *applicationProvider) Check(ctx context.Context, obj *elasticbeanstalk.Application, property string) error { - switch property { - case elasticbeanstalk.Application_ApplicationName: - if name := obj.ApplicationName; name != nil { - if len(*name) < minApplicationName { - return fmt.Errorf("less than minimum length of %v", minApplicationName) - } - if len(*name) > maxApplicationName { - return fmt.Errorf("exceeded maximum length of %v", maxApplicationName) - } - } - case elasticbeanstalk.Application_Description: - if description := obj.Description; description != nil { - if len(*description) > maxDescription { - return fmt.Errorf("exceeded maximum length of %v", maxDescription) - } - } - } - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *applicationProvider) Create(ctx context.Context, obj *elasticbeanstalk.Application) (resource.ID, error) { - // If an explicit name is given, use it. Otherwise, auto-generate a name in part based on the resource name. - var name string - if obj.ApplicationName != nil { - name = *obj.ApplicationName - } else { - name = resource.NewUniqueHex(*obj.Name+"-", maxApplicationName, sha1.Size) - } - fmt.Printf("Creating ElasticBeanstalk Application '%v' with name '%v'\n", *obj.Name, name) - create := &awselasticbeanstalk.CreateApplicationInput{ - ApplicationName: aws.String(name), - Description: obj.Description, - } - _, err := p.ctx.ElasticBeanstalk().CreateApplication(create) - if err != nil { - return "", err - } - return arn.NewElasticBeanstalkApplicationID(p.ctx.Region(), p.ctx.AccountID(), name), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *applicationProvider) Get(ctx context.Context, id resource.ID) (*elasticbeanstalk.Application, error) { - name, err := arn.ParseResourceName(id) - if err != nil { - return nil, err - } - resp, err := p.ctx.ElasticBeanstalk().DescribeApplications(&awselasticbeanstalk.DescribeApplicationsInput{ - ApplicationNames: []*string{aws.String(name)}, - }) - if err != nil { - return nil, err - } else if len(resp.Applications) == 0 { - return nil, nil - } - contract.Assert(len(resp.Applications) == 1) - app := resp.Applications[0] - contract.Assert(aws.StringValue(app.ApplicationName) == name) - return &elasticbeanstalk.Application{ - ApplicationName: app.ApplicationName, - Description: app.Description, - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *applicationProvider) InspectChange(ctx context.Context, id resource.ID, - old *elasticbeanstalk.Application, new *elasticbeanstalk.Application, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *applicationProvider) Update(ctx context.Context, id resource.ID, - old *elasticbeanstalk.Application, new *elasticbeanstalk.Application, diff *resource.ObjectDiff) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - if new.Description != old.Description { - description := new.Description - if description == nil { - // If a property (for example, description) is not provided, the value remains unchanged. - // To clear these properties, specify an empty string. - description = aws.String("") - } - _, err := p.ctx.ElasticBeanstalk().UpdateApplication(&awselasticbeanstalk.UpdateApplicationInput{ - ApplicationName: aws.String(name), - Description: description, - }) - return err - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *applicationProvider) Delete(ctx context.Context, id resource.ID) error { - fmt.Printf("Deleting ElasticBeanstalk Application '%v'\n", id) - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - if _, delerr := p.ctx.ElasticBeanstalk().DeleteApplication(&awselasticbeanstalk.DeleteApplicationInput{ - ApplicationName: aws.String(name), - }); delerr != nil { - return delerr - } - succ, err := awsctx.RetryUntilLong(p.ctx, func() (bool, error) { - fmt.Printf("Waiting for application %v to become Terminated\n", name) - if resp, geterr := p.getApplication(name); geterr != nil { - return false, geterr - } else if resp == nil { - return true, nil - } - return false, nil - }) - if err != nil { - return err - } - if !succ { - return fmt.Errorf("Timed out waiting for environment to become ready") - } - return nil -} - -func (p *applicationProvider) getApplication(name string) (*awselasticbeanstalk.ApplicationDescription, error) { - resp, err := p.ctx.ElasticBeanstalk().DescribeApplications(&awselasticbeanstalk.DescribeApplicationsInput{ - ApplicationNames: []*string{aws.String(name)}, - }) - if err != nil { - return nil, err - } - applications := resp.Applications - if len(applications) > 1 { - return nil, fmt.Errorf("More than one application found with name %v", name) - } - if len(applications) == 0 { - return nil, nil - } - application := applications[0] - return application, nil -} diff --git a/lib/aws/provider/elasticbeanstalk/applicationVersion.go b/lib/aws/provider/elasticbeanstalk/applicationVersion.go deleted file mode 100644 index a3d00691b..000000000 --- a/lib/aws/provider/elasticbeanstalk/applicationVersion.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package elasticbeanstalk - -import ( - "crypto/sha1" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - awselasticbeanstalk "github.com/aws/aws-sdk-go/service/elasticbeanstalk" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/elasticbeanstalk" -) - -const ApplicationVersionToken = elasticbeanstalk.ApplicationVersionToken - -// NewApplicationVersionProvider creates a provider that handles ElasticBeanstalk applicationVersion operations. -func NewApplicationVersionProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &applicationVersionProvider{ctx} - return elasticbeanstalk.NewApplicationVersionProvider(ops) -} - -type applicationVersionProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *applicationVersionProvider) Check(ctx context.Context, - obj *elasticbeanstalk.ApplicationVersion, property string) error { - switch property { - case elasticbeanstalk.ApplicationVersion_Description: - if description := obj.Description; description != nil { - if len(*description) > maxDescription { - return fmt.Errorf("exceeded maximum length of %v", maxDescription) - } - } - } - // TODO[pulumi/lumi#220]: validate that the SourceBundle S3 bucket is in the same region as the environment. - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *applicationVersionProvider) Create(ctx context.Context, - obj *elasticbeanstalk.ApplicationVersion) (resource.ID, error) { - appname, err := arn.ParseResourceName(obj.Application) - if err != nil { - return "", err - } - - // Autogenerate a version label that is unique. - var versionLabel string - if obj.VersionLabel != nil { - versionLabel = *obj.VersionLabel - } else { - versionLabel = resource.NewUniqueHex(*obj.Name+"-", maxApplicationName, sha1.Size) - } - - // Parse out the S3 bucket and key components so we can create the source bundle. - s3buck, s3key, err := arn.ParseResourceNamePair(obj.SourceBundle) - if err != nil { - return "", err - } - - fmt.Printf("Creating ElasticBeanstalk ApplicationVersion '%v' with version label '%v'\n", *obj.Name, versionLabel) - if _, err := p.ctx.ElasticBeanstalk().CreateApplicationVersion( - &awselasticbeanstalk.CreateApplicationVersionInput{ - ApplicationName: aws.String(appname), - Description: obj.Description, - SourceBundle: &awselasticbeanstalk.S3Location{ - S3Bucket: aws.String(s3buck), - S3Key: aws.String(s3key), - }, - VersionLabel: aws.String(versionLabel), - }, - ); err != nil { - return "", err - } - - return arn.NewElasticBeanstalkApplicationVersionID(p.ctx.Region(), p.ctx.AccountID(), appname, versionLabel), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *applicationVersionProvider) Get(ctx context.Context, - id resource.ID) (*elasticbeanstalk.ApplicationVersion, error) { - idarn, err := arn.ARN(id).Parse() - if err != nil { - return nil, err - } - appname, version := idarn.ResourceNamePair() - resp, err := p.ctx.ElasticBeanstalk().DescribeApplicationVersions( - &awselasticbeanstalk.DescribeApplicationVersionsInput{ - ApplicationName: aws.String(appname), - VersionLabels: []*string{aws.String(version)}, - }, - ) - if err != nil { - return nil, err - } else if len(resp.ApplicationVersions) == 0 { - return nil, nil - } - contract.Assert(len(resp.ApplicationVersions) == 1) - vers := resp.ApplicationVersions[0] - contract.Assert(aws.StringValue(vers.ApplicationName) == appname) - appid := arn.NewElasticBeanstalkApplication(idarn.Region, idarn.AccountID, appname) - contract.Assert(aws.StringValue(vers.VersionLabel) == version) - - s3buck := aws.StringValue(vers.SourceBundle.S3Bucket) - s3key := aws.StringValue(vers.SourceBundle.S3Key) - return &elasticbeanstalk.ApplicationVersion{ - VersionLabel: vers.VersionLabel, - Application: resource.ID(appid), - Description: vers.Description, - SourceBundle: arn.NewS3ObjectID(s3buck, s3key), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *applicationVersionProvider) InspectChange(ctx context.Context, id resource.ID, - old *elasticbeanstalk.ApplicationVersion, new *elasticbeanstalk.ApplicationVersion, - diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *applicationVersionProvider) Update(ctx context.Context, id resource.ID, - old *elasticbeanstalk.ApplicationVersion, new *elasticbeanstalk.ApplicationVersion, - diff *resource.ObjectDiff) error { - appname, version, err := arn.ParseResourceNamePair(id) - if err != nil { - return err - } - if new.Description != old.Description { - description := new.Description - if description == nil { - description = aws.String("") - } - _, err := p.ctx.ElasticBeanstalk().UpdateApplicationVersion(&awselasticbeanstalk.UpdateApplicationVersionInput{ - ApplicationName: aws.String(appname), - Description: description, - VersionLabel: aws.String(version), - }) - return err - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *applicationVersionProvider) Delete(ctx context.Context, id resource.ID) error { - appname, version, err := arn.ParseResourceNamePair(id) - if err != nil { - return err - } - fmt.Printf("Deleting ElasticBeanstalk ApplicationVersion '%v'\n", id) - _, err = p.ctx.ElasticBeanstalk().DeleteApplicationVersion( - &awselasticbeanstalk.DeleteApplicationVersionInput{ - ApplicationName: aws.String(appname), - VersionLabel: aws.String(version), - }, - ) - return err -} diff --git a/lib/aws/provider/elasticbeanstalk/environment.go b/lib/aws/provider/elasticbeanstalk/environment.go deleted file mode 100644 index 2527cbe4f..000000000 --- a/lib/aws/provider/elasticbeanstalk/environment.go +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package elasticbeanstalk - -import ( - "crypto/sha1" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - awselasticbeanstalk "github.com/aws/aws-sdk-go/service/elasticbeanstalk" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/elasticbeanstalk" -) - -const EnvironmentToken = elasticbeanstalk.EnvironmentToken - -// constants for the various environment limits. -const ( - maxEnvironmentName = 40 -) - -// NewEnvironmentProvider creates a provider that handles ElasticBeanstalk environment operations. -func NewEnvironmentProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &environmentProvider{ctx} - return elasticbeanstalk.NewEnvironmentProvider(ops) -} - -type environmentProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *environmentProvider) Check(ctx context.Context, obj *elasticbeanstalk.Environment, property string) error { - // TODO[pulumi/lumi#220]: validate the properties (bag, etc). - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *environmentProvider) Create(ctx context.Context, obj *elasticbeanstalk.Environment) (resource.ID, error) { - if obj.CNAMEPrefix != nil || obj.Tags != nil || obj.TemplateName != nil || obj.Tier != nil { - return "", fmt.Errorf("Properties not yet supported: CNAMEPrefix, Tags, TemplateName, Tier") - } - - // If an explicit name is given, use it. Otherwise, auto-generate a name in part based on the resource name. - var name string - if obj.EnvironmentName != nil { - name = *obj.EnvironmentName - } else { - name = resource.NewUniqueHex(*obj.Name+"-", maxEnvironmentName, sha1.Size) - } - - var optionSettings []*awselasticbeanstalk.ConfigurationOptionSetting - if obj.OptionSettings != nil { - for _, setting := range *obj.OptionSettings { - optionSettings = append(optionSettings, &awselasticbeanstalk.ConfigurationOptionSetting{ - Namespace: aws.String(setting.Namespace), - OptionName: aws.String(setting.OptionName), - Value: aws.String(setting.Value), - }) - } - } - - appname, err := arn.ParseResourceName(obj.Application) - if err != nil { - return "", err - } - var versionLabel *string - if obj.Version != nil { - _, version, err := arn.ParseResourceNamePair(*obj.Version) - if err != nil { - return "", err - } - versionLabel = &version - } - - fmt.Printf("Creating ElasticBeanstalk Environment '%v' with name '%v'\n", *obj.Name, name) - create := &awselasticbeanstalk.CreateEnvironmentInput{ - EnvironmentName: aws.String(name), - ApplicationName: aws.String(appname), - Description: obj.Description, - OptionSettings: optionSettings, - VersionLabel: versionLabel, - SolutionStackName: obj.SolutionStackName, - } - if _, enverr := p.ctx.ElasticBeanstalk().CreateEnvironment(create); enverr != nil { - return "", enverr - } - if succ, err := awsctx.RetryUntilLong(p.ctx, func() (bool, error) { - fmt.Printf("Waiting for environment %v to become Ready\n", name) - resp, err := p.getEnvironment(appname, name) - if err != nil { - return false, err - } - if resp == nil { - return false, fmt.Errorf("New environment was terminated before becoming ready") - } - if *resp.Status == "Ready" { - return true, nil - } - return false, nil - }); err != nil { - return "", err - } else if !succ { - return "", fmt.Errorf("Timed out waiting for environment to become ready") - } - - return arn.NewElasticBeanstalkEnvironmentID(p.ctx.Region(), p.ctx.AccountID(), appname, name), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *environmentProvider) Get(ctx context.Context, id resource.ID) (*elasticbeanstalk.Environment, error) { - appname, envname, err := arn.ParseResourceNamePair(id) - if err != nil { - return nil, err - } - envresp, err := p.ctx.ElasticBeanstalk().DescribeEnvironments( - &awselasticbeanstalk.DescribeEnvironmentsInput{ - ApplicationName: aws.String(appname), - EnvironmentNames: []*string{aws.String(envname)}, - }, - ) - if err != nil { - return nil, err - } else if envresp.Environments == nil || len(envresp.Environments) == 0 { - return nil, nil - } - - // Successfully found the environment, now map all of its properties onto the struct. - contract.Assert(len(envresp.Environments) == 1) - env := envresp.Environments[0] - - var versionLabel *resource.ID - if env.VersionLabel != nil { - version := arn.NewElasticBeanstalkApplicationVersionID( - p.ctx.Region(), p.ctx.AccountID(), appname, aws.StringValue(env.VersionLabel)) - versionLabel = &version - } - envobj := &elasticbeanstalk.Environment{ - Application: arn.NewElasticBeanstalkApplicationID(p.ctx.Region(), p.ctx.AccountID(), appname), - Description: env.Description, - EnvironmentName: env.EnvironmentName, - SolutionStackName: env.SolutionStackName, - Version: versionLabel, - EndpointURL: aws.StringValue(env.EndpointURL), - } - - // TODO[pulumi/lumi#189] We may want to call `DecribeConfigurationSettings` to populate all of - // the option settings onto the returned object. However, this returns all of the settings with - // their default values, not just those provided as input. This leads to signalling deletions - // on future updates. For now, we will populate a separate output property with the full set - // of settings, but we should revisist this once we've resolved #189. - - // Next see if there are any configuration option settings and, if so, set them on the return. - confresp, err := p.ctx.ElasticBeanstalk().DescribeConfigurationSettings( - &awselasticbeanstalk.DescribeConfigurationSettingsInput{ - ApplicationName: aws.String(appname), - EnvironmentName: aws.String(envname), - }) - if err != nil { - return nil, err - } - if confresp != nil && len(confresp.ConfigurationSettings) > 0 { - var options []elasticbeanstalk.OptionSetting - for _, setting := range confresp.ConfigurationSettings { - for _, option := range setting.OptionSettings { - options = append(options, elasticbeanstalk.OptionSetting{ - Namespace: aws.StringValue(option.Namespace), - OptionName: aws.StringValue(option.OptionName), - Value: aws.StringValue(option.Value), - }) - } - } - envobj.AllOptionSettings = &options - } - - return envobj, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *environmentProvider) InspectChange(ctx context.Context, id resource.ID, - old *elasticbeanstalk.Environment, new *elasticbeanstalk.Environment, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *environmentProvider) Update(ctx context.Context, id resource.ID, - old *elasticbeanstalk.Environment, new *elasticbeanstalk.Environment, diff *resource.ObjectDiff) error { - if new.CNAMEPrefix != nil || new.Tags != nil || new.TemplateName != nil || new.Tier != nil { - return fmt.Errorf("Properties not yet supported: CNAMEPrefix, Tags, TemplateName, Tier") - } - appname, envname, err := arn.ParseResourceNamePair(id) - if err != nil { - return err - } - envUpdate := awselasticbeanstalk.UpdateEnvironmentInput{ - ApplicationName: aws.String(appname), - EnvironmentName: aws.String(envname), - } - if diff.Changed(elasticbeanstalk.Environment_Description) { - envUpdate.Description = new.Description - } - if diff.Changed(elasticbeanstalk.Environment_SolutionStackName) { - envUpdate.SolutionStackName = new.SolutionStackName - } - if diff.Changed(elasticbeanstalk.Environment_OptionSettings) { - newOptionsSet := newOptionSettingHashSet(new.OptionSettings) - oldOptionsSet := newOptionSettingHashSet(old.OptionSettings) - d := oldOptionsSet.Diff(newOptionsSet) - for _, o := range d.AddOrUpdates() { - option := o.(optionSettingHash).item - envUpdate.OptionSettings = append(envUpdate.OptionSettings, &awselasticbeanstalk.ConfigurationOptionSetting{ - Namespace: aws.String(option.Namespace), - OptionName: aws.String(option.OptionName), - Value: aws.String(option.Value), - }) - } - for _, o := range d.Deletes() { - option := o.(optionSettingHash).item - envUpdate.OptionsToRemove = append(envUpdate.OptionsToRemove, &awselasticbeanstalk.OptionSpecification{ - Namespace: aws.String(option.Namespace), - OptionName: aws.String(option.OptionName), - }) - } - } - if _, upderr := p.ctx.ElasticBeanstalk().UpdateEnvironment(&envUpdate); upderr != nil { - return upderr - } - if succ, err := awsctx.RetryUntilLong(p.ctx, func() (bool, error) { - fmt.Printf("Waiting for environment %v to become Ready\n", envname) - resp, err := p.getEnvironment(appname, envname) - if err != nil { - return false, err - } - if resp == nil { - return false, fmt.Errorf("New environment was terminated before becoming ready") - } - if *resp.Status == "Ready" { - return true, nil - } - return false, nil - }); err != nil { - return err - } else if !succ { - return fmt.Errorf("Timed out waiting for environment to become ready") - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *environmentProvider) Delete(ctx context.Context, id resource.ID) error { - fmt.Printf("Deleting ElasticBeanstalk Environment '%v'\n", id) - appname, envname, err := arn.ParseResourceNamePair(id) - if err != nil { - return err - } - if _, termerr := p.ctx.ElasticBeanstalk().TerminateEnvironment(&awselasticbeanstalk.TerminateEnvironmentInput{ - EnvironmentName: aws.String(envname), - }); termerr != nil { - return termerr - } - if succ, err := awsctx.RetryUntilLong(p.ctx, func() (bool, error) { - fmt.Printf("Waiting for environment %v to become Terminated\n", envname) - resp, err := p.getEnvironment(appname, envname) - if err != nil { - return false, err - } - if resp == nil || resp.Status == nil || *resp.Status == "Terminated" { - return true, nil - } - return false, nil - }); err != nil { - return err - } else if !succ { - return fmt.Errorf("Timed out waiting for environment to become terminated") - } - return nil -} - -func (p *environmentProvider) getEnvironment( - appname, name string) (*awselasticbeanstalk.EnvironmentDescription, error) { - resp, err := p.ctx.ElasticBeanstalk().DescribeEnvironments(&awselasticbeanstalk.DescribeEnvironmentsInput{ - ApplicationName: aws.String(appname), - EnvironmentNames: []*string{aws.String(name)}, - }) - if err != nil { - return nil, err - } - environments := resp.Environments - if len(environments) > 1 { - return nil, fmt.Errorf("More than one environment found with name %v", name) - } - if len(environments) == 0 { - return nil, nil - } - environment := environments[0] - return environment, nil -} - -type optionSettingHash struct { - item elasticbeanstalk.OptionSetting -} - -var _ awsctx.Hashable = optionSettingHash{} - -func (option optionSettingHash) HashKey() awsctx.Hash { - return awsctx.Hash(option.item.Namespace + ":" + option.item.OptionName) -} -func (option optionSettingHash) HashValue() awsctx.Hash { - return awsctx.Hash(option.item.Namespace + ":" + option.item.OptionName + ":" + option.item.Value) -} -func newOptionSettingHashSet(options *[]elasticbeanstalk.OptionSetting) *awsctx.HashSet { - set := awsctx.NewHashSet() - if options == nil { - return set - } - for _, option := range *options { - set.Add(optionSettingHash{option}) - } - return set -} diff --git a/lib/aws/provider/iam/instanceprofile.go b/lib/aws/provider/iam/instanceprofile.go deleted file mode 100644 index 75682633d..000000000 --- a/lib/aws/provider/iam/instanceprofile.go +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package iam - -import ( - "crypto/sha1" - "fmt" - - "github.com/aws/aws-sdk-go/aws" - awsiam "github.com/aws/aws-sdk-go/service/iam" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - awscommon "github.com/pulumi/lumi/lib/aws/rpc" - "github.com/pulumi/lumi/lib/aws/rpc/iam" -) - -const InstanceProfileToken = iam.InstanceProfileToken - -// constants for the various InstanceProfile limits. -const ( - maxInstanceProfileName = 64 -) - -// NewInstanceProfileProvider creates a provider that handles IAM InstanceProfile operations. -func NewInstanceProfileProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &InstanceProfileProvider{ctx} - return iam.NewInstanceProfileProvider(ops) -} - -type InstanceProfileProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *InstanceProfileProvider) Check(ctx context.Context, obj *iam.InstanceProfile, property string) error { - // TODO[pulumi/lumi#221]: to use Switch InstanceProfile, Path+InstanceProfileName cannot exceed 64 characters. Warn? - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *InstanceProfileProvider) Create(ctx context.Context, obj *iam.InstanceProfile) (resource.ID, error) { - // A InstanceProfile uses its name as the unique ID, since the GetInstanceProfile function uses it. If an explicit - // name is given, use it directly (at the risk of conflicts). Otherwise, auto-generate a name in part based on the - // resource name. - var name string - if obj.InstanceProfileName != nil { - name = *obj.InstanceProfileName - } else { - name = resource.NewUniqueHex(*obj.Name+"-", maxInstanceProfileName, sha1.Size) - } - - // Now go ahead and perform the action. - fmt.Printf("Creating IAM InstanceProfile '%v' with name '%v'\n", *obj.Name, name) - result, err := p.ctx.IAM().CreateInstanceProfile(&awsiam.CreateInstanceProfileInput{ - Path: obj.Path, - InstanceProfileName: aws.String(name), - }) - if err != nil { - return "", err - } - contract.Assert(result != nil) - contract.Assert(result.InstanceProfile != nil) - contract.Assert(result.InstanceProfile.Arn != nil) - - err = p.waitForInstanceProfileState(name, true) - if err != nil { - return "", err - } - - for _, role := range obj.Roles { - roleName, err := arn.ParseResourceName(role) - if err != nil { - return "", err - } - _, err = p.ctx.IAM().AddRoleToInstanceProfile(&awsiam.AddRoleToInstanceProfileInput{ - InstanceProfileName: aws.String(name), - RoleName: aws.String(roleName), - }) - if err != nil { - return "", err - } - } - - return resource.ID(*result.InstanceProfile.Arn), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *InstanceProfileProvider) Get(ctx context.Context, id resource.ID) (*iam.InstanceProfile, error) { - name, err := arn.ParseResourceName(id) - if err != nil { - return nil, err - } - getInstanceProfile, err := p.ctx.IAM().GetInstanceProfile(&awsiam.GetInstanceProfileInput{ - InstanceProfileName: aws.String(name), - }) - if err != nil { - if awsctx.IsAWSError(err, "NotFound", "NoSuchEntity") { - return nil, nil - } - return nil, err - } else if getInstanceProfile == nil { - return nil, nil - } - - // If we got here, we found the InstanceProfile; populate the data structure accordingly. - instanceProfile := getInstanceProfile.InstanceProfile - var roles []resource.ID - for _, role := range instanceProfile.Roles { - roles = append(roles, resource.ID(*role.Arn)) - } - - return &iam.InstanceProfile{ - Path: instanceProfile.Path, - InstanceProfileName: instanceProfile.InstanceProfileName, - Roles: roles, - ARN: awscommon.ARN(aws.StringValue(instanceProfile.Arn)), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *InstanceProfileProvider) InspectChange(ctx context.Context, id resource.ID, - old *iam.InstanceProfile, new *iam.InstanceProfile, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *InstanceProfileProvider) Update(ctx context.Context, id resource.ID, - old *iam.InstanceProfile, new *iam.InstanceProfile, diff *resource.ObjectDiff) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - if diff.Changed(iam.InstanceProfile_Roles) { - var removes []resource.ID - var adds []resource.ID - if diff.Added(iam.InstanceProfile_Roles) { - adds = append(adds, new.Roles...) - } - if diff.Deleted(iam.InstanceProfile_Roles) { - removes = append(removes, old.Roles...) - } - if diff.Updated(iam.InstanceProfile_Roles) { - arrayDiff := diff.Updates[iam.InstanceProfile_Roles].Array - for i := range arrayDiff.Adds { - adds = append(adds, new.Roles[i]) - } - for i := range arrayDiff.Deletes { - removes = append(removes, old.Roles[i]) - } - for i := range arrayDiff.Updates { - adds = append(adds, new.Roles[i]) - removes = append(removes, old.Roles[i]) - } - } - for _, role := range removes { - _, err := p.ctx.IAM().RemoveRoleFromInstanceProfile(&awsiam.RemoveRoleFromInstanceProfileInput{ - RoleName: aws.String(string(role)), - InstanceProfileName: aws.String(name), - }) - if err != nil { - return err - } - } - for _, role := range adds { - _, err := p.ctx.IAM().AddRoleToInstanceProfile(&awsiam.AddRoleToInstanceProfileInput{ - RoleName: aws.String(string(role)), - InstanceProfileName: aws.String(name), - }) - if err != nil { - return err - } - } - } - - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *InstanceProfileProvider) Delete(ctx context.Context, id resource.ID) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - // Remove the roles associated with this instance profile. - result, err := p.ctx.IAM().GetInstanceProfile(&awsiam.GetInstanceProfileInput{ - InstanceProfileName: aws.String(name), - }) - if err != nil { - return err - } - contract.Assert(result != nil) - contract.Assert(result.InstanceProfile != nil) - for _, role := range result.InstanceProfile.Roles { - _, err := p.ctx.IAM().RemoveRoleFromInstanceProfile(&awsiam.RemoveRoleFromInstanceProfileInput{ - InstanceProfileName: aws.String(name), - RoleName: role.RoleName, - }) - if err != nil { - return err - } - } - - // Perform the deletion. - fmt.Printf("Deleting IAM InstanceProfile '%v'\n", name) - if _, err := p.ctx.IAM().DeleteInstanceProfile(&awsiam.DeleteInstanceProfileInput{ - InstanceProfileName: aws.String(name), - }); err != nil { - return err - } - - // Wait for the InstanceProfile to actually become deleted before the operation is complete. - fmt.Printf("IAM InstanceProfile delete request submitted; waiting for it to delete\n") - return p.waitForInstanceProfileState(name, false) -} - -func (p *InstanceProfileProvider) waitForInstanceProfileState(name string, exist bool) error { - succ, err := awsctx.RetryUntil( - p.ctx, - func() (bool, error) { - if _, err := p.ctx.IAM().GetInstanceProfile(&awsiam.GetInstanceProfileInput{ - InstanceProfileName: aws.String(name), - }); err != nil { - if awsctx.IsAWSError(err, "NotFound", "NoSuchEntity") { - // The InstanceProfile is missing; if exist==false, we're good, otherwise keep retrying. - return !exist, nil - } - return false, err // anything other than "InstanceProfile missing" is a real error; propagate it. - } - - // If we got here, the InstanceProfile was found; if exist==true, we're good; else, keep retrying. - return exist, nil - }, - ) - if err != nil { - return err - } else if !succ { - var reason string - if exist { - reason = "created" - } else { - reason = "deleted" - } - return fmt.Errorf("IAM InstanceProfile '%v' did not become %v", name, reason) - } - return nil -} diff --git a/lib/aws/provider/iam/role.go b/lib/aws/provider/iam/role.go deleted file mode 100644 index baa74d665..000000000 --- a/lib/aws/provider/iam/role.go +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package iam - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - "net/url" - - "github.com/aws/aws-sdk-go/aws" - awsiam "github.com/aws/aws-sdk-go/service/iam" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - awscommon "github.com/pulumi/lumi/lib/aws/rpc" - "github.com/pulumi/lumi/lib/aws/rpc/iam" -) - -const RoleToken = iam.RoleToken - -// constants for the various role limits. -const ( - maxRoleName = 64 -) - -// NewRoleProvider creates a provider that handles IAM role operations. -func NewRoleProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &roleProvider{ctx} - return iam.NewRoleProvider(ops) -} - -type roleProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *roleProvider) Check(ctx context.Context, obj *iam.Role, property string) error { - // TODO[pulumi/lumi#221]: to use Switch Role, Path+RoleName cannot exceed 64 characters. Warn? - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *roleProvider) Create(ctx context.Context, obj *iam.Role) (resource.ID, error) { - contract.Assertf(obj.Policies == nil, "Inline policies not yet supported") - - // A role uses its name as the unique ID, since the GetRole function uses it. If an explicit name is given, use - // it directly (at the risk of conflicts). Otherwise, auto-generate a name in part based on the resource name. - var name string - if obj.RoleName != nil { - name = *obj.RoleName - } else { - name = resource.NewUniqueHex(*obj.Name+"-", maxRoleName, sha1.Size) - } - - // Serialize the policy document into a JSON blob. - policyDocument, err := json.Marshal(obj.AssumeRolePolicyDocument) - if err != nil { - return "", err - } - - // Now go ahead and perform the action. - fmt.Printf("Creating IAM Role '%v' with name '%v'\n", *obj.Name, name) - result, err := p.ctx.IAM().CreateRole(&awsiam.CreateRoleInput{ - AssumeRolePolicyDocument: aws.String(string(policyDocument)), - Path: obj.Path, - RoleName: aws.String(name), - }) - if err != nil { - return "", err - } - contract.Assert(result != nil) - contract.Assert(result.Role != nil) - contract.Assert(result.Role.Arn != nil) - - if obj.ManagedPolicyARNs != nil { - for _, policyARN := range *obj.ManagedPolicyARNs { - if _, atterr := p.ctx.IAM().AttachRolePolicy(&awsiam.AttachRolePolicyInput{ - RoleName: aws.String(name), - PolicyArn: aws.String(string(policyARN)), - }); atterr != nil { - return "", atterr - } - } - } - - // Wait for the role to be ready and then return the ID (just its name). - fmt.Printf("IAM Role created: %v; waiting for it to become active\n", name) - if waiterr := p.waitForRoleState(name, true); waiterr != nil { - return "", waiterr - } - return resource.ID(*result.Role.Arn), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *roleProvider) Get(ctx context.Context, id resource.ID) (*iam.Role, error) { - name, err := arn.ParseResourceName(id) - if err != nil { - return nil, err - } - getrole, err := p.ctx.IAM().GetRole(&awsiam.GetRoleInput{RoleName: aws.String(name)}) - if err != nil { - if awsctx.IsAWSError(err, "NotFound", "NoSuchEntity") { - return nil, nil - } - return nil, err - } else if getrole == nil { - return nil, nil - } - - // If we got here, we found the role; populate the data structure accordingly. - role := getrole.Role - - // Policy is a URL-encoded JSON blob, parse it. - var policyDocument map[string]interface{} - assumePolicyDocumentJSON, err := url.QueryUnescape(*role.AssumeRolePolicyDocument) - if err != nil { - return nil, err - } - if jsonerr := json.Unmarshal([]byte(assumePolicyDocumentJSON), &policyDocument); jsonerr != nil { - return nil, jsonerr - } - - // Now get a list of attached role policies. - getpols, err := p.ctx.IAM().ListAttachedRolePolicies(&awsiam.ListAttachedRolePoliciesInput{ - RoleName: aws.String(name), - }) - if err != nil { - return nil, err - } - var managedPolicies *[]awscommon.ARN - if len(getpols.AttachedPolicies) > 0 { - var policies []awscommon.ARN - for _, policy := range getpols.AttachedPolicies { - policies = append(policies, awscommon.ARN(aws.StringValue(policy.PolicyArn))) - } - managedPolicies = &policies - } - - return &iam.Role{ - AssumeRolePolicyDocument: policyDocument, - Path: role.Path, - RoleName: role.RoleName, - ManagedPolicyARNs: managedPolicies, - ARN: awscommon.ARN(aws.StringValue(role.Arn)), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *roleProvider) InspectChange(ctx context.Context, id resource.ID, - old *iam.Role, new *iam.Role, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *roleProvider) Update(ctx context.Context, id resource.ID, - old *iam.Role, new *iam.Role, diff *resource.ObjectDiff) error { - contract.Assertf(new.Policies == nil, "Inline policies not yet supported") - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - if diff.Changed(iam.Role_AssumeRolePolicyDocument) { - // Serialize the policy document into a JSON blob. - policyDocument, err := json.Marshal(new.AssumeRolePolicyDocument) - if err != nil { - return err - } - - // Now go ahead and perform the action. - fmt.Printf("Updating IAM Role '%v' with name '%v'\n", new.Name, name) - _, err = p.ctx.IAM().UpdateAssumeRolePolicy(&awsiam.UpdateAssumeRolePolicyInput{ - PolicyDocument: aws.String(string(policyDocument)), - RoleName: aws.String(name), - }) - if err != nil { - return err - } - } - - if diff.Changed(iam.Role_ManagedPolicyARNs) { - var detaches []awscommon.ARN - var attaches []awscommon.ARN - if diff.Added(iam.Role_ManagedPolicyARNs) { - attaches = append(attaches, *new.ManagedPolicyARNs...) - } - if diff.Deleted(iam.Role_ManagedPolicyARNs) { - detaches = append(detaches, *old.ManagedPolicyARNs...) - } - if diff.Updated(iam.Role_ManagedPolicyARNs) { - arrayDiff := diff.Updates[iam.Role_ManagedPolicyARNs].Array - for i := range arrayDiff.Adds { - attaches = append(attaches, (*new.ManagedPolicyARNs)[i]) - } - for i := range arrayDiff.Deletes { - detaches = append(detaches, (*old.ManagedPolicyARNs)[i]) - } - for i := range arrayDiff.Updates { - attaches = append(attaches, (*new.ManagedPolicyARNs)[i]) - detaches = append(detaches, (*old.ManagedPolicyARNs)[i]) - } - } - for _, policy := range detaches { - _, err := p.ctx.IAM().DetachRolePolicy(&awsiam.DetachRolePolicyInput{ - PolicyArn: aws.String(string(policy)), - RoleName: aws.String(name), - }) - if err != nil { - return err - } - } - for _, policy := range attaches { - _, err := p.ctx.IAM().AttachRolePolicy(&awsiam.AttachRolePolicyInput{ - PolicyArn: aws.String(string(policy)), - RoleName: aws.String(name), - }) - if err != nil { - return err - } - } - } - - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *roleProvider) Delete(ctx context.Context, id resource.ID) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - // Get and detach all attached policies before deleteing - attachedRolePolicies, err := p.ctx.IAM().ListAttachedRolePolicies(&awsiam.ListAttachedRolePoliciesInput{ - RoleName: aws.String(name), - }) - if err != nil { - return err - } - if attachedRolePolicies != nil { - for _, policy := range attachedRolePolicies.AttachedPolicies { - if _, err := p.ctx.IAM().DetachRolePolicy(&awsiam.DetachRolePolicyInput{ - RoleName: aws.String(name), - PolicyArn: policy.PolicyArn, - }); err != nil { - return err - } - } - } - - // Perform the deletion. - fmt.Printf("Deleting IAM Role '%v'\n", name) - if _, err := p.ctx.IAM().DeleteRole(&awsiam.DeleteRoleInput{RoleName: aws.String(name)}); err != nil { - return err - } - - // Wait for the role to actually become deleted before the operation is complete. - fmt.Printf("IAM Role delete request submitted; waiting for it to delete\n") - return p.waitForRoleState(name, false) -} - -func (p *roleProvider) waitForRoleState(name string, exist bool) error { - succ, err := awsctx.RetryUntil( - p.ctx, - func() (bool, error) { - if _, err := p.ctx.IAM().GetRole(&awsiam.GetRoleInput{RoleName: aws.String(name)}); err != nil { - if awsctx.IsAWSError(err, "NotFound", "NoSuchEntity") { - // The role is missing; if exist==false, we're good, otherwise keep retrying. - return !exist, nil - } - return false, err // anything other than "role missing" is a real error; propagate it. - } - - // If we got here, the role was found; if exist==true, we're good; else, keep retrying. - return exist, nil - }, - ) - if err != nil { - return err - } else if !succ { - var reason string - if exist { - reason = "created" - } else { - reason = "deleted" - } - return fmt.Errorf("IAM role '%v' did not become %v", name, reason) - } - return nil -} diff --git a/lib/aws/provider/lambda/function.go b/lib/aws/provider/lambda/function.go deleted file mode 100644 index 5e5f66a15..000000000 --- a/lib/aws/provider/lambda/function.go +++ /dev/null @@ -1,406 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package lambda - -import ( - "crypto/sha1" - "fmt" - "strings" - - "github.com/aws/aws-sdk-go/aws" - awslambda "github.com/aws/aws-sdk-go/service/lambda" - "github.com/pkg/errors" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/convutil" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - awscommon "github.com/pulumi/lumi/lib/aws/rpc" - "github.com/pulumi/lumi/lib/aws/rpc/lambda" -) - -const FunctionToken = lambda.FunctionToken - -// constants for the various function limits. -const ( - maxFunctionName = 64 - maxFunctionNameARN = 140 - functionNameARNPrefix = "arn:aws:lambda:" -) - -var functionRuntimes = map[lambda.Runtime]bool{ - lambda.NodeJSRuntime: true, - lambda.NodeJS4d3Runtime: true, - lambda.NodeJS4d3EdgeRuntime: true, - lambda.NodeJS6d10Runtime: true, - lambda.Java8Runtime: true, - lambda.Python2d7Runtime: true, - lambda.DotnetCore1d0Runtime: true, -} - -// NewFunctionProvider creates a provider that handles Lambda function operations. -func NewFunctionProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &funcProvider{ctx} - return lambda.NewFunctionProvider(ops) -} - -type funcProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *funcProvider) Check(ctx context.Context, obj *lambda.Function, property string) error { - switch property { - case lambda.Function_Runtime: - if _, has := functionRuntimes[obj.Runtime]; !has { - return fmt.Errorf("%v is not a valid runtime", obj.Runtime) - } - case lambda.Function_FunctionName: - if name := obj.FunctionName; name != nil { - var maxName int - if strings.HasPrefix(*name, functionNameARNPrefix) { - maxName = maxFunctionNameARN - } else { - maxName = maxFunctionName - } - if len(*name) > maxName { - return fmt.Errorf("exceeded maximum length of %v", maxName) - } - } - } - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *funcProvider) Create(ctx context.Context, obj *lambda.Function) (resource.ID, error) { - contract.Assertf(obj.VPCConfig == nil, "VPC config not yet supported") - - // If an explicit name is given, use it. Otherwise, auto-generate a name in part based on the resource name. - var name string - if obj.FunctionName != nil { - name = *obj.FunctionName - } else { - name = resource.NewUniqueHex(*obj.Name+"-", maxFunctionName, sha1.Size) - } - - code, err := p.getCode(obj.Code) - if err != nil { - return "", err - } - - // Convert float fields to in64 if they are non-nil. - var memsize *int64 - if obj.MemorySize != nil { - sz := int64(*obj.MemorySize) - memsize = &sz - } - var timeout *int64 - if obj.Timeout != nil { - to := int64(*obj.Timeout) - timeout = &to - } - var env *awslambda.Environment - if obj.Environment != nil { - env = &awslambda.Environment{ - Variables: aws.StringMap(*obj.Environment), - } - } - var deadLetterConfig *awslambda.DeadLetterConfig - if obj.DeadLetterConfig != nil { - deadLetterConfig = &awslambda.DeadLetterConfig{ - TargetArn: aws.String(string(obj.DeadLetterConfig.Target)), - } - } - - // Now go ahead and create the resource. Note that IAM profiles can take several seconds to propagate; see - // http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#launch-instance-with-role. - fmt.Printf("Creating Lambda Function '%v' with name '%v'\n", *obj.Name, name) - create := &awslambda.CreateFunctionInput{ - Code: code, - DeadLetterConfig: deadLetterConfig, - Description: obj.Description, - Environment: env, - FunctionName: aws.String(name), - Handler: aws.String(obj.Handler), - KMSKeyArn: obj.KMSKey.StringPtr(), - MemorySize: memsize, - Role: aws.String(string(obj.Role)), - Runtime: aws.String(string(obj.Runtime)), - Timeout: timeout, - } - var arn resource.ID - if succ, err := awsctx.RetryProgUntil( - p.ctx, - func() (bool, error) { - resp, err := p.ctx.Lambda().CreateFunction(create) - if err != nil { - if awsctx.IsAWSErrorMessage(err, - "InvalidParameterValueException", - "The role defined for the function cannot be assumed by Lambda.") { - return false, nil // retry the condition. - } - return false, err - } else if resp == nil || resp.FunctionArn == nil { - return false, errors.New("Lambda Function created, but AWS did not respond with an ARN") - } - arn = resource.ID(*resp.FunctionArn) - return true, nil - }, - func(n int) bool { - fmt.Printf("Lambda IAM role '%v' not yet ready; waiting for it to become usable...\n", obj.Role) - return true - }, - ); err != nil { - return "", err - } else if !succ { - return "", fmt.Errorf("Lambda IAM role '%v' did not become useable", obj.Role) - } - - // Wait for the function to be ready and then return the function name as the ID. - fmt.Printf("Lambda Function created: %v (ARN %v); waiting for it to become active\n", name, arn) - if err := p.waitForFunctionState(name, true); err != nil { - return "", err - } - return arn, nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *funcProvider) Get(ctx context.Context, id resource.ID) (*lambda.Function, error) { - name, err := arn.ParseResourceName(id) - if err != nil { - return nil, err - } - funcresp, err := p.ctx.Lambda().GetFunction(&awslambda.GetFunctionInput{FunctionName: aws.String(name)}) - if err != nil { - if awsctx.IsAWSError(err, awslambda.ErrCodeResourceNotFoundException) { - return nil, nil - } - return nil, err - } - - // Note: We do not extract the funcresp.Code property, as this is a pre-signed S3 - // URL at which we could download the function source code, but is not stable across - // calls to GetFunction. - - // Deserialize all configuration properties into prompt objects. - contract.Assert(funcresp != nil) - config := funcresp.Configuration - contract.Assert(config != nil) - var env *lambda.Environment - if config.Environment != nil { - envmap := lambda.Environment(aws.StringValueMap(config.Environment.Variables)) - env = &envmap - } - var deadLetterConfig *lambda.DeadLetterConfig - if config.DeadLetterConfig != nil { - deadLetterConfig = &lambda.DeadLetterConfig{ - Target: resource.ID(aws.StringValue(config.DeadLetterConfig.TargetArn)), - } - } - - return &lambda.Function{ - ARN: awscommon.ARN(aws.StringValue(config.FunctionArn)), - Version: aws.StringValue(config.Version), - CodeSHA256: aws.StringValue(config.CodeSha256), - LastModified: aws.StringValue(config.LastModified), - Handler: aws.StringValue(config.Handler), - Role: resource.ID(aws.StringValue(config.Role)), - Runtime: lambda.Runtime(aws.StringValue(config.Runtime)), - FunctionName: config.FunctionName, - Description: config.Description, - DeadLetterConfig: deadLetterConfig, - Environment: env, - KMSKey: resource.MaybeID(config.KMSKeyArn), - MemorySize: convutil.Int64PToFloat64P(config.MemorySize), - Timeout: convutil.Int64PToFloat64P(config.Timeout), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *funcProvider) InspectChange(ctx context.Context, id resource.ID, - old *lambda.Function, new *lambda.Function, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *funcProvider) Update(ctx context.Context, id resource.ID, - old *lambda.Function, new *lambda.Function, diff *resource.ObjectDiff) error { - contract.Assertf(new.VPCConfig == nil, "VPC config not yet supported") - - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - if diff.Changed(lambda.Function_Description) || diff.Changed(lambda.Function_Environment) || - diff.Changed(lambda.Function_Runtime) || diff.Changed(lambda.Function_Role) || - diff.Changed(lambda.Function_MemorySize) || diff.Changed(lambda.Function_Timeout) || - diff.Changed(lambda.Function_Environment) || diff.Changed(lambda.Function_DeadLetterConfig) { - - update := &awslambda.UpdateFunctionConfigurationInput{ - FunctionName: aws.String(name), - } - if diff.Changed(lambda.Function_Description) { - update.Description = new.Description - } - if diff.Changed(lambda.Function_Handler) { - update.Handler = aws.String(new.Handler) - } - if diff.Changed(lambda.Function_Runtime) { - update.Runtime = aws.String(string(new.Runtime)) - } - if diff.Changed(lambda.Function_Role) { - update.Role = aws.String(string(new.Role)) - } - if diff.Changed(lambda.Function_MemorySize) { - if new.MemorySize != nil { - sz := int64(*new.MemorySize) - update.MemorySize = &sz - } - } - if diff.Changed(lambda.Function_Timeout) { - if new.Timeout != nil { - to := int64(*new.Timeout) - update.Timeout = &to - } - } - if diff.Changed(lambda.Function_Environment) { - if new.Environment != nil { - update.Environment = &awslambda.Environment{ - Variables: aws.StringMap(*new.Environment), - } - } else { - update.Environment = &awslambda.Environment{ - Variables: map[string]*string{}, - } - } - } - if diff.Changed(lambda.Function_DeadLetterConfig) { - if new.DeadLetterConfig != nil { - update.DeadLetterConfig = &awslambda.DeadLetterConfig{ - TargetArn: aws.String(string(new.DeadLetterConfig.Target)), - } - } - } - - fmt.Printf("Updating Lambda function configuration '%v'\n", name) - if succ, err := awsctx.RetryProgUntil( - p.ctx, - func() (bool, error) { - _, err := p.ctx.Lambda().UpdateFunctionConfiguration(update) - if err != nil { - if awsctx.IsAWSErrorMessage(err, - "InvalidParameterValueException", - "The role defined for the function cannot be assumed by Lambda.") { - return false, nil // retry the condition. - } - return false, err - } - return true, nil - }, - func(n int) bool { - fmt.Printf("Lambda IAM role '%v' not yet ready; waiting for it to become usable...\n", new.Role) - return true - }, - ); err != nil { - return err - } else if !succ { - return fmt.Errorf("Lambda IAM role '%v' did not become useable", new.Role) - } - } - - if diff.Changed(lambda.Function_Code) { - code, err := p.getCode(new.Code) - if err != nil { - return err - } - update := &awslambda.UpdateFunctionCodeInput{ - FunctionName: aws.String(name), - S3Bucket: code.S3Bucket, - S3Key: code.S3Key, - S3ObjectVersion: code.S3ObjectVersion, - ZipFile: code.ZipFile, - } - fmt.Printf("Updating Lambda function code '%v'\n", name) - if _, err := p.ctx.Lambda().UpdateFunctionCode(update); err != nil { - return err - } - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *funcProvider) Delete(ctx context.Context, id resource.ID) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - // First, perform the deletion. - fmt.Printf("Deleting Lambda Function '%v'\n", name) - if _, err := p.ctx.Lambda().DeleteFunction(&awslambda.DeleteFunctionInput{ - FunctionName: aws.String(name), - }); err != nil { - return err - } - - // Wait for the function to actually become deleted before returning. - fmt.Printf("Lambda Function delete request submitted; waiting for it to delete\n") - return p.waitForFunctionState(name, false) -} - -func (p *funcProvider) waitForFunctionState(name string, exist bool) error { - succ, err := awsctx.RetryUntil( - p.ctx, - func() (bool, error) { - if _, err := p.ctx.Lambda().GetFunction(&awslambda.GetFunctionInput{ - FunctionName: aws.String(name), - }); err != nil { - if awsctx.IsAWSError(err, "NotFound", "ResourceNotFoundException") { - // The function is missing; if exist==false, we're good, otherwise keep retrying. - return !exist, nil - } - return false, err // anything other than "function missing" is a real error; propagate it. - } - - // If we got here, the function was found; if exist==true, we're good; else, keep retrying. - return exist, nil - }, - ) - if err != nil { - return err - } else if !succ { - var reason string - if exist { - reason = "created" - } else { - reason = "deleted" - } - return fmt.Errorf("Lambda Function '%v' did not become %v", name, reason) - } - return nil -} - -func (p *funcProvider) getCode(codeArchive resource.Archive) (*awslambda.FunctionCode, error) { - // Figure out the kind of asset. In addition to the usual suspects, we permit s3:// references. - if uri, isuri, err := codeArchive.GetURIURL(); err != nil { - return nil, err - } else if isuri && uri.Scheme == "s3" { - return &awslambda.FunctionCode{ - S3Bucket: aws.String(uri.Host), - S3Key: aws.String(uri.Path), - // TODO[pulumi/lumi#222]: S3ObjectVersion; encode as the #? - }, nil - } else { - zip, err := codeArchive.Bytes(resource.ZIPArchive) - if err != nil { - return nil, err - } - return &awslambda.FunctionCode{ZipFile: zip}, nil - } -} diff --git a/lib/aws/provider/lambda/function_test.go b/lib/aws/provider/lambda/function_test.go deleted file mode 100644 index 0cb286876..000000000 --- a/lib/aws/provider/lambda/function_test.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package lambda - -import ( - "crypto/sha256" - "encoding/base64" - "fmt" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - awsiam "github.com/aws/aws-sdk-go/service/iam" - awslambda "github.com/aws/aws-sdk-go/service/lambda" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - cloudwatchprovider "github.com/pulumi/lumi/lib/aws/provider/cloudwatch" - iamprovider "github.com/pulumi/lumi/lib/aws/provider/iam" - snsprovider "github.com/pulumi/lumi/lib/aws/provider/sns" - "github.com/pulumi/lumi/lib/aws/provider/testutil" - rpc "github.com/pulumi/lumi/lib/aws/rpc" - "github.com/pulumi/lumi/lib/aws/rpc/cloudwatch" - "github.com/pulumi/lumi/lib/aws/rpc/iam" - "github.com/pulumi/lumi/lib/aws/rpc/lambda" - "github.com/pulumi/lumi/lib/aws/rpc/sns" - "github.com/pulumi/lumi/pkg/resource" - "github.com/stretchr/testify/assert" -) - -func Test(t *testing.T) { - t.Parallel() - - prefix := resource.NewUniqueHex("lumitest", 20, 20) - awsctx := testutil.CreateContext(t) - defer func() { - funcerr := cleanupFunctions(prefix, awsctx) - assert.Nil(t, funcerr) - roleerr := cleanupRoles(prefix, awsctx) - assert.Nil(t, roleerr) - }() - - sourceARN := rpc.ARN("arn:aws:s3:::elasticbeanstalk-us-east-1-111111111111") - code := resource.Archive{ - Assets: map[string]resource.Asset{ - "index.js": { - Text: "exports.handler = (ev, ctx, cb) => { console.log(ev); console.log(ctx); }", - }, - }, - } - - resources := map[string]testutil.Resource{ - "role": {Provider: iamprovider.NewRoleProvider(awsctx), Token: iam.RoleToken}, - "f": {Provider: NewFunctionProvider(awsctx), Token: FunctionToken}, - "logcollector": {Provider: NewFunctionProvider(awsctx), Token: FunctionToken}, - "permission": {Provider: NewPermissionProvider(awsctx), Token: PermissionToken}, - "loggroup": {Provider: cloudwatchprovider.NewLogGroupProvider(awsctx), - Token: cloudwatchprovider.LogGroupToken}, - "filter": {Provider: cloudwatchprovider.NewLogSubscriptionFilterProvider(awsctx), - Token: cloudwatchprovider.LogSubscriptionFilterToken}, - "deadlettertopic": {Provider: snsprovider.NewTopicProvider(awsctx), Token: snsprovider.TopicToken}, - } - steps := []testutil.Step{ - { - testutil.ResourceGenerator{ - Name: "role", - Creator: func(ctx testutil.Context) interface{} { - return &iam.Role{ - Name: aws.String(prefix), - ManagedPolicyARNs: &[]rpc.ARN{ - rpc.ARN("arn:aws:iam::aws:policy/AWSLambdaFullAccess"), - }, - AssumeRolePolicyDocument: map[string]interface{}{ - "Version": "2012-10-17", - "Statement": []map[string]interface{}{ - { - "Action": "sts:AssumeRole", - "Principal": map[string]interface{}{ - "Service": "lambda.amazonaws.com", - }, - "Effect": "Allow", - "Sid": "", - }, - }, - }, - } - }, - }, - testutil.ResourceGenerator{ - Name: "deadlettertopic", - Creator: func(ctx testutil.Context) interface{} { - return &sns.Topic{ - Name: aws.String(prefix), - } - }, - }, - testutil.ResourceGenerator{ - Name: "f", - Creator: func(ctx testutil.Context) interface{} { - return &lambda.Function{ - Name: aws.String(prefix), - Code: code, - Handler: "index.handler", - Runtime: lambda.NodeJS6d10Runtime, - Role: ctx.GetResourceID("role"), - DeadLetterConfig: &lambda.DeadLetterConfig{ - Target: ctx.GetResourceID("deadlettertopic"), - }, - } - }, - }, - testutil.ResourceGenerator{ - Name: "logcollector", - Creator: func(ctx testutil.Context) interface{} { - return &lambda.Function{ - Name: aws.String(prefix), - Code: code, - Handler: "index.handler", - Runtime: lambda.NodeJS6d10Runtime, - Role: ctx.GetResourceID("role"), - } - }, - }, - testutil.ResourceGenerator{ - Name: "loggroup", - Creator: func(ctx testutil.Context) interface{} { - return &cloudwatch.LogGroup{ - Name: aws.String(prefix), - LogGroupName: aws.String("/aws/lambda/" + - ctx.GetOutputProps("f").Fields["functionName"].GetStringValue()), - RetentionInDays: aws.Float64(float64(7)), - } - }, - }, - testutil.ResourceGenerator{ - Name: "permission", - Creator: func(ctx testutil.Context) interface{} { - sourceARN = rpc.ARN(string(ctx.GetResourceID("loggroup")) + ":*") - return &lambda.Permission{ - Name: aws.String(prefix), - Function: ctx.GetResourceID("logcollector"), - Action: "lambda:InvokeFunction", - Principal: "logs." + awsctx.Region() + ".amazonaws.com", - SourceAccount: aws.String(awsctx.AccountID()), - SourceARN: &sourceARN, - } - }, - }, - testutil.ResourceGenerator{ - Name: "filter", - Creator: func(ctx testutil.Context) interface{} { - return &cloudwatch.LogSubscriptionFilter{ - Name: aws.String(prefix), - DestinationArn: string(ctx.GetResourceID("logcollector")), - LogGroupName: ctx.GetOutputProps("loggroup").Fields["logGroupName"].GetStringValue(), - } - }, - }, - }, - } - - props := testutil.ProviderTest(t, resources, steps) - - // Returned SHA256 must match what we uploaded - byts, err := code.Bytes(resource.ZIPArchive) - assert.NoError(t, err) - sum := sha256.Sum256(byts) - codeSHA256 := base64.StdEncoding.EncodeToString(sum[:]) - assert.Equal(t, codeSHA256, props["f"].Fields["codeSHA256"].GetStringValue()) -} - -func cleanupFunctions(prefix string, ctx *awsctx.Context) error { - fmt.Printf("Cleaning up function with name:%v\n", prefix) - list, err := ctx.Lambda().ListFunctions(&awslambda.ListFunctionsInput{}) - if err != nil { - return err - } - cleaned := 0 - for _, fnc := range list.Functions { - if strings.HasPrefix(aws.StringValue(fnc.FunctionName), prefix) { - if _, delerr := ctx.Lambda().DeleteFunction(&awslambda.DeleteFunctionInput{ - FunctionName: fnc.FunctionName, - }); delerr != nil { - fmt.Printf("Unable to cleanup function %v: %v\n", fnc.FunctionName, delerr) - return delerr - } - cleaned++ - } - } - fmt.Printf("Cleaned up %v functions\n", cleaned) - return nil -} - -func cleanupRoles(prefix string, ctx *awsctx.Context) error { - fmt.Printf("Cleaning up roles with name:%v\n", prefix) - list, err := ctx.IAM().ListRoles(&awsiam.ListRolesInput{}) - if err != nil { - return err - } - cleaned := 0 - for _, role := range list.Roles { - if strings.HasPrefix(aws.StringValue(role.RoleName), prefix) { - policies, err := ctx.IAM().ListAttachedRolePolicies(&awsiam.ListAttachedRolePoliciesInput{ - RoleName: role.RoleName, - }) - if err != nil { - fmt.Printf("Unable to cleanup role %v: %v\n", role.RoleName, err) - return err - } - if policies != nil { - for _, policy := range policies.AttachedPolicies { - if _, deterr := ctx.IAM().DetachRolePolicy(&awsiam.DetachRolePolicyInput{ - RoleName: role.RoleName, - PolicyArn: policy.PolicyArn, - }); deterr != nil { - return deterr - } - } - } - if _, delerr := ctx.IAM().DeleteRole(&awsiam.DeleteRoleInput{ - RoleName: role.RoleName, - }); delerr != nil { - fmt.Printf("Unable to cleanup role %v: %v\n", role.RoleName, err) - return delerr - } - cleaned++ - } - } - fmt.Printf("Cleaned up %v roles\n", cleaned) - return nil -} diff --git a/lib/aws/provider/lambda/permission.go b/lib/aws/provider/lambda/permission.go deleted file mode 100644 index a54e2d31c..000000000 --- a/lib/aws/provider/lambda/permission.go +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package lambda - -import ( - "crypto/sha1" - "encoding/json" - "fmt" - "regexp" - "strings" - - "github.com/aws/aws-sdk-go/aws" - awslambda "github.com/aws/aws-sdk-go/service/lambda" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - awscommon "github.com/pulumi/lumi/lib/aws/rpc" - "github.com/pulumi/lumi/lib/aws/rpc/lambda" -) - -const PermissionToken = lambda.PermissionToken - -const ( - maxStatementID = 100 -) - -var ( - actionRegexp = regexp.MustCompile(`^(lambda:[*]|lambda:[a-zA-Z]+|[*])$`) - sourceAccountRegexp = regexp.MustCompile(`^\d{12}$`) - sourceARNRegexp = regexp.MustCompile(`^arn:aws:([a-zA-Z0-9\-])+:([a-z]{2}-[a-z]+-\d{1})?:(\d{12})?:(.*)$`) -) - -type policy struct { - Version string - ID string `json:"Id"` - Statement []statement -} - -type statement struct { - Sid string - Effect string - Principal principal - Action string - Resource string - Condition condition -} - -type principal struct { - Service string -} - -type condition struct { - ArnLike *arnLike `json:"ArnLike,omitempty"` - StringEquals *stringEquals `json:"StringEquals,omitempty"` -} - -type arnLike struct { - AWSSourceArn *string `json:"AWS:SourceArn,omitempty"` -} - -type stringEquals struct { - AWSSourceAccount *string `json:"AWS:SourceAccount,omitempty"` -} - -// NewPermissionID returns an AWS APIGateway Deployment ARN ID for the given restAPIID and deploymentID -func NewPermissionID(region, account, functionName, statementID string) resource.ID { - return arn.NewID("lambda", region, account, "function:"+functionName+":policy:"+statementID) -} - -// ParsePermissionID parses an AWS APIGateway Deployment ARN ID to extract the restAPIID and deploymentID -func ParsePermissionID(id resource.ID) (string, string, error) { - res, err := arn.ParseResourceName(id) - if err != nil { - return "", "", err - } - parts := strings.Split(res, ":") - if len(parts) != 3 || parts[1] != "policy" { - return "", "", fmt.Errorf("expected Permission ARN of the form %v: %v", - "arn:aws:lambda:region:account:function:function-name:policy:statement-id", id) - } - return parts[0], parts[2], nil -} - -// NewPermissionProvider creates a provider that handles Lambda permission operations. -func NewPermissionProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &permissionProvider{ctx} - return lambda.NewPermissionProvider(ops) -} - -type permissionProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *permissionProvider) Check(ctx context.Context, obj *lambda.Permission, property string) error { - switch property { - case lambda.Permission_Action: - if matched := actionRegexp.MatchString(obj.Action); !matched { - return fmt.Errorf("did not match regexp %v", actionRegexp) - } - case lambda.Permission_SourceAccount: - if obj.SourceAccount != nil { - if matched := sourceAccountRegexp.MatchString(*obj.SourceAccount); !matched { - return fmt.Errorf("did not match regexp %v", sourceAccountRegexp) - } - } - case lambda.Permission_SourceARN: - if obj.SourceARN != nil { - if matched := sourceARNRegexp.MatchString(string(*obj.SourceARN)); !matched { - return fmt.Errorf("did not match regexp %v", sourceARNRegexp) - } - } - } - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *permissionProvider) Create(ctx context.Context, obj *lambda.Permission) (resource.ID, error) { - // Auto-generate a name in part based on the resource name. - statementID := resource.NewUniqueHex(*obj.Name+"-", maxStatementID, sha1.Size) - functionName, err := arn.ParseResourceName(obj.Function) - if err != nil { - return "", err - } - fmt.Printf("Creating Lambda Permission '%v' with statement ID '%v'\n", *obj.Name, statementID) - create := &awslambda.AddPermissionInput{ - Action: aws.String(obj.Action), - FunctionName: aws.String(functionName), - Principal: aws.String(obj.Principal), - SourceAccount: obj.SourceAccount, - StatementId: aws.String(statementID), - } - if obj.SourceARN != nil { - create.SourceArn = aws.String(string(*obj.SourceARN)) - } - _, err = p.ctx.Lambda().AddPermission(create) - if err != nil { - return "", err - } - - return NewPermissionID(p.ctx.Region(), p.ctx.AccountID(), functionName, statementID), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *permissionProvider) Get(ctx context.Context, id resource.ID) (*lambda.Permission, error) { - functionName, statementID, err := ParsePermissionID(id) - if err != nil { - return nil, err - } - resp, err := p.ctx.Lambda().GetPolicy(&awslambda.GetPolicyInput{ - FunctionName: aws.String(functionName), - }) - if err != nil { - return nil, err - } - contract.Assert(resp != nil) - contract.Assert(resp.Policy != nil) - policyDoc := policy{} - if jsonerr := json.Unmarshal([]byte(*resp.Policy), &policyDoc); jsonerr != nil { - return nil, jsonerr - } - for _, statement := range policyDoc.Statement { - if statement.Sid == statementID { - permission := &lambda.Permission{ - Action: statement.Action, - Function: resource.ID(statement.Resource), - Principal: statement.Principal.Service, - } - // The statements generated by `lambda.AddPermission` will contain up to two Condition elements - // of the following two forms, corresponding to the optional SourceARN and SourceAccount properties. - // "ArnLike": { "AWS:SourceArn": "" } - // or: - // "StringEquals": { "AWS:SourceAccount": "" } - condition := statement.Condition - if condition.ArnLike != nil && condition.ArnLike.AWSSourceArn != nil { - sourceARN := awscommon.ARN(*condition.ArnLike.AWSSourceArn) - permission.SourceARN = &sourceARN - } - if condition.StringEquals != nil && condition.StringEquals.AWSSourceAccount != nil { - permission.SourceAccount = condition.StringEquals.AWSSourceAccount - } - return permission, nil - } - } - return nil, fmt.Errorf("No statement found for id '%v'", id) -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *permissionProvider) InspectChange(ctx context.Context, id resource.ID, - old *lambda.Permission, new *lambda.Permission, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *permissionProvider) Update(ctx context.Context, id resource.ID, - old *lambda.Permission, new *lambda.Permission, diff *resource.ObjectDiff) error { - contract.Failf("No properties of Permission resource are updatable.") - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *permissionProvider) Delete(ctx context.Context, id resource.ID) error { - functionName, statementID, err := ParsePermissionID(id) - if err != nil { - return err - } - fmt.Printf("Deleting Lambda Permission '%v'\n", statementID) - _, remerr := p.ctx.Lambda().RemovePermission(&awslambda.RemovePermissionInput{ - FunctionName: aws.String(functionName), - StatementId: aws.String(statementID), - }) - return remerr -} diff --git a/lib/aws/provider/main.go b/lib/aws/provider/main.go deleted file mode 100644 index ce5019c51..000000000 --- a/lib/aws/provider/main.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package main - -import ( - "github.com/pulumi/lumi/pkg/resource/provider" - "github.com/pulumi/lumi/pkg/util/cmdutil" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -func main() { - // Create a new resurce provider server and listen for and serve incoming connections. - if err := provider.Main(func(host *provider.HostClient) (lumirpc.ResourceProviderServer, error) { - return NewProvider(host) - }); err != nil { - cmdutil.ExitError(err.Error()) - } -} diff --git a/lib/aws/provider/provider.go b/lib/aws/provider/provider.go deleted file mode 100644 index 24e337700..000000000 --- a/lib/aws/provider/provider.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package main - -import ( - "fmt" - - pbempty "github.com/golang/protobuf/ptypes/empty" - "github.com/pulumi/lumi/pkg/resource/provider" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/apigateway" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/provider/cloudwatch" - "github.com/pulumi/lumi/lib/aws/provider/dynamodb" - "github.com/pulumi/lumi/lib/aws/provider/ec2" - "github.com/pulumi/lumi/lib/aws/provider/elasticbeanstalk" - "github.com/pulumi/lumi/lib/aws/provider/iam" - "github.com/pulumi/lumi/lib/aws/provider/lambda" - "github.com/pulumi/lumi/lib/aws/provider/s3" - "github.com/pulumi/lumi/lib/aws/provider/sns" -) - -// Provider implements the AWS resource provider's operations for all known AWS types. -type Provider struct { - impls map[tokens.Type]lumirpc.ResourceProviderServer -} - -// NewProvider creates a new provider instance with server objects registered for every resource type. -func NewProvider(host *provider.HostClient) (*Provider, error) { - ctx, err := awsctx.New(host) - if err != nil { - return nil, err - } - return &Provider{ - impls: map[tokens.Type]lumirpc.ResourceProviderServer{ - apigateway.DeploymentToken: apigateway.NewDeploymentProvider(ctx), - apigateway.RestAPIToken: apigateway.NewRestAPIProvider(ctx), - apigateway.StageToken: apigateway.NewStageProvider(ctx), - cloudwatch.LogGroupToken: cloudwatch.NewLogGroupProvider(ctx), - cloudwatch.LogSubscriptionFilterToken: cloudwatch.NewLogSubscriptionFilterProvider(ctx), - dynamodb.TableToken: dynamodb.NewTableProvider(ctx), - ec2.InstanceToken: ec2.NewInstanceProvider(ctx), - ec2.SecurityGroupToken: ec2.NewSecurityGroupProvider(ctx), - elasticbeanstalk.ApplicationToken: elasticbeanstalk.NewApplicationProvider(ctx), - elasticbeanstalk.ApplicationVersionToken: elasticbeanstalk.NewApplicationVersionProvider(ctx), - elasticbeanstalk.EnvironmentToken: elasticbeanstalk.NewEnvironmentProvider(ctx), - lambda.FunctionToken: lambda.NewFunctionProvider(ctx), - lambda.PermissionToken: lambda.NewPermissionProvider(ctx), - iam.InstanceProfileToken: iam.NewInstanceProfileProvider(ctx), - iam.RoleToken: iam.NewRoleProvider(ctx), - s3.BucketToken: s3.NewBucketProvider(ctx), - s3.ObjectToken: s3.NewObjectProvider(ctx), - sns.TopicToken: sns.NewTopicProvider(ctx), - sns.SubscriptionToken: sns.NewSubscriptionProvider(ctx), - }, - }, nil -} - -var _ lumirpc.ResourceProviderServer = (*Provider)(nil) - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *Provider) Check(ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - t := tokens.Type(req.GetType()) - if prov, has := p.impls[t]; has { - return prov.Check(ctx, req) - } - return nil, fmt.Errorf("Unrecognized resource type (Check): %v", t) -} - -// Name names a given resource. Sometimes this will be assigned by a developer, and so the provider -// simply fetches it from the property bag; other times, the provider will assign this based on its own algorithm. -// In any case, resources with the same name must be safe to use interchangeably with one another. -func (p *Provider) Name(ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - t := tokens.Type(req.GetType()) - if prov, has := p.impls[t]; has { - return prov.Name(ctx, req) - } - return nil, fmt.Errorf("Unrecognized resource type (Name): %v", t) -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *Provider) Create(ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - t := tokens.Type(req.GetType()) - if prov, has := p.impls[t]; has { - return prov.Create(ctx, req) - } - return nil, fmt.Errorf("Unrecognized resource type (Create): %v", t) -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *Provider) Get(ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - t := tokens.Type(req.GetType()) - if prov, has := p.impls[t]; has { - return prov.Get(ctx, req) - } - return nil, fmt.Errorf("Unrecognized resource type (Get): %v", t) -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *Provider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - t := tokens.Type(req.GetType()) - if prov, has := p.impls[t]; has { - return prov.InspectChange(ctx, req) - } - return nil, fmt.Errorf("Unrecognized resource type (InspectChange): %v", t) -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *Provider) Update(ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - t := tokens.Type(req.GetType()) - if prov, has := p.impls[t]; has { - return prov.Update(ctx, req) - } - return nil, fmt.Errorf("Unrecognized resource type (Update): %v", t) -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *Provider) Delete(ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - t := tokens.Type(req.GetType()) - if prov, has := p.impls[t]; has { - return prov.Delete(ctx, req) - } - return nil, fmt.Errorf("Unrecognized resource type (Delete): %v", t) -} diff --git a/lib/aws/provider/s3/bucket.go b/lib/aws/provider/s3/bucket.go deleted file mode 100644 index e7a3f6c20..000000000 --- a/lib/aws/provider/s3/bucket.go +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package s3 - -import ( - "crypto/sha1" - "errors" - "fmt" - "regexp" - "strings" - - "github.com/aws/aws-sdk-go/aws" - awss3 "github.com/aws/aws-sdk-go/service/s3" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/s3" -) - -const BucketToken = s3.BucketToken - -// constants for the various bucket limits. -const ( - minBucketName = 3 - maxBucketName = 63 // TODO[pulumi/lumi#218]: consider supporting legacy us-east-1 (255) limits. -) - -var ( - bucketNameRegexp = regexp.MustCompile(`^[a-z0-9.\-]*$`) - bucketNameBadCharsRegExp = regexp.MustCompile(`[^a-z0-9.\-]`) -) - -// NewBucketProvider creates a provider that handles S3 bucket operations. -func NewBucketProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &buckProvider{ctx} - return s3.NewBucketProvider(ops) -} - -type buckProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *buckProvider) Check(ctx context.Context, obj *s3.Bucket, property string) error { - switch property { - case s3.Bucket_BucketName: - if name := obj.BucketName; name != nil { - if matched := bucketNameRegexp.MatchString(*name); !matched { - fmt.Printf("Failed to match regexp\n") - return fmt.Errorf("did not match regexp %v", bucketNameRegexp) - } else if len(*name) < minBucketName { - return fmt.Errorf("less than minimum length of %v", minBucketName) - } else if len(*name) > maxBucketName { - return fmt.Errorf("exceeded maximum length of %v", maxBucketName) - } - } - } - // TODO[pulumi/lumi#218]: by default, only up to 100 buckets in an account. - // TODO[pulumi/lumi#218]: check the vailidity of names (see - // http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html). - // TODO[pulumi/lumi#218]: check the validity of the access control field. - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *buckProvider) Create(ctx context.Context, obj *s3.Bucket) (resource.ID, error) { - // If an explicit name is given, use it. Otherwise, auto-generate a name in part based on the resource name. - var name string - if obj.BucketName != nil { - name = *obj.BucketName - } else { - // S3 bucket names have strict naming requirements. To use the Name property as a prefix, we - // need to convert it to a safe form first. - lowerName := strings.ToLower(*obj.Name) - safeName := bucketNameBadCharsRegExp.ReplaceAllString(lowerName, "-") - name = resource.NewUniqueHex(safeName+"-", maxBucketName, sha1.Size) - } - var acl *string - if obj.AccessControl != nil { - acl = aws.String(string(*obj.AccessControl)) - } - fmt.Printf("Creating S3 Bucket '%v' with name '%v'\n", *obj.Name, name) - create := &awss3.CreateBucketInput{ - Bucket: aws.String(name), - ACL: acl, - } - - // Now go ahead and perform the action. - if _, err := p.ctx.S3().CreateBucket(create); err != nil { - return "", err - } - - // Wait for the bucket to be ready and then return the ID (just its name). - fmt.Printf("S3 Bucket created: %v; waiting for it to become active\n", name) - if err := p.waitForBucketState(name, true); err != nil { - return "", err - } - return arn.NewS3BucketID(name), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *buckProvider) Get(ctx context.Context, id resource.ID) (*s3.Bucket, error) { - name, err := arn.ParseResourceName(id) - if err != nil { - return nil, err - } - - if _, err := p.ctx.S3().GetBucketAcl(&awss3.GetBucketAclInput{Bucket: aws.String(name)}); err != nil { - if awsctx.IsAWSError(err, "NotFound", "NoSuchBucket") { - return nil, nil - } - return nil, err - } - - // Note that the canned ACL cannot be recreated from the GetBucketAclInput call, because it will have been expanded - // out into its constituent grants/owner parts; so we just retain the existing value on the receiver's side. - return &s3.Bucket{ - BucketName: &name, - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *buckProvider) InspectChange(ctx context.Context, id resource.ID, - old *s3.Bucket, new *s3.Bucket, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *buckProvider) Update(ctx context.Context, id resource.ID, - old *s3.Bucket, new *s3.Bucket, diff *resource.ObjectDiff) error { - return errors.New("Not yet implemented") -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *buckProvider) Delete(ctx context.Context, id resource.ID) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - - // First, perform the deletion. - fmt.Printf("Deleting S3 Bucket '%v'\n", name) - if _, err := p.ctx.S3().DeleteBucket(&awss3.DeleteBucketInput{ - Bucket: aws.String(name), - }); err != nil { - return err - } - - // Wait for the bucket to actually become deleted before returning. - fmt.Printf("S3 Bucket delete request submitted; waiting for it to delete\n") - return p.waitForBucketState(name, false) -} - -func (p *buckProvider) waitForBucketState(name string, exist bool) error { - succ, err := awsctx.RetryUntil( - p.ctx, - func() (bool, error) { - if _, err := p.ctx.S3().HeadBucket(&awss3.HeadBucketInput{ - Bucket: aws.String(name), - }); err != nil { - if awsctx.IsAWSError(err, "NotFound", "NoSuchBucket") { - // The bucket is missing; if exist==false, we're good, otherwise keep retrying. - return !exist, nil - } - return false, err // anything other than "bucket missing" is a real error; propagate it. - } - - // If we got here, the bucket was found; if exist==true, we're good; else, keep retrying. - return exist, nil - }, - ) - if err != nil { - return err - } else if !succ { - var reason string - if exist { - reason = "created" - } else { - reason = "deleted" - } - return fmt.Errorf("S3 bucket '%v' did not become %v", name, reason) - } - return nil -} diff --git a/lib/aws/provider/s3/object.go b/lib/aws/provider/s3/object.go deleted file mode 100644 index e0c002b1a..000000000 --- a/lib/aws/provider/s3/object.go +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package s3 - -import ( - "fmt" - "regexp" - - "github.com/aws/aws-sdk-go/aws" - awss3 "github.com/aws/aws-sdk-go/service/s3" - "github.com/pkg/errors" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/convutil" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/s3" -) - -const ObjectToken = s3.ObjectToken - -// constants for the various object constraints. -const ( - maxObjectKey = 1024 - objectKeyRegexp = "[0-9a-zA-Z!-_.*'()]" -) - -// NewObjectProvider creates a provider that handles S3 Object operations. -func NewObjectProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &objProvider{ctx} - return s3.NewObjectProvider(ops) -} - -type objProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *objProvider) Check(ctx context.Context, obj *s3.Object, property string) error { - switch property { - case s3.Object_Key: - if len(obj.Key) > maxObjectKey { - return fmt.Errorf("exceeded maximum length of %v", maxObjectKey) - } - if match, err := regexp.MatchString(objectKeyRegexp, obj.Key); err != nil { - return err - } else if !match { - return fmt.Errorf("contains invalid characters (must match '%v')", objectKeyRegexp) - } - } - return nil -} - -// Name names a given resource. Sometimes this will be assigned by a developer, and so the provider -// simply fetches it from the property bag; other times, the provider will assign this based on its own algorithm. -// In any case, resources with the same name must be safe to use interchangeably with one another. -func (p *objProvider) Name(ctx context.Context, obj *s3.Object) (string, error) { - if obj.Key == "" { - return "", errors.New("S3 Object's key was empty") - } - return obj.Key, nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *objProvider) Create(ctx context.Context, obj *s3.Object) (resource.ID, error) { - // Fetch the contents of the body by way of the source asset. - body, err := obj.Source.Read() - if err != nil { - return "", err - } - defer contract.IgnoreClose(body) - - // Now go ahead and perform the creation. - buck, err := arn.ParseResourceName(obj.Bucket) - if err != nil { - return "", err - } - fmt.Printf("Creating S3 Object '%v' in bucket '%v'\n", obj.Key, buck) - if _, err := p.ctx.S3().PutObject(&awss3.PutObjectInput{ - Bucket: aws.String(buck), - Key: aws.String(obj.Key), - Body: body, - ContentType: obj.ContentType, - ContentDisposition: obj.ContentDisposition, - CacheControl: obj.CacheControl, - ContentEncoding: obj.ContentEncoding, - ContentLanguage: obj.ContentLanguage, - ContentLength: convutil.Float64PToInt64P(obj.ContentLength), - }); err != nil { - return "", err - } - - // Wait for the object to be ready and then return the ID (just its name). - fmt.Printf("S3 Object created: %v; waiting for it to become active\n", obj.Key) - if err := p.waitForObjectState(buck, obj.Key, true); err != nil { - return "", err - } - return arn.NewS3ObjectID(buck, obj.Key), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *objProvider) Get(ctx context.Context, id resource.ID) (*s3.Object, error) { - buck, key, err := arn.ParseResourceNamePair(id) - if err != nil { - return nil, err - } - resp, err := p.ctx.S3().GetObject(&awss3.GetObjectInput{ - Bucket: aws.String(buck), - Key: aws.String(key), - }) - if err != nil { - if awsctx.IsAWSError(err, "NotFound", "NoSuchKey") { - return nil, nil - } - return nil, err - } - return &s3.Object{ - Bucket: resource.ID(arn.NewS3Bucket(buck)), - Key: key, - ContentType: resp.ContentType, - ContentDisposition: resp.ContentDisposition, - CacheControl: resp.CacheControl, - ContentEncoding: resp.ContentEncoding, - ContentLanguage: resp.ContentLanguage, - ContentLength: convutil.Int64PToFloat64P(resp.ContentLength), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *objProvider) InspectChange(ctx context.Context, id resource.ID, - old *s3.Object, new *s3.Object, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *objProvider) Update(ctx context.Context, id resource.ID, - old *s3.Object, new *s3.Object, diff *resource.ObjectDiff) error { - // The id is uniquely determined by `replace` properties, so update is the same as create, and we can expect - // the resulting id to be unchanged. - newid, err := p.Create(ctx, new) - contract.Assert(id == newid) - return err -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *objProvider) Delete(ctx context.Context, id resource.ID) error { - buck, key, err := arn.ParseResourceNamePair(id) - if err != nil { - return err - } - - // First, perform the deletion. - fmt.Printf("Deleting S3 Object '%v'\n", id) - if _, err := p.ctx.S3().DeleteObject(&awss3.DeleteObjectInput{ - Bucket: aws.String(buck), - Key: aws.String(key), - }); err != nil { - return err - } - - // Wait for the bucket to actually become deleted before returning. - fmt.Printf("S3 Object delete request submitted; waiting for it to delete\n") - return p.waitForObjectState(buck, key, false) -} - -func (p *objProvider) waitForObjectState(bucket string, key string, exist bool) error { - succ, err := awsctx.RetryUntil( - p.ctx, - func() (bool, error) { - if _, err := p.ctx.S3().GetObject(&awss3.GetObjectInput{ - Bucket: aws.String(bucket), - Key: aws.String(key), - }); err != nil { - if awsctx.IsAWSError(err, "NotFound", "NoSuchKey") { - // The object is missing; if exist==false, we're good, otherwise keep retrying. - return !exist, nil - } - return false, err // anything other than "object missing" is a real error; propagate it. - } - - // If we got here, the object was found; if exist==true, we're good; else, keep retrying. - return exist, nil - }, - ) - if err != nil { - return err - } else if !succ { - var reason string - if exist { - reason = "created" - } else { - reason = "deleted" - } - return fmt.Errorf("S3 Object '%v' in bucket '%v' did not become %v", key, bucket, reason) - } - return nil -} diff --git a/lib/aws/provider/s3/object_test.go b/lib/aws/provider/s3/object_test.go deleted file mode 100644 index 438e7a757..000000000 --- a/lib/aws/provider/s3/object_test.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package s3 - -import ( - "fmt" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - awss3 "github.com/aws/aws-sdk-go/service/s3" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/provider/testutil" - "github.com/pulumi/lumi/lib/aws/rpc/s3" - "github.com/pulumi/lumi/pkg/resource" - "github.com/stretchr/testify/assert" -) - -func Test(t *testing.T) { - t.Parallel() - - prefix := resource.NewUniqueHex("lumitest", 20, 20) - ctx := testutil.CreateContext(t) - defer func() { - buckerr := cleanupBucket(prefix, ctx) - assert.Nil(t, buckerr) - }() - str1 := "

Hello world!

" - str2 := `{"hello": "world"}` - source1 := resource.NewTextAsset(str1) - source2 := resource.NewTextAsset(str2) - - resources := map[string]testutil.Resource{ - "bucket": {Provider: NewBucketProvider(ctx), Token: BucketToken}, - "object": {Provider: NewObjectProvider(ctx), Token: ObjectToken}, - } - steps := []testutil.Step{ - // Create a bucket and object - { - testutil.ResourceGenerator{ - Name: "bucket", - Creator: func(ctx testutil.Context) interface{} { - return &s3.Bucket{ - Name: aws.String(prefix), - } - }, - }, - testutil.ResourceGenerator{ - Name: "object", - Creator: func(ctx testutil.Context) interface{} { - return &s3.Object{ - Bucket: ctx.GetResourceID("bucket"), - Key: prefix, - Source: &source1, - ContentType: aws.String("text/html"), - } - }, - }, - }, - // Update the object with new `source` content - { - testutil.ResourceGenerator{ - Name: "object", - Creator: func(ctx testutil.Context) interface{} { - return &s3.Object{ - Bucket: ctx.GetResourceID("bucket"), - Key: prefix, - Source: &source2, - ContentType: aws.String("application/json"), - } - }, - }, - }, - } - - props := testutil.ProviderTest(t, resources, steps) - - assert.Equal(t, "application/json", props["object"].Fields["contentType"].GetStringValue()) - assert.Equal(t, len(str2), int(props["object"].Fields["contentLength"].GetNumberValue()), - "expected object content-length to equal len(%q)", str2) -} - -func cleanupBucket(prefix string, ctx *awsctx.Context) error { - fmt.Printf("Cleaning up buckets with name prefix:%v\n", prefix) - list, err := ctx.S3().ListBuckets(&awss3.ListBucketsInput{}) - if err != nil { - return err - } - cleaned := 0 - for _, buck := range list.Buckets { - if strings.HasPrefix(aws.StringValue(buck.Name), prefix) { - objList, err := ctx.S3().ListObjects(&awss3.ListObjectsInput{ - Bucket: buck.Name, - }) - if err != nil { - return err - } - for _, obj := range objList.Contents { - _, err = ctx.S3().DeleteObject(&awss3.DeleteObjectInput{ - Bucket: buck.Name, - Key: obj.Key, - }) - if err != nil { - return err - } - } - _, err = ctx.S3().DeleteBucket(&awss3.DeleteBucketInput{ - Bucket: buck.Name, - }) - if err != nil { - return err - } - cleaned++ - } - } - fmt.Printf("Cleaned up %v buckets\n", cleaned) - return nil -} diff --git a/lib/aws/provider/sns/sns_test.go b/lib/aws/provider/sns/sns_test.go deleted file mode 100644 index 362ddf548..000000000 --- a/lib/aws/provider/sns/sns_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package sns - -import ( - "fmt" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - awssns "github.com/aws/aws-sdk-go/service/sns" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/provider/testutil" - "github.com/pulumi/lumi/lib/aws/rpc/sns" - "github.com/pulumi/lumi/pkg/resource" - "github.com/stretchr/testify/assert" -) - -func Test(t *testing.T) { - t.Parallel() - - prefix := resource.NewUniqueHex("lumitest", 20, 20) - ctx := testutil.CreateContext(t) - defer func() { - err := cleanupTopics(prefix, ctx) - assert.Nil(t, err) - }() - - resources := map[string]testutil.Resource{ - "topic": {Provider: NewTopicProvider(ctx), Token: TopicToken}, - } - steps := []testutil.Step{ - { - testutil.ResourceGenerator{ - Name: "topic", - Creator: func(ctx testutil.Context) interface{} { - return &sns.Topic{ - Name: aws.String(prefix), - DisplayName: aws.String(prefix), - } - }, - }, - }, - } - - props := testutil.ProviderTest(t, resources, steps) - assert.NotNil(t, props) -} - -func cleanupTopics(prefix string, ctx *awsctx.Context) error { - fmt.Printf("Cleaning up topic with name:%v\n", prefix) - list, err := ctx.SNS().ListTopics(&awssns.ListTopicsInput{}) - if err != nil { - return err - } - cleaned := 0 - for _, topic := range list.Topics { - if strings.Contains(aws.StringValue(topic.TopicArn), prefix) { - if _, delerr := ctx.SNS().DeleteTopic(&awssns.DeleteTopicInput{ - TopicArn: topic.TopicArn, - }); delerr != nil { - fmt.Printf("Unable to cleanup topic %v: %v\n", topic.TopicArn, delerr) - return delerr - } - cleaned++ - } - } - fmt.Printf("Cleaned up %v topics\n", cleaned) - return nil -} diff --git a/lib/aws/provider/sns/subscription.go b/lib/aws/provider/sns/subscription.go deleted file mode 100644 index 830c5dbe4..000000000 --- a/lib/aws/provider/sns/subscription.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package sns - -import ( - "fmt" - - "github.com/aws/aws-sdk-go/aws" - awssns "github.com/aws/aws-sdk-go/service/sns" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/sns" -) - -const SubscriptionToken = sns.SubscriptionToken - -// NewSubscriptionProvider creates a provider that handles SNS subscription operations. -func NewSubscriptionProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &subscriptionProvider{ctx} - return sns.NewSubscriptionProvider(ops) -} - -type subscriptionProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *subscriptionProvider) Check(ctx context.Context, obj *sns.Subscription, property string) error { - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *subscriptionProvider) Create(ctx context.Context, obj *sns.Subscription) (resource.ID, error) { - topicName, err := arn.ParseResourceName(obj.Topic) - if err != nil { - return "", err - } - fmt.Printf("Creating SNS Subscription on topic '%v'\n", topicName) - create := &awssns.SubscribeInput{ - TopicArn: aws.String(string(obj.Topic)), - Endpoint: aws.String(obj.Endpoint), - Protocol: aws.String(string(obj.Protocol)), - } - resp, err := p.ctx.SNS().Subscribe(create) - if err != nil { - return "", err - } - contract.Assert(resp != nil) - contract.Assert(resp.SubscriptionArn != nil) - return resource.ID(*resp.SubscriptionArn), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *subscriptionProvider) Get(ctx context.Context, id resource.ID) (*sns.Subscription, error) { - resp, err := p.ctx.SNS().GetSubscriptionAttributes(&awssns.GetSubscriptionAttributesInput{ - SubscriptionArn: aws.String(string(id)), - }) - if err != nil { - return nil, err - } - listResp, err := p.ctx.SNS().ListSubscriptionsByTopic(&awssns.ListSubscriptionsByTopicInput{ - TopicArn: resp.Attributes["TopicArn"], - }) - if err != nil { - return nil, err - } - var subscription *awssns.Subscription - for _, s := range listResp.Subscriptions { - if *s.SubscriptionArn == string(id) { - subscription = s - } - } - return &sns.Subscription{ - Topic: resource.ID(aws.StringValue(resp.Attributes["TopicArn"])), - Endpoint: aws.StringValue(subscription.Endpoint), - Protocol: sns.Protocol(aws.StringValue(subscription.Protocol)), - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *subscriptionProvider) InspectChange(ctx context.Context, id resource.ID, - old *sns.Subscription, new *sns.Subscription, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *subscriptionProvider) Update(ctx context.Context, id resource.ID, - old *sns.Subscription, new *sns.Subscription, diff *resource.ObjectDiff) error { - contract.Failf("No updatable properties on SNS Subscription") - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *subscriptionProvider) Delete(ctx context.Context, id resource.ID) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - fmt.Printf("Deleting SNS Subscription '%v'\n", name) - _, err = p.ctx.SNS().Unsubscribe(&awssns.UnsubscribeInput{ - SubscriptionArn: id.StringPtr(), - }) - return err -} diff --git a/lib/aws/provider/sns/topic.go b/lib/aws/provider/sns/topic.go deleted file mode 100644 index f4a6a06a7..000000000 --- a/lib/aws/provider/sns/topic.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package sns - -import ( - "crypto/sha1" - "fmt" - "regexp" - - "github.com/aws/aws-sdk-go/aws" - awssns "github.com/aws/aws-sdk-go/service/sns" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/lib/aws/provider/arn" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/lib/aws/rpc/sns" - "github.com/pulumi/lumi/pkg/util/contract" -) - -const TopicToken = sns.TopicToken - -// constants for the various topic limits. -const ( - minTopicName = 1 - maxTopicName = 256 - displayNameAttributeName = "DisplayName" -) - -var ( - topicNameRegexp = regexp.MustCompile(`^[a-zA-Z0-9_\-]*$`) - topicNameDisallowedRegexp = regexp.MustCompile(`[^a-zA-Z0-9_\-]`) -) - -// NewTopicProvider creates a provider that handles SNS topic operations. -func NewTopicProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer { - ops := &topicProvider{ctx} - return sns.NewTopicProvider(ops) -} - -type topicProvider struct { - ctx *awsctx.Context -} - -// Check validates that the given property bag is valid for a resource of the given type. -func (p *topicProvider) Check(ctx context.Context, obj *sns.Topic, property string) error { - switch property { - case sns.Topic_TopicName: - if name := obj.TopicName; name != nil { - if matched := topicNameRegexp.MatchString(*name); !matched { - fmt.Printf("Failed to match regexp\n") - return fmt.Errorf("did not match regexp %v", topicNameRegexp) - } else if len(*name) < minTopicName { - return fmt.Errorf("less than minimum length of %v", minTopicName) - } else if len(*name) > maxTopicName { - return fmt.Errorf("exceeded maximum length of %v", maxTopicName) - } - } - } - return nil -} - -// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID -// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational"). -func (p *topicProvider) Create(ctx context.Context, obj *sns.Topic) (resource.ID, error) { - // If an explicit name is given, use it. Otherwise, auto-generate a name in part based on the resource name. - var name string - if obj.TopicName != nil { - name = *obj.TopicName - } else { - // SNS topic names have strict naming requirements. To use the Name property as a prefix, we - // need to convert it to a safe form first. - safeName := topicNameDisallowedRegexp.ReplaceAllString(*obj.Name, "-") - name = resource.NewUniqueHex(safeName+"-", maxTopicName, sha1.Size) - } - fmt.Printf("Creating SNS Topic '%v' with name '%v'\n", *obj.Name, name) - create := &awssns.CreateTopicInput{ - Name: aws.String(name), - } - resp, err := p.ctx.SNS().CreateTopic(create) - if err != nil { - return "", err - } - contract.Assert(resp != nil) - contract.Assert(resp.TopicArn != nil) - if obj.DisplayName != nil { - _, err := p.ctx.SNS().SetTopicAttributes(&awssns.SetTopicAttributesInput{ - TopicArn: resp.TopicArn, - AttributeName: aws.String(displayNameAttributeName), - AttributeValue: obj.DisplayName, - }) - if err != nil { - return "", err - } - } - return resource.ID(*resp.TopicArn), nil -} - -// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found. -func (p *topicProvider) Get(ctx context.Context, id resource.ID) (*sns.Topic, error) { - name, err := arn.ParseResourceName(id) - if err != nil { - return nil, err - } - resp, err := p.ctx.SNS().GetTopicAttributes(&awssns.GetTopicAttributesInput{ - TopicArn: aws.String(string(id)), - }) - if err != nil { - return nil, err - } - return &sns.Topic{ - TopicName: &name, - DisplayName: resp.Attributes[displayNameAttributeName], - }, nil -} - -// InspectChange checks what impacts a hypothetical update will have on the resource's properties. -func (p *topicProvider) InspectChange(ctx context.Context, id resource.ID, - old *sns.Topic, new *sns.Topic, diff *resource.ObjectDiff) ([]string, error) { - return nil, nil -} - -// Update updates an existing resource with new values. Only those values in the provided property bag are updated -// to new values. The resource ID is returned and may be different if the resource had to be recreated. -func (p *topicProvider) Update(ctx context.Context, id resource.ID, - old *sns.Topic, new *sns.Topic, diff *resource.ObjectDiff) error { - if diff.Changed(sns.Topic_DisplayName) { - _, err := p.ctx.SNS().SetTopicAttributes(&awssns.SetTopicAttributesInput{ - TopicArn: aws.String(string(id)), - AttributeName: aws.String(displayNameAttributeName), - AttributeValue: new.DisplayName, - }) - if err != nil { - return err - } - } - return nil -} - -// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist. -func (p *topicProvider) Delete(ctx context.Context, id resource.ID) error { - name, err := arn.ParseResourceName(id) - if err != nil { - return err - } - fmt.Printf("Deleting SNS Topic '%v'\n", name) - _, err = p.ctx.SNS().DeleteTopic(&awssns.DeleteTopicInput{ - TopicArn: id.StringPtr(), - }) - return err -} diff --git a/lib/aws/provider/testutil/provider.go b/lib/aws/provider/testutil/provider.go deleted file mode 100644 index 59080ee0a..000000000 --- a/lib/aws/provider/testutil/provider.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright 2016-2017, Pulumi Corporation. All rights reserved. - -package testutil - -import ( - "fmt" - "testing" - - structpb "github.com/golang/protobuf/ptypes/struct" - "github.com/pulumi/lumi/lib/aws/provider/awsctx" - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - "github.com/stretchr/testify/assert" -) - -type Context interface { - GetResourceID(name string) resource.ID - GetOutputProps(name string) *structpb.Struct -} - -type Resource struct { - Provider lumirpc.ResourceProviderServer - Token tokens.Type -} - -type ResourceGenerator struct { - Name string - Creator func(ctx Context) interface{} -} - -type Step []ResourceGenerator - -// ProviderTest walks through Create, Update and Delete operations for a collection of resources. The provided -// resources map must contain the provider and tokens for each named resource to be created during the test. -// Each step of the test can provide values for any subset of the named resources, causeing those resources to -// be created or updated as needed. After walking through each step, all of the created resources are deleted. -// Check operations are performed on all provided resource inputs during the test. -// performs Check operations on each provided resource. -func ProviderTest(t *testing.T, resources map[string]Resource, steps []Step) map[string]*structpb.Struct { - - p := &providerTest{ - resources: resources, - namesInCreationOrder: []string{}, - ids: map[string]resource.ID{}, - props: map[string]*structpb.Struct{}, - outProps: map[string]*structpb.Struct{}, - } - - // For each step, create or update all listed resources - for _, step := range steps { - for _, res := range step { - currentResource, ok := resources[res.Name] - if !ok { - t.Fatalf("expected resource to have been pre-declared: %v", res.Name) - } - provider := currentResource.Provider - token := currentResource.Token - if id, ok := p.ids[res.Name]; !ok { - id, props, outProps := createResource(t, res.Creator(p), provider, token) - p.ids[res.Name] = resource.ID(id) - p.namesInCreationOrder = append(p.namesInCreationOrder, res.Name) - p.props[res.Name] = props - p.outProps[res.Name] = outProps - if id == "" { - t.Fatal("expected to successfully create resource") - } - } else { - oldProps := p.props[res.Name] - ok, props, outProps := updateResource(t, string(id), oldProps, res.Creator(p), provider, token) - if !ok { - t.Fatal("expected to successfully update resource") - } - p.props[res.Name] = props - p.outProps[res.Name] = outProps - } - } - } - // Delete resources in the opposite order they were created - for i := len(p.namesInCreationOrder) - 1; i >= 0; i-- { - name := p.namesInCreationOrder[i] - id := p.ids[name] - provider := resources[name].Provider - token := resources[name].Token - ok := deleteResource(t, string(id), provider, token) - if !ok { - t.Fatal("expected to successfully delete resource") - } - } - return p.outProps -} - -// ProviderTestSimple takes a resource provider and array of resource steps and performs a Create, as many Updates -// as neeed, and finally a Delete operation on a single resouce of the given type to walk the resource through the -// resource lifecycle. It also performs Check operations on each input state of the resource. -func ProviderTestSimple(t *testing.T, provider lumirpc.ResourceProviderServer, token tokens.Type, - steps []interface{}) *structpb.Struct { - resources := map[string]Resource{ - "testResource": { - Provider: provider, - Token: token, - }, - } - detailedSteps := []Step{} - for _, step := range steps { - curStep := step - detailedSteps = append(detailedSteps, []ResourceGenerator{ - { - Name: "testResource", - Creator: func(ctx Context) interface{} { - return curStep - }, - }, - }) - } - outProps := ProviderTest(t, resources, detailedSteps) - return outProps["testResource"] -} - -type providerTest struct { - resources map[string]Resource - namesInCreationOrder []string - ids map[string]resource.ID - props map[string]*structpb.Struct - outProps map[string]*structpb.Struct -} - -func (p *providerTest) GetResourceID(name string) resource.ID { - if id, ok := p.ids[name]; ok { - return id - } - return resource.ID("") -} - -func (p *providerTest) GetOutputProps(name string) *structpb.Struct { - if props, ok := p.outProps[name]; ok { - return props - } - return nil -} - -var _ Context = &providerTest{} - -func createResource(t *testing.T, res interface{}, provider lumirpc.ResourceProviderServer, - token tokens.Type) (string, *structpb.Struct, *structpb.Struct) { - props := plugin.MarshalProperties(resource.NewPropertyMap(res), plugin.MarshalOptions{}) - fmt.Printf("[Provider Test]: Checking %v\n", token) - checkResp, err := provider.Check(nil, &lumirpc.CheckRequest{ - Type: string(token), - Properties: props, - }) - if !assert.NoError(t, err, "expected no error checking table") { - return "", nil, nil - } - assert.Equal(t, 0, len(checkResp.Failures), "expected no check failures") - fmt.Printf("[Provider Test]: Creating %v\n", token) - resp, err := provider.Create(nil, &lumirpc.CreateRequest{ - Type: string(token), - Properties: props, - }) - if !assert.NoError(t, err, "expected no error creating resource") { - return "", nil, nil - } - if !assert.NotNil(t, resp, "expected a non-nil response") { - return "", nil, nil - } - id := resp.Id - fmt.Printf("[Provider Test]: Getting %v with id %v\n", token, id) - getResp, err := provider.Get(nil, &lumirpc.GetRequest{ - Type: string(token), - Id: id, - }) - if !assert.NoError(t, err, "expected no error reading resource") { - return "", nil, nil - } - if !assert.NotNil(t, getResp, "expected a non-nil response reading the resources") { - return "", nil, nil - } - return id, props, getResp.Properties -} - -func updateResource(t *testing.T, id string, lastProps *structpb.Struct, res interface{}, - provider lumirpc.ResourceProviderServer, token tokens.Type) (bool, *structpb.Struct, *structpb.Struct) { - newProps := plugin.MarshalProperties(resource.NewPropertyMap(res), plugin.MarshalOptions{}) - fmt.Printf("[Provider Test]: Checking %v\n", token) - checkResp, err := provider.Check(nil, &lumirpc.CheckRequest{ - Type: string(token), - Properties: newProps, - }) - if !assert.NoError(t, err, "expected no error checking resource") { - return false, nil, nil - } - assert.Equal(t, 0, len(checkResp.Failures), "expected no check failures") - fmt.Printf("[Provider Test]: Updating %v with id %v\n", token, id) - _, err = provider.Update(nil, &lumirpc.UpdateRequest{ - Type: string(token), - Id: id, - Olds: lastProps, - News: newProps, - }) - if !assert.NoError(t, err, "expected no error creating resource") { - return false, nil, nil - } - fmt.Printf("[Provider Test]: Getting %v with id %v\n", token, id) - getResp, err := provider.Get(nil, &lumirpc.GetRequest{ - Type: string(token), - Id: id, - }) - if !assert.NoError(t, err, "expected no error reading resource") { - return false, nil, nil - } - if !assert.NotNil(t, getResp, "expected a non-nil response reading the resources") { - return false, nil, nil - } - return true, newProps, getResp.Properties -} - -func deleteResource(t *testing.T, id string, provider lumirpc.ResourceProviderServer, token tokens.Type) bool { - fmt.Printf("[Provider Test]: Deleting %v with id %v\n", token, id) - _, err := provider.Delete(nil, &lumirpc.DeleteRequest{ - Type: string(token), - Id: id, - }) - return assert.NoError(t, err, "expected no error deleting resource") -} - -// CreateContext creates an AWS Context object for executing tests, and skips the test if the context cannot be -// created succefully, most likely because credentials are unavailable in the execution environment. -func CreateContext(t *testing.T) *awsctx.Context { - if testing.Short() { - t.Skip("skipping long running AWS provider test - run tests without -short to test providers") - } - ctx, err := awsctx.New(nil) - if err != nil { - t.Skipf("AWS context could not be acquired: %v", err) - } - return ctx -} diff --git a/lib/aws/rpc/apigateway/account.go b/lib/aws/rpc/apigateway/account.go deleted file mode 100644 index 9760c6f47..000000000 --- a/lib/aws/rpc/apigateway/account.go +++ /dev/null @@ -1,201 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Account resource provider */ - -// AccountToken is the type token corresponding to the Account package type. -const AccountToken = tokens.Type("aws:apigateway/account:Account") - -// AccountProviderOps is a pluggable interface for Account-related management functionality. -type AccountProviderOps interface { - Check(ctx context.Context, obj *Account, property string) error - Create(ctx context.Context, obj *Account) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Account, error) - InspectChange(ctx context.Context, - id resource.ID, old *Account, new *Account, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Account, new *Account, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// AccountProvider is a dynamic gRPC-based plugin for managing Account resources. -type AccountProvider struct { - ops AccountProviderOps -} - -// NewAccountProvider allocates a resource provider that delegates to a ops instance. -func NewAccountProvider(ops AccountProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &AccountProvider{ops: ops} -} - -func (p *AccountProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(AccountToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Account", "name", failure)) - } - } - if !unks["cloudWatchRole"] { - if failure := p.ops.Check(ctx, obj, "cloudWatchRole"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Account", "cloudWatchRole", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *AccountProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(AccountToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Account_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *AccountProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(AccountToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *AccountProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(AccountToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *AccountProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(AccountToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *AccountProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(AccountToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *AccountProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(AccountToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *AccountProvider) Unmarshal( - v *pbstruct.Struct) (*Account, resource.PropertyMap, error) { - var obj Account - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Account structure(s) */ - -// Account is a marshalable representation of its corresponding IDL type. -type Account struct { - Name *string `lumi:"name,optional"` - CloudWatchRole *resource.ID `lumi:"cloudWatchRole,optional"` -} - -// Account's properties have constants to make dealing with diffs and property bags easier. -const ( - Account_Name = "name" - Account_CloudWatchRole = "cloudWatchRole" -) - - diff --git a/lib/aws/rpc/apigateway/apiKey.go b/lib/aws/rpc/apigateway/apiKey.go deleted file mode 100644 index f572b673a..000000000 --- a/lib/aws/rpc/apigateway/apiKey.go +++ /dev/null @@ -1,242 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for APIKey resource provider */ - -// APIKeyToken is the type token corresponding to the APIKey package type. -const APIKeyToken = tokens.Type("aws:apigateway/apiKey:APIKey") - -// APIKeyProviderOps is a pluggable interface for APIKey-related management functionality. -type APIKeyProviderOps interface { - Check(ctx context.Context, obj *APIKey, property string) error - Create(ctx context.Context, obj *APIKey) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*APIKey, error) - InspectChange(ctx context.Context, - id resource.ID, old *APIKey, new *APIKey, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *APIKey, new *APIKey, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// APIKeyProvider is a dynamic gRPC-based plugin for managing APIKey resources. -type APIKeyProvider struct { - ops APIKeyProviderOps -} - -// NewAPIKeyProvider allocates a resource provider that delegates to a ops instance. -func NewAPIKeyProvider(ops APIKeyProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &APIKeyProvider{ops: ops} -} - -func (p *APIKeyProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(APIKeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("APIKey", "name", failure)) - } - } - if !unks["keyName"] { - if failure := p.ops.Check(ctx, obj, "keyName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("APIKey", "keyName", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("APIKey", "description", failure)) - } - } - if !unks["enabled"] { - if failure := p.ops.Check(ctx, obj, "enabled"); failure != nil { - failures = append(failures, - resource.NewPropertyError("APIKey", "enabled", failure)) - } - } - if !unks["stageKeys"] { - if failure := p.ops.Check(ctx, obj, "stageKeys"); failure != nil { - failures = append(failures, - resource.NewPropertyError("APIKey", "stageKeys", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *APIKeyProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(APIKeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[APIKey_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *APIKeyProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(APIKeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *APIKeyProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(APIKeyToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *APIKeyProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(APIKeyToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("keyName") { - replaces = append(replaces, "keyName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *APIKeyProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(APIKeyToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *APIKeyProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(APIKeyToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *APIKeyProvider) Unmarshal( - v *pbstruct.Struct) (*APIKey, resource.PropertyMap, error) { - var obj APIKey - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable APIKey structure(s) */ - -// APIKey is a marshalable representation of its corresponding IDL type. -type APIKey struct { - Name *string `lumi:"name,optional"` - KeyName *string `lumi:"keyName,optional"` - Description *string `lumi:"description,optional"` - Enabled *bool `lumi:"enabled,optional"` - StageKeys *StageKey `lumi:"stageKeys,optional"` -} - -// APIKey's properties have constants to make dealing with diffs and property bags easier. -const ( - APIKey_Name = "name" - APIKey_KeyName = "keyName" - APIKey_Description = "description" - APIKey_Enabled = "enabled" - APIKey_StageKeys = "stageKeys" -) - -/* Marshalable StageKey structure(s) */ - -// StageKey is a marshalable representation of its corresponding IDL type. -type StageKey struct { - RestAPI *resource.ID `lumi:"restAPI,optional"` - Stage *resource.ID `lumi:"stage,optional"` -} - -// StageKey's properties have constants to make dealing with diffs and property bags easier. -const ( - StageKey_RestAPI = "restAPI" - StageKey_Stage = "stage" -) - - diff --git a/lib/aws/rpc/apigateway/authorizer.go b/lib/aws/rpc/apigateway/authorizer.go deleted file mode 100644 index e5912161e..000000000 --- a/lib/aws/rpc/apigateway/authorizer.go +++ /dev/null @@ -1,270 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Authorizer resource provider */ - -// AuthorizerToken is the type token corresponding to the Authorizer package type. -const AuthorizerToken = tokens.Type("aws:apigateway/authorizer:Authorizer") - -// AuthorizerProviderOps is a pluggable interface for Authorizer-related management functionality. -type AuthorizerProviderOps interface { - Check(ctx context.Context, obj *Authorizer, property string) error - Create(ctx context.Context, obj *Authorizer) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Authorizer, error) - InspectChange(ctx context.Context, - id resource.ID, old *Authorizer, new *Authorizer, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Authorizer, new *Authorizer, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// AuthorizerProvider is a dynamic gRPC-based plugin for managing Authorizer resources. -type AuthorizerProvider struct { - ops AuthorizerProviderOps -} - -// NewAuthorizerProvider allocates a resource provider that delegates to a ops instance. -func NewAuthorizerProvider(ops AuthorizerProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &AuthorizerProvider{ops: ops} -} - -func (p *AuthorizerProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(AuthorizerToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "name", failure)) - } - } - if !unks["type"] { - if failure := p.ops.Check(ctx, obj, "type"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "type", failure)) - } - } - if !unks["authorizerCredentials"] { - if failure := p.ops.Check(ctx, obj, "authorizerCredentials"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "authorizerCredentials", failure)) - } - } - if !unks["authorizerResultTTLInSeconds"] { - if failure := p.ops.Check(ctx, obj, "authorizerResultTTLInSeconds"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "authorizerResultTTLInSeconds", failure)) - } - } - if !unks["authorizerURI"] { - if failure := p.ops.Check(ctx, obj, "authorizerURI"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "authorizerURI", failure)) - } - } - if !unks["identitySource"] { - if failure := p.ops.Check(ctx, obj, "identitySource"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "identitySource", failure)) - } - } - if !unks["identityValidationExpression"] { - if failure := p.ops.Check(ctx, obj, "identityValidationExpression"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "identityValidationExpression", failure)) - } - } - if !unks["providers"] { - if failure := p.ops.Check(ctx, obj, "providers"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "providers", failure)) - } - } - if !unks["restAPI"] { - if failure := p.ops.Check(ctx, obj, "restAPI"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Authorizer", "restAPI", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *AuthorizerProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(AuthorizerToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Authorizer_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *AuthorizerProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(AuthorizerToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *AuthorizerProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(AuthorizerToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *AuthorizerProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(AuthorizerToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *AuthorizerProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(AuthorizerToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *AuthorizerProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(AuthorizerToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *AuthorizerProvider) Unmarshal( - v *pbstruct.Struct) (*Authorizer, resource.PropertyMap, error) { - var obj Authorizer - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Authorizer structure(s) */ - -// Authorizer is a marshalable representation of its corresponding IDL type. -type Authorizer struct { - Name *string `lumi:"name,optional"` - Type AuthorizerType `lumi:"type"` - AuthorizerCredentials *resource.ID `lumi:"authorizerCredentials,optional"` - AuthorizerResultTTLInSeconds *float64 `lumi:"authorizerResultTTLInSeconds,optional"` - AuthorizerURI *string `lumi:"authorizerURI,optional"` - IdentitySource *string `lumi:"identitySource,optional"` - IdentityValidationExpression *string `lumi:"identityValidationExpression,optional"` - Providers *[]resource.ID `lumi:"providers,optional"` - RestAPI *resource.ID `lumi:"restAPI,optional"` -} - -// Authorizer's properties have constants to make dealing with diffs and property bags easier. -const ( - Authorizer_Name = "name" - Authorizer_Type = "type" - Authorizer_AuthorizerCredentials = "authorizerCredentials" - Authorizer_AuthorizerResultTTLInSeconds = "authorizerResultTTLInSeconds" - Authorizer_AuthorizerURI = "authorizerURI" - Authorizer_IdentitySource = "identitySource" - Authorizer_IdentityValidationExpression = "identityValidationExpression" - Authorizer_Providers = "providers" - Authorizer_RestAPI = "restAPI" -) - -/* Typedefs */ - -type ( - AuthorizerType string -) - -/* Constants */ - -const ( - CognitoAuthorizer AuthorizerType = "COGNITO_USER_POOLS" - TokenAuthorizer AuthorizerType = "TOKEN" -) - - diff --git a/lib/aws/rpc/apigateway/basePathMapping.go b/lib/aws/rpc/apigateway/basePathMapping.go deleted file mode 100644 index d2b692bcd..000000000 --- a/lib/aws/rpc/apigateway/basePathMapping.go +++ /dev/null @@ -1,225 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for BasePathMapping resource provider */ - -// BasePathMappingToken is the type token corresponding to the BasePathMapping package type. -const BasePathMappingToken = tokens.Type("aws:apigateway/basePathMapping:BasePathMapping") - -// BasePathMappingProviderOps is a pluggable interface for BasePathMapping-related management functionality. -type BasePathMappingProviderOps interface { - Check(ctx context.Context, obj *BasePathMapping, property string) error - Create(ctx context.Context, obj *BasePathMapping) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*BasePathMapping, error) - InspectChange(ctx context.Context, - id resource.ID, old *BasePathMapping, new *BasePathMapping, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *BasePathMapping, new *BasePathMapping, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// BasePathMappingProvider is a dynamic gRPC-based plugin for managing BasePathMapping resources. -type BasePathMappingProvider struct { - ops BasePathMappingProviderOps -} - -// NewBasePathMappingProvider allocates a resource provider that delegates to a ops instance. -func NewBasePathMappingProvider(ops BasePathMappingProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &BasePathMappingProvider{ops: ops} -} - -func (p *BasePathMappingProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(BasePathMappingToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("BasePathMapping", "name", failure)) - } - } - if !unks["domainName"] { - if failure := p.ops.Check(ctx, obj, "domainName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("BasePathMapping", "domainName", failure)) - } - } - if !unks["restAPI"] { - if failure := p.ops.Check(ctx, obj, "restAPI"); failure != nil { - failures = append(failures, - resource.NewPropertyError("BasePathMapping", "restAPI", failure)) - } - } - if !unks["basePath"] { - if failure := p.ops.Check(ctx, obj, "basePath"); failure != nil { - failures = append(failures, - resource.NewPropertyError("BasePathMapping", "basePath", failure)) - } - } - if !unks["stage"] { - if failure := p.ops.Check(ctx, obj, "stage"); failure != nil { - failures = append(failures, - resource.NewPropertyError("BasePathMapping", "stage", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *BasePathMappingProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(BasePathMappingToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[BasePathMapping_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *BasePathMappingProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(BasePathMappingToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *BasePathMappingProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(BasePathMappingToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *BasePathMappingProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(BasePathMappingToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *BasePathMappingProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(BasePathMappingToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *BasePathMappingProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(BasePathMappingToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *BasePathMappingProvider) Unmarshal( - v *pbstruct.Struct) (*BasePathMapping, resource.PropertyMap, error) { - var obj BasePathMapping - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable BasePathMapping structure(s) */ - -// BasePathMapping is a marshalable representation of its corresponding IDL type. -type BasePathMapping struct { - Name *string `lumi:"name,optional"` - DomainName string `lumi:"domainName"` - RestAPI resource.ID `lumi:"restAPI"` - BasePath *string `lumi:"basePath,optional"` - Stage *resource.ID `lumi:"stage,optional"` -} - -// BasePathMapping's properties have constants to make dealing with diffs and property bags easier. -const ( - BasePathMapping_Name = "name" - BasePathMapping_DomainName = "domainName" - BasePathMapping_RestAPI = "restAPI" - BasePathMapping_BasePath = "basePath" - BasePathMapping_Stage = "stage" -) - - diff --git a/lib/aws/rpc/apigateway/clientCertificate.go b/lib/aws/rpc/apigateway/clientCertificate.go deleted file mode 100644 index 57bafbfb4..000000000 --- a/lib/aws/rpc/apigateway/clientCertificate.go +++ /dev/null @@ -1,201 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for ClientCertificate resource provider */ - -// ClientCertificateToken is the type token corresponding to the ClientCertificate package type. -const ClientCertificateToken = tokens.Type("aws:apigateway/clientCertificate:ClientCertificate") - -// ClientCertificateProviderOps is a pluggable interface for ClientCertificate-related management functionality. -type ClientCertificateProviderOps interface { - Check(ctx context.Context, obj *ClientCertificate, property string) error - Create(ctx context.Context, obj *ClientCertificate) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*ClientCertificate, error) - InspectChange(ctx context.Context, - id resource.ID, old *ClientCertificate, new *ClientCertificate, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *ClientCertificate, new *ClientCertificate, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// ClientCertificateProvider is a dynamic gRPC-based plugin for managing ClientCertificate resources. -type ClientCertificateProvider struct { - ops ClientCertificateProviderOps -} - -// NewClientCertificateProvider allocates a resource provider that delegates to a ops instance. -func NewClientCertificateProvider(ops ClientCertificateProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &ClientCertificateProvider{ops: ops} -} - -func (p *ClientCertificateProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(ClientCertificateToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ClientCertificate", "name", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ClientCertificate", "description", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *ClientCertificateProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(ClientCertificateToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[ClientCertificate_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *ClientCertificateProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(ClientCertificateToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *ClientCertificateProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(ClientCertificateToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *ClientCertificateProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(ClientCertificateToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *ClientCertificateProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ClientCertificateToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ClientCertificateProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ClientCertificateToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ClientCertificateProvider) Unmarshal( - v *pbstruct.Struct) (*ClientCertificate, resource.PropertyMap, error) { - var obj ClientCertificate - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable ClientCertificate structure(s) */ - -// ClientCertificate is a marshalable representation of its corresponding IDL type. -type ClientCertificate struct { - Name *string `lumi:"name,optional"` - Description *string `lumi:"description,optional"` -} - -// ClientCertificate's properties have constants to make dealing with diffs and property bags easier. -const ( - ClientCertificate_Name = "name" - ClientCertificate_Description = "description" -) - - diff --git a/lib/aws/rpc/apigateway/deployment.go b/lib/aws/rpc/apigateway/deployment.go deleted file mode 100644 index d715bae9f..000000000 --- a/lib/aws/rpc/apigateway/deployment.go +++ /dev/null @@ -1,216 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Deployment resource provider */ - -// DeploymentToken is the type token corresponding to the Deployment package type. -const DeploymentToken = tokens.Type("aws:apigateway/deployment:Deployment") - -// DeploymentProviderOps is a pluggable interface for Deployment-related management functionality. -type DeploymentProviderOps interface { - Check(ctx context.Context, obj *Deployment, property string) error - Create(ctx context.Context, obj *Deployment) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Deployment, error) - InspectChange(ctx context.Context, - id resource.ID, old *Deployment, new *Deployment, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Deployment, new *Deployment, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// DeploymentProvider is a dynamic gRPC-based plugin for managing Deployment resources. -type DeploymentProvider struct { - ops DeploymentProviderOps -} - -// NewDeploymentProvider allocates a resource provider that delegates to a ops instance. -func NewDeploymentProvider(ops DeploymentProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &DeploymentProvider{ops: ops} -} - -func (p *DeploymentProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(DeploymentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Deployment", "name", failure)) - } - } - if !unks["restAPI"] { - if failure := p.ops.Check(ctx, obj, "restAPI"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Deployment", "restAPI", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Deployment", "description", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *DeploymentProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(DeploymentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Deployment_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *DeploymentProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(DeploymentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *DeploymentProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(DeploymentToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *DeploymentProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(DeploymentToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("restAPI") { - replaces = append(replaces, "restAPI") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *DeploymentProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(DeploymentToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *DeploymentProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(DeploymentToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *DeploymentProvider) Unmarshal( - v *pbstruct.Struct) (*Deployment, resource.PropertyMap, error) { - var obj Deployment - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Deployment structure(s) */ - -// Deployment is a marshalable representation of its corresponding IDL type. -type Deployment struct { - Name *string `lumi:"name,optional"` - RestAPI resource.ID `lumi:"restAPI"` - Description *string `lumi:"description,optional"` - ID string `lumi:"id,optional"` - CreatedDate string `lumi:"createdDate,optional"` -} - -// Deployment's properties have constants to make dealing with diffs and property bags easier. -const ( - Deployment_Name = "name" - Deployment_RestAPI = "restAPI" - Deployment_Description = "description" - Deployment_ID = "id" - Deployment_CreatedDate = "createdDate" -) - - diff --git a/lib/aws/rpc/apigateway/method.go b/lib/aws/rpc/apigateway/method.go deleted file mode 100644 index 47638899b..000000000 --- a/lib/aws/rpc/apigateway/method.go +++ /dev/null @@ -1,396 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* Marshalable Integration structure(s) */ - -// Integration is a marshalable representation of its corresponding IDL type. -type Integration struct { - Type IntegrationType `lumi:"type"` - CacheKeyParameters *[]string `lumi:"cacheKeyParameters,optional"` - CacheNamespace *string `lumi:"cacheNamespace,optional"` - Credentials *string `lumi:"credentials,optional"` - IntegrationHTTPMethod *string `lumi:"integrationHTTPMethod,optional"` - IntegrationResponse *[]IntegrationResponse `lumi:"integrationResponse,optional"` - PassthroughBehavior *PassthroughBehavior `lumi:"passthroughBehavior,optional"` - RequestParameters *map[string]string `lumi:"requestParameters,optional"` - RequestTemplates *map[string]string `lumi:"requestTemplates,optional"` - URI *string `lumi:"uri,optional"` -} - -// Integration's properties have constants to make dealing with diffs and property bags easier. -const ( - Integration_Type = "type" - Integration_CacheKeyParameters = "cacheKeyParameters" - Integration_CacheNamespace = "cacheNamespace" - Integration_Credentials = "credentials" - Integration_IntegrationHTTPMethod = "integrationHTTPMethod" - Integration_IntegrationResponse = "integrationResponse" - Integration_PassthroughBehavior = "passthroughBehavior" - Integration_RequestParameters = "requestParameters" - Integration_RequestTemplates = "requestTemplates" - Integration_URI = "uri" -) - -/* Marshalable IntegrationResponse structure(s) */ - -// IntegrationResponse is a marshalable representation of its corresponding IDL type. -type IntegrationResponse struct { - ResponseParameters *map[string]string `lumi:"responseParameters,optional"` - ResponseTemplates *map[string]string `lumi:"responseTemplates,optional"` - SelectionPattern *string `lumi:"selectionPattern,optional"` - StatusCode *string `lumi:"statusCode,optional"` -} - -// IntegrationResponse's properties have constants to make dealing with diffs and property bags easier. -const ( - IntegrationResponse_ResponseParameters = "responseParameters" - IntegrationResponse_ResponseTemplates = "responseTemplates" - IntegrationResponse_SelectionPattern = "selectionPattern" - IntegrationResponse_StatusCode = "statusCode" -) - -/* RPC stubs for Method resource provider */ - -// MethodToken is the type token corresponding to the Method package type. -const MethodToken = tokens.Type("aws:apigateway/method:Method") - -// MethodProviderOps is a pluggable interface for Method-related management functionality. -type MethodProviderOps interface { - Check(ctx context.Context, obj *Method, property string) error - Create(ctx context.Context, obj *Method) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Method, error) - InspectChange(ctx context.Context, - id resource.ID, old *Method, new *Method, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Method, new *Method, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// MethodProvider is a dynamic gRPC-based plugin for managing Method resources. -type MethodProvider struct { - ops MethodProviderOps -} - -// NewMethodProvider allocates a resource provider that delegates to a ops instance. -func NewMethodProvider(ops MethodProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &MethodProvider{ops: ops} -} - -func (p *MethodProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(MethodToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "name", failure)) - } - } - if !unks["httpMethod"] { - if failure := p.ops.Check(ctx, obj, "httpMethod"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "httpMethod", failure)) - } - } - if !unks["apiResource"] { - if failure := p.ops.Check(ctx, obj, "apiResource"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "apiResource", failure)) - } - } - if !unks["restAPI"] { - if failure := p.ops.Check(ctx, obj, "restAPI"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "restAPI", failure)) - } - } - if !unks["apiKeyRequired"] { - if failure := p.ops.Check(ctx, obj, "apiKeyRequired"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "apiKeyRequired", failure)) - } - } - if !unks["authorizationType"] { - if failure := p.ops.Check(ctx, obj, "authorizationType"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "authorizationType", failure)) - } - } - if !unks["authorizer"] { - if failure := p.ops.Check(ctx, obj, "authorizer"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "authorizer", failure)) - } - } - if !unks["integration"] { - if failure := p.ops.Check(ctx, obj, "integration"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "integration", failure)) - } - } - if !unks["methodResponses"] { - if failure := p.ops.Check(ctx, obj, "methodResponses"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "methodResponses", failure)) - } - } - if !unks["requestModels"] { - if failure := p.ops.Check(ctx, obj, "requestModels"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "requestModels", failure)) - } - } - if !unks["requestParameters"] { - if failure := p.ops.Check(ctx, obj, "requestParameters"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Method", "requestParameters", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *MethodProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(MethodToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Method_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *MethodProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(MethodToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *MethodProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(MethodToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *MethodProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(MethodToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *MethodProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(MethodToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *MethodProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(MethodToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *MethodProvider) Unmarshal( - v *pbstruct.Struct) (*Method, resource.PropertyMap, error) { - var obj Method - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Method structure(s) */ - -// Method is a marshalable representation of its corresponding IDL type. -type Method struct { - Name *string `lumi:"name,optional"` - HTTPMethod string `lumi:"httpMethod"` - APIResource resource.ID `lumi:"apiResource"` - RestAPI resource.ID `lumi:"restAPI"` - APIKeyRequired *bool `lumi:"apiKeyRequired,optional"` - AuthorizationType *AuthorizationType `lumi:"authorizationType,optional"` - Authorizer *resource.ID `lumi:"authorizer,optional"` - Integration *Integration `lumi:"integration,optional"` - MethodResponses *[]MethodResponse `lumi:"methodResponses,optional"` - RequestModels *map[string]resource.ID `lumi:"requestModels,optional"` - RequestParameters *map[string]bool `lumi:"requestParameters,optional"` -} - -// Method's properties have constants to make dealing with diffs and property bags easier. -const ( - Method_Name = "name" - Method_HTTPMethod = "httpMethod" - Method_APIResource = "apiResource" - Method_RestAPI = "restAPI" - Method_APIKeyRequired = "apiKeyRequired" - Method_AuthorizationType = "authorizationType" - Method_Authorizer = "authorizer" - Method_Integration = "integration" - Method_MethodResponses = "methodResponses" - Method_RequestModels = "requestModels" - Method_RequestParameters = "requestParameters" -) - -/* Marshalable MethodResponse structure(s) */ - -// MethodResponse is a marshalable representation of its corresponding IDL type. -type MethodResponse struct { - StatusCode string `lumi:"statusCode"` - ResponseModels *map[string]resource.ID `lumi:"responseModels,optional"` - ResponseParameters *map[string]bool `lumi:"responseParameters,optional"` -} - -// MethodResponse's properties have constants to make dealing with diffs and property bags easier. -const ( - MethodResponse_StatusCode = "statusCode" - MethodResponse_ResponseModels = "responseModels" - MethodResponse_ResponseParameters = "responseParameters" -) - -/* Marshalable MethodSetting structure(s) */ - -// MethodSetting is a marshalable representation of its corresponding IDL type. -type MethodSetting struct { - CacheDataEncrypted *bool `lumi:"cacheDataEncrypted,optional"` - CacheTTLInSeconds *float64 `lumi:"cacheTTLInSeconds,optional"` - CachingEnabled *bool `lumi:"cachingEnabled,optional"` - DataTraceEnabled *bool `lumi:"dataTraceEnabled,optional"` - HTTPMethod *string `lumi:"httpMethod,optional"` - LoggingLevel *LoggingLevel `lumi:"loggingLevel,optional"` - MetricsEnabled *bool `lumi:"metricsEnabled,optional"` - ResourcePath *string `lumi:"resourcePath,optional"` - ThrottlingBurstLimit *float64 `lumi:"throttlingBurstLimit,optional"` - ThrottlingRateLimit *float64 `lumi:"throttlingRateLimit,optional"` -} - -// MethodSetting's properties have constants to make dealing with diffs and property bags easier. -const ( - MethodSetting_CacheDataEncrypted = "cacheDataEncrypted" - MethodSetting_CacheTTLInSeconds = "cacheTTLInSeconds" - MethodSetting_CachingEnabled = "cachingEnabled" - MethodSetting_DataTraceEnabled = "dataTraceEnabled" - MethodSetting_HTTPMethod = "httpMethod" - MethodSetting_LoggingLevel = "loggingLevel" - MethodSetting_MetricsEnabled = "metricsEnabled" - MethodSetting_ResourcePath = "resourcePath" - MethodSetting_ThrottlingBurstLimit = "throttlingBurstLimit" - MethodSetting_ThrottlingRateLimit = "throttlingRateLimit" -) - -/* Typedefs */ - -type ( - AuthorizationType string - IntegrationType string - LoggingLevel string - PassthroughBehavior string -) - -/* Constants */ - -const ( - AWSIAMAuthorization AuthorizationType = "AWS_IAM" - AWSIntegration IntegrationType = "AWS" - AWSProxyIntegration IntegrationType = "AWS_PROXY" - CognitoAuthorization AuthorizationType = "COGNITO_USER_POOLS" - CustomAuthorization AuthorizationType = "CUSTOM" - HTTPIntegration IntegrationType = "HTTP" - HTTPProxyIntegration IntegrationType = "HTTP_PROXY" - LoggingErrorLevel LoggingLevel = "ERROR" - LoggingInfoLevel LoggingLevel = "INFO" - LoggingOff LoggingLevel = "OFF" - MockIntegration IntegrationType = "MOCK" - NoAuthorization AuthorizationType = "NONE" - PassthroughNever PassthroughBehavior = "NEVER" - PassthroughWhenNoMatch PassthroughBehavior = "WHEN_NO_MATCH" - PassthroughWhenNoTemplates PassthroughBehavior = "WHEN_NO_TEMPLATES" -) - - diff --git a/lib/aws/rpc/apigateway/model.go b/lib/aws/rpc/apigateway/model.go deleted file mode 100644 index 724db92ed..000000000 --- a/lib/aws/rpc/apigateway/model.go +++ /dev/null @@ -1,242 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Model resource provider */ - -// ModelToken is the type token corresponding to the Model package type. -const ModelToken = tokens.Type("aws:apigateway/model:Model") - -// ModelProviderOps is a pluggable interface for Model-related management functionality. -type ModelProviderOps interface { - Check(ctx context.Context, obj *Model, property string) error - Create(ctx context.Context, obj *Model) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Model, error) - InspectChange(ctx context.Context, - id resource.ID, old *Model, new *Model, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Model, new *Model, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// ModelProvider is a dynamic gRPC-based plugin for managing Model resources. -type ModelProvider struct { - ops ModelProviderOps -} - -// NewModelProvider allocates a resource provider that delegates to a ops instance. -func NewModelProvider(ops ModelProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &ModelProvider{ops: ops} -} - -func (p *ModelProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(ModelToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Model", "name", failure)) - } - } - if !unks["contentType"] { - if failure := p.ops.Check(ctx, obj, "contentType"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Model", "contentType", failure)) - } - } - if !unks["restAPI"] { - if failure := p.ops.Check(ctx, obj, "restAPI"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Model", "restAPI", failure)) - } - } - if !unks["schema"] { - if failure := p.ops.Check(ctx, obj, "schema"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Model", "schema", failure)) - } - } - if !unks["modelName"] { - if failure := p.ops.Check(ctx, obj, "modelName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Model", "modelName", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Model", "description", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *ModelProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(ModelToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Model_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *ModelProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(ModelToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *ModelProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(ModelToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *ModelProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(ModelToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("contentType") { - replaces = append(replaces, "contentType") - } - if diff.Changed("restAPI") { - replaces = append(replaces, "restAPI") - } - if diff.Changed("modelName") { - replaces = append(replaces, "modelName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *ModelProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ModelToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ModelProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ModelToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ModelProvider) Unmarshal( - v *pbstruct.Struct) (*Model, resource.PropertyMap, error) { - var obj Model - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Model structure(s) */ - -// Model is a marshalable representation of its corresponding IDL type. -type Model struct { - Name *string `lumi:"name,optional"` - ContentType string `lumi:"contentType"` - RestAPI resource.ID `lumi:"restAPI"` - Schema interface{} `lumi:"schema"` - ModelName *string `lumi:"modelName,optional"` - Description *string `lumi:"description,optional"` -} - -// Model's properties have constants to make dealing with diffs and property bags easier. -const ( - Model_Name = "name" - Model_ContentType = "contentType" - Model_RestAPI = "restAPI" - Model_Schema = "schema" - Model_ModelName = "modelName" - Model_Description = "description" -) - - diff --git a/lib/aws/rpc/apigateway/resource.go b/lib/aws/rpc/apigateway/resource.go deleted file mode 100644 index a745a197b..000000000 --- a/lib/aws/rpc/apigateway/resource.go +++ /dev/null @@ -1,226 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Resource resource provider */ - -// ResourceToken is the type token corresponding to the Resource package type. -const ResourceToken = tokens.Type("aws:apigateway/resource:Resource") - -// ResourceProviderOps is a pluggable interface for Resource-related management functionality. -type ResourceProviderOps interface { - Check(ctx context.Context, obj *Resource, property string) error - Create(ctx context.Context, obj *Resource) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Resource, error) - InspectChange(ctx context.Context, - id resource.ID, old *Resource, new *Resource, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Resource, new *Resource, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// ResourceProvider is a dynamic gRPC-based plugin for managing Resource resources. -type ResourceProvider struct { - ops ResourceProviderOps -} - -// NewResourceProvider allocates a resource provider that delegates to a ops instance. -func NewResourceProvider(ops ResourceProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &ResourceProvider{ops: ops} -} - -func (p *ResourceProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(ResourceToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Resource", "name", failure)) - } - } - if !unks["parent"] { - if failure := p.ops.Check(ctx, obj, "parent"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Resource", "parent", failure)) - } - } - if !unks["pathPart"] { - if failure := p.ops.Check(ctx, obj, "pathPart"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Resource", "pathPart", failure)) - } - } - if !unks["restAPI"] { - if failure := p.ops.Check(ctx, obj, "restAPI"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Resource", "restAPI", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *ResourceProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(ResourceToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Resource_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *ResourceProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(ResourceToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *ResourceProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(ResourceToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *ResourceProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(ResourceToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("parent") { - replaces = append(replaces, "parent") - } - if diff.Changed("pathPart") { - replaces = append(replaces, "pathPart") - } - if diff.Changed("restAPI") { - replaces = append(replaces, "restAPI") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *ResourceProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ResourceToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ResourceProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ResourceToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ResourceProvider) Unmarshal( - v *pbstruct.Struct) (*Resource, resource.PropertyMap, error) { - var obj Resource - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Resource structure(s) */ - -// Resource is a marshalable representation of its corresponding IDL type. -type Resource struct { - Name *string `lumi:"name,optional"` - Parent resource.ID `lumi:"parent"` - PathPart string `lumi:"pathPart"` - RestAPI resource.ID `lumi:"restAPI"` -} - -// Resource's properties have constants to make dealing with diffs and property bags easier. -const ( - Resource_Name = "name" - Resource_Parent = "parent" - Resource_PathPart = "pathPart" - Resource_RestAPI = "restAPI" -) - - diff --git a/lib/aws/rpc/apigateway/restAPI.go b/lib/aws/rpc/apigateway/restAPI.go deleted file mode 100644 index 011d65ee4..000000000 --- a/lib/aws/rpc/apigateway/restAPI.go +++ /dev/null @@ -1,275 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for RestAPI resource provider */ - -// RestAPIToken is the type token corresponding to the RestAPI package type. -const RestAPIToken = tokens.Type("aws:apigateway/restAPI:RestAPI") - -// RestAPIProviderOps is a pluggable interface for RestAPI-related management functionality. -type RestAPIProviderOps interface { - Check(ctx context.Context, obj *RestAPI, property string) error - Create(ctx context.Context, obj *RestAPI) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*RestAPI, error) - InspectChange(ctx context.Context, - id resource.ID, old *RestAPI, new *RestAPI, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *RestAPI, new *RestAPI, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// RestAPIProvider is a dynamic gRPC-based plugin for managing RestAPI resources. -type RestAPIProvider struct { - ops RestAPIProviderOps -} - -// NewRestAPIProvider allocates a resource provider that delegates to a ops instance. -func NewRestAPIProvider(ops RestAPIProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &RestAPIProvider{ops: ops} -} - -func (p *RestAPIProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(RestAPIToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RestAPI", "name", failure)) - } - } - if !unks["body"] { - if failure := p.ops.Check(ctx, obj, "body"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RestAPI", "body", failure)) - } - } - if !unks["bodyS3Location"] { - if failure := p.ops.Check(ctx, obj, "bodyS3Location"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RestAPI", "bodyS3Location", failure)) - } - } - if !unks["cloneFrom"] { - if failure := p.ops.Check(ctx, obj, "cloneFrom"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RestAPI", "cloneFrom", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RestAPI", "description", failure)) - } - } - if !unks["failOnWarnings"] { - if failure := p.ops.Check(ctx, obj, "failOnWarnings"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RestAPI", "failOnWarnings", failure)) - } - } - if !unks["apiName"] { - if failure := p.ops.Check(ctx, obj, "apiName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RestAPI", "apiName", failure)) - } - } - if !unks["parameters"] { - if failure := p.ops.Check(ctx, obj, "parameters"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RestAPI", "parameters", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *RestAPIProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(RestAPIToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[RestAPI_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *RestAPIProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(RestAPIToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *RestAPIProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(RestAPIToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *RestAPIProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(RestAPIToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *RestAPIProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(RestAPIToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *RestAPIProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(RestAPIToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *RestAPIProvider) Unmarshal( - v *pbstruct.Struct) (*RestAPI, resource.PropertyMap, error) { - var obj RestAPI - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable RestAPI structure(s) */ - -// RestAPI is a marshalable representation of its corresponding IDL type. -type RestAPI struct { - Name *string `lumi:"name,optional"` - Body *interface{} `lumi:"body,optional"` - BodyS3Location *S3Location `lumi:"bodyS3Location,optional"` - CloneFrom *resource.ID `lumi:"cloneFrom,optional"` - Description *string `lumi:"description,optional"` - FailOnWarnings *bool `lumi:"failOnWarnings,optional"` - APIName *string `lumi:"apiName,optional"` - Parameters *[]string `lumi:"parameters,optional"` - ID string `lumi:"id,optional"` - CreatedDate string `lumi:"createdDate,optional"` - Version string `lumi:"version,optional"` - Warnings []string `lumi:"warnings,optional"` - BinaryMediaTypes []string `lumi:"binaryMediaTypes,optional"` -} - -// RestAPI's properties have constants to make dealing with diffs and property bags easier. -const ( - RestAPI_Name = "name" - RestAPI_Body = "body" - RestAPI_BodyS3Location = "bodyS3Location" - RestAPI_CloneFrom = "cloneFrom" - RestAPI_Description = "description" - RestAPI_FailOnWarnings = "failOnWarnings" - RestAPI_APIName = "apiName" - RestAPI_Parameters = "parameters" - RestAPI_ID = "id" - RestAPI_CreatedDate = "createdDate" - RestAPI_Version = "version" - RestAPI_Warnings = "warnings" - RestAPI_BinaryMediaTypes = "binaryMediaTypes" -) - -/* Marshalable S3Location structure(s) */ - -// S3Location is a marshalable representation of its corresponding IDL type. -type S3Location struct { - Object resource.ID `lumi:"object"` - ETag *string `lumi:"etag,optional"` - Version *string `lumi:"version,optional"` -} - -// S3Location's properties have constants to make dealing with diffs and property bags easier. -const ( - S3Location_Object = "object" - S3Location_ETag = "etag" - S3Location_Version = "version" -) - - diff --git a/lib/aws/rpc/apigateway/stage.go b/lib/aws/rpc/apigateway/stage.go deleted file mode 100644 index 83507ba43..000000000 --- a/lib/aws/rpc/apigateway/stage.go +++ /dev/null @@ -1,279 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Stage resource provider */ - -// StageToken is the type token corresponding to the Stage package type. -const StageToken = tokens.Type("aws:apigateway/stage:Stage") - -// StageProviderOps is a pluggable interface for Stage-related management functionality. -type StageProviderOps interface { - Check(ctx context.Context, obj *Stage, property string) error - Create(ctx context.Context, obj *Stage) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Stage, error) - InspectChange(ctx context.Context, - id resource.ID, old *Stage, new *Stage, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Stage, new *Stage, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// StageProvider is a dynamic gRPC-based plugin for managing Stage resources. -type StageProvider struct { - ops StageProviderOps -} - -// NewStageProvider allocates a resource provider that delegates to a ops instance. -func NewStageProvider(ops StageProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &StageProvider{ops: ops} -} - -func (p *StageProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(StageToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "name", failure)) - } - } - if !unks["restAPI"] { - if failure := p.ops.Check(ctx, obj, "restAPI"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "restAPI", failure)) - } - } - if !unks["stageName"] { - if failure := p.ops.Check(ctx, obj, "stageName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "stageName", failure)) - } - } - if !unks["deployment"] { - if failure := p.ops.Check(ctx, obj, "deployment"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "deployment", failure)) - } - } - if !unks["cacheClusterEnabled"] { - if failure := p.ops.Check(ctx, obj, "cacheClusterEnabled"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "cacheClusterEnabled", failure)) - } - } - if !unks["cacheClusterSize"] { - if failure := p.ops.Check(ctx, obj, "cacheClusterSize"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "cacheClusterSize", failure)) - } - } - if !unks["clientCertificate"] { - if failure := p.ops.Check(ctx, obj, "clientCertificate"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "clientCertificate", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "description", failure)) - } - } - if !unks["methodSettings"] { - if failure := p.ops.Check(ctx, obj, "methodSettings"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "methodSettings", failure)) - } - } - if !unks["variables"] { - if failure := p.ops.Check(ctx, obj, "variables"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Stage", "variables", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *StageProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(StageToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Stage_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *StageProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(StageToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *StageProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(StageToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *StageProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(StageToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("restAPI") { - replaces = append(replaces, "restAPI") - } - if diff.Changed("stageName") { - replaces = append(replaces, "stageName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *StageProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(StageToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *StageProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(StageToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *StageProvider) Unmarshal( - v *pbstruct.Struct) (*Stage, resource.PropertyMap, error) { - var obj Stage - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Stage structure(s) */ - -// Stage is a marshalable representation of its corresponding IDL type. -type Stage struct { - Name *string `lumi:"name,optional"` - RestAPI resource.ID `lumi:"restAPI"` - StageName string `lumi:"stageName"` - Deployment resource.ID `lumi:"deployment"` - CacheClusterEnabled *bool `lumi:"cacheClusterEnabled,optional"` - CacheClusterSize *string `lumi:"cacheClusterSize,optional"` - ClientCertificate *resource.ID `lumi:"clientCertificate,optional"` - Description *string `lumi:"description,optional"` - MethodSettings *[]MethodSetting `lumi:"methodSettings,optional"` - Variables *map[string]string `lumi:"variables,optional"` - CreatedDate string `lumi:"createdDate,optional"` - LastUpdatedDate string `lumi:"lastUpdatedDate,optional"` - URL string `lumi:"url,optional"` - ExecutionARN string `lumi:"executionARN,optional"` -} - -// Stage's properties have constants to make dealing with diffs and property bags easier. -const ( - Stage_Name = "name" - Stage_RestAPI = "restAPI" - Stage_StageName = "stageName" - Stage_Deployment = "deployment" - Stage_CacheClusterEnabled = "cacheClusterEnabled" - Stage_CacheClusterSize = "cacheClusterSize" - Stage_ClientCertificate = "clientCertificate" - Stage_Description = "description" - Stage_MethodSettings = "methodSettings" - Stage_Variables = "variables" - Stage_CreatedDate = "createdDate" - Stage_LastUpdatedDate = "lastUpdatedDate" - Stage_URL = "url" - Stage_ExecutionARN = "executionARN" -) - - diff --git a/lib/aws/rpc/apigateway/usagePlan.go b/lib/aws/rpc/apigateway/usagePlan.go deleted file mode 100644 index 07bf5e5f9..000000000 --- a/lib/aws/rpc/apigateway/usagePlan.go +++ /dev/null @@ -1,291 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* Marshalable APIStage structure(s) */ - -// APIStage is a marshalable representation of its corresponding IDL type. -type APIStage struct { - API *resource.ID `lumi:"api,optional"` - Stage *resource.ID `lumi:"stage,optional"` -} - -// APIStage's properties have constants to make dealing with diffs and property bags easier. -const ( - APIStage_API = "api" - APIStage_Stage = "stage" -) - -/* Marshalable QuotaSettings structure(s) */ - -// QuotaSettings is a marshalable representation of its corresponding IDL type. -type QuotaSettings struct { - Limit *float64 `lumi:"limit,optional"` - Offset *float64 `lumi:"offset,optional"` - Period *QuotaPeriod `lumi:"period,optional"` -} - -// QuotaSettings's properties have constants to make dealing with diffs and property bags easier. -const ( - QuotaSettings_Limit = "limit" - QuotaSettings_Offset = "offset" - QuotaSettings_Period = "period" -) - -/* Marshalable ThrottleSettings structure(s) */ - -// ThrottleSettings is a marshalable representation of its corresponding IDL type. -type ThrottleSettings struct { - BurstRateLimit *float64 `lumi:"burstRateLimit,optional"` - RateLimit *float64 `lumi:"rateLimit,optional"` -} - -// ThrottleSettings's properties have constants to make dealing with diffs and property bags easier. -const ( - ThrottleSettings_BurstRateLimit = "burstRateLimit" - ThrottleSettings_RateLimit = "rateLimit" -) - -/* RPC stubs for UsagePlan resource provider */ - -// UsagePlanToken is the type token corresponding to the UsagePlan package type. -const UsagePlanToken = tokens.Type("aws:apigateway/usagePlan:UsagePlan") - -// UsagePlanProviderOps is a pluggable interface for UsagePlan-related management functionality. -type UsagePlanProviderOps interface { - Check(ctx context.Context, obj *UsagePlan, property string) error - Create(ctx context.Context, obj *UsagePlan) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*UsagePlan, error) - InspectChange(ctx context.Context, - id resource.ID, old *UsagePlan, new *UsagePlan, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *UsagePlan, new *UsagePlan, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// UsagePlanProvider is a dynamic gRPC-based plugin for managing UsagePlan resources. -type UsagePlanProvider struct { - ops UsagePlanProviderOps -} - -// NewUsagePlanProvider allocates a resource provider that delegates to a ops instance. -func NewUsagePlanProvider(ops UsagePlanProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &UsagePlanProvider{ops: ops} -} - -func (p *UsagePlanProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlan", "name", failure)) - } - } - if !unks["apiStages"] { - if failure := p.ops.Check(ctx, obj, "apiStages"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlan", "apiStages", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlan", "description", failure)) - } - } - if !unks["quota"] { - if failure := p.ops.Check(ctx, obj, "quota"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlan", "quota", failure)) - } - } - if !unks["throttle"] { - if failure := p.ops.Check(ctx, obj, "throttle"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlan", "throttle", failure)) - } - } - if !unks["usagePlanName"] { - if failure := p.ops.Check(ctx, obj, "usagePlanName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlan", "usagePlanName", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *UsagePlanProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[UsagePlan_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *UsagePlanProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *UsagePlanProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *UsagePlanProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *UsagePlanProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(UsagePlanToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *UsagePlanProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(UsagePlanToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *UsagePlanProvider) Unmarshal( - v *pbstruct.Struct) (*UsagePlan, resource.PropertyMap, error) { - var obj UsagePlan - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable UsagePlan structure(s) */ - -// UsagePlan is a marshalable representation of its corresponding IDL type. -type UsagePlan struct { - Name *string `lumi:"name,optional"` - APIStages *[]APIStage `lumi:"apiStages,optional"` - Description *string `lumi:"description,optional"` - Quota *QuotaSettings `lumi:"quota,optional"` - Throttle *ThrottleSettings `lumi:"throttle,optional"` - UsagePlanName *string `lumi:"usagePlanName,optional"` -} - -// UsagePlan's properties have constants to make dealing with diffs and property bags easier. -const ( - UsagePlan_Name = "name" - UsagePlan_APIStages = "apiStages" - UsagePlan_Description = "description" - UsagePlan_Quota = "quota" - UsagePlan_Throttle = "throttle" - UsagePlan_UsagePlanName = "usagePlanName" -) - -/* Typedefs */ - -type ( - QuotaPeriod string -) - -/* Constants */ - -const ( - QuotaDayPeriod QuotaPeriod = "DAY" - QuotaMonthPeriod QuotaPeriod = "MONTH" - QuotaWeekPeriod QuotaPeriod = "WEEK" -) - - diff --git a/lib/aws/rpc/apigateway/usagePlanKey.go b/lib/aws/rpc/apigateway/usagePlanKey.go deleted file mode 100644 index 3b7063218..000000000 --- a/lib/aws/rpc/apigateway/usagePlanKey.go +++ /dev/null @@ -1,215 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package apigateway - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for UsagePlanKey resource provider */ - -// UsagePlanKeyToken is the type token corresponding to the UsagePlanKey package type. -const UsagePlanKeyToken = tokens.Type("aws:apigateway/usagePlanKey:UsagePlanKey") - -// UsagePlanKeyProviderOps is a pluggable interface for UsagePlanKey-related management functionality. -type UsagePlanKeyProviderOps interface { - Check(ctx context.Context, obj *UsagePlanKey, property string) error - Create(ctx context.Context, obj *UsagePlanKey) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*UsagePlanKey, error) - InspectChange(ctx context.Context, - id resource.ID, old *UsagePlanKey, new *UsagePlanKey, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *UsagePlanKey, new *UsagePlanKey, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// UsagePlanKeyProvider is a dynamic gRPC-based plugin for managing UsagePlanKey resources. -type UsagePlanKeyProvider struct { - ops UsagePlanKeyProviderOps -} - -// NewUsagePlanKeyProvider allocates a resource provider that delegates to a ops instance. -func NewUsagePlanKeyProvider(ops UsagePlanKeyProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &UsagePlanKeyProvider{ops: ops} -} - -func (p *UsagePlanKeyProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanKeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlanKey", "name", failure)) - } - } - if !unks["key"] { - if failure := p.ops.Check(ctx, obj, "key"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlanKey", "key", failure)) - } - } - if !unks["usagePlan"] { - if failure := p.ops.Check(ctx, obj, "usagePlan"); failure != nil { - failures = append(failures, - resource.NewPropertyError("UsagePlanKey", "usagePlan", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *UsagePlanKeyProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanKeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[UsagePlanKey_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *UsagePlanKeyProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanKeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *UsagePlanKeyProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanKeyToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *UsagePlanKeyProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(UsagePlanKeyToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("key") { - replaces = append(replaces, "key") - } - if diff.Changed("usagePlan") { - replaces = append(replaces, "usagePlan") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *UsagePlanKeyProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(UsagePlanKeyToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *UsagePlanKeyProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(UsagePlanKeyToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *UsagePlanKeyProvider) Unmarshal( - v *pbstruct.Struct) (*UsagePlanKey, resource.PropertyMap, error) { - var obj UsagePlanKey - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable UsagePlanKey structure(s) */ - -// UsagePlanKey is a marshalable representation of its corresponding IDL type. -type UsagePlanKey struct { - Name *string `lumi:"name,optional"` - Key resource.ID `lumi:"key"` - UsagePlan resource.ID `lumi:"usagePlan"` -} - -// UsagePlanKey's properties have constants to make dealing with diffs and property bags easier. -const ( - UsagePlanKey_Name = "name" - UsagePlanKey_Key = "key" - UsagePlanKey_UsagePlan = "usagePlan" -) - - diff --git a/lib/aws/rpc/cloudwatch/alarm.go b/lib/aws/rpc/cloudwatch/alarm.go deleted file mode 100644 index 6d86ac006..000000000 --- a/lib/aws/rpc/cloudwatch/alarm.go +++ /dev/null @@ -1,570 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package cloudwatch - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for ActionTarget resource provider */ - -// ActionTargetToken is the type token corresponding to the ActionTarget package type. -const ActionTargetToken = tokens.Type("aws:cloudwatch/alarm:ActionTarget") - -// ActionTargetProviderOps is a pluggable interface for ActionTarget-related management functionality. -type ActionTargetProviderOps interface { - Check(ctx context.Context, obj *ActionTarget, property string) error - Create(ctx context.Context, obj *ActionTarget) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*ActionTarget, error) - InspectChange(ctx context.Context, - id resource.ID, old *ActionTarget, new *ActionTarget, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *ActionTarget, new *ActionTarget, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// ActionTargetProvider is a dynamic gRPC-based plugin for managing ActionTarget resources. -type ActionTargetProvider struct { - ops ActionTargetProviderOps -} - -// NewActionTargetProvider allocates a resource provider that delegates to a ops instance. -func NewActionTargetProvider(ops ActionTargetProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &ActionTargetProvider{ops: ops} -} - -func (p *ActionTargetProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(ActionTargetToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ActionTarget", "name", failure)) - } - } - if !unks["topicName"] { - if failure := p.ops.Check(ctx, obj, "topicName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ActionTarget", "topicName", failure)) - } - } - if !unks["displayName"] { - if failure := p.ops.Check(ctx, obj, "displayName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ActionTarget", "displayName", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *ActionTargetProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(ActionTargetToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[ActionTarget_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *ActionTargetProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(ActionTargetToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *ActionTargetProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(ActionTargetToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *ActionTargetProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(ActionTargetToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("topicName") { - replaces = append(replaces, "topicName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *ActionTargetProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ActionTargetToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ActionTargetProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ActionTargetToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ActionTargetProvider) Unmarshal( - v *pbstruct.Struct) (*ActionTarget, resource.PropertyMap, error) { - var obj ActionTarget - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable ActionTarget structure(s) */ - -// ActionTarget is a marshalable representation of its corresponding IDL type. -type ActionTarget struct { - Name *string `lumi:"name,optional"` - TopicName *string `lumi:"topicName,optional"` - DisplayName *string `lumi:"displayName,optional"` -} - -// ActionTarget's properties have constants to make dealing with diffs and property bags easier. -const ( - ActionTarget_Name = "name" - ActionTarget_TopicName = "topicName" - ActionTarget_DisplayName = "displayName" -) - -/* RPC stubs for Alarm resource provider */ - -// AlarmToken is the type token corresponding to the Alarm package type. -const AlarmToken = tokens.Type("aws:cloudwatch/alarm:Alarm") - -// AlarmProviderOps is a pluggable interface for Alarm-related management functionality. -type AlarmProviderOps interface { - Check(ctx context.Context, obj *Alarm, property string) error - Create(ctx context.Context, obj *Alarm) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Alarm, error) - InspectChange(ctx context.Context, - id resource.ID, old *Alarm, new *Alarm, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Alarm, new *Alarm, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// AlarmProvider is a dynamic gRPC-based plugin for managing Alarm resources. -type AlarmProvider struct { - ops AlarmProviderOps -} - -// NewAlarmProvider allocates a resource provider that delegates to a ops instance. -func NewAlarmProvider(ops AlarmProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &AlarmProvider{ops: ops} -} - -func (p *AlarmProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(AlarmToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "name", failure)) - } - } - if !unks["comparisonOperator"] { - if failure := p.ops.Check(ctx, obj, "comparisonOperator"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "comparisonOperator", failure)) - } - } - if !unks["evaluationPerids"] { - if failure := p.ops.Check(ctx, obj, "evaluationPerids"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "evaluationPerids", failure)) - } - } - if !unks["metricName"] { - if failure := p.ops.Check(ctx, obj, "metricName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "metricName", failure)) - } - } - if !unks["namespace"] { - if failure := p.ops.Check(ctx, obj, "namespace"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "namespace", failure)) - } - } - if !unks["period"] { - if failure := p.ops.Check(ctx, obj, "period"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "period", failure)) - } - } - if !unks["statistic"] { - if failure := p.ops.Check(ctx, obj, "statistic"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "statistic", failure)) - } - } - if !unks["threshold"] { - if failure := p.ops.Check(ctx, obj, "threshold"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "threshold", failure)) - } - } - if !unks["actionsEnabled"] { - if failure := p.ops.Check(ctx, obj, "actionsEnabled"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "actionsEnabled", failure)) - } - } - if !unks["alarmActions"] { - if failure := p.ops.Check(ctx, obj, "alarmActions"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "alarmActions", failure)) - } - } - if !unks["alarmDescription"] { - if failure := p.ops.Check(ctx, obj, "alarmDescription"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "alarmDescription", failure)) - } - } - if !unks["alarmName"] { - if failure := p.ops.Check(ctx, obj, "alarmName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "alarmName", failure)) - } - } - if !unks["dimensions"] { - if failure := p.ops.Check(ctx, obj, "dimensions"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "dimensions", failure)) - } - } - if !unks["insufficientDataActions"] { - if failure := p.ops.Check(ctx, obj, "insufficientDataActions"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "insufficientDataActions", failure)) - } - } - if !unks["okActions"] { - if failure := p.ops.Check(ctx, obj, "okActions"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "okActions", failure)) - } - } - if !unks["unit"] { - if failure := p.ops.Check(ctx, obj, "unit"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Alarm", "unit", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *AlarmProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(AlarmToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Alarm_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *AlarmProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(AlarmToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *AlarmProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(AlarmToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *AlarmProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(AlarmToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("alarmName") { - replaces = append(replaces, "alarmName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *AlarmProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(AlarmToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *AlarmProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(AlarmToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *AlarmProvider) Unmarshal( - v *pbstruct.Struct) (*Alarm, resource.PropertyMap, error) { - var obj Alarm - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Alarm structure(s) */ - -// Alarm is a marshalable representation of its corresponding IDL type. -type Alarm struct { - Name *string `lumi:"name,optional"` - ComparisonOperator AlarmComparisonOperator `lumi:"comparisonOperator"` - EvaluationPeriods float64 `lumi:"evaluationPerids"` - MetricName string `lumi:"metricName"` - Namespace string `lumi:"namespace"` - Period float64 `lumi:"period"` - Statistic AlarmStatistic `lumi:"statistic"` - Threshold float64 `lumi:"threshold"` - ActionsEnabled *bool `lumi:"actionsEnabled,optional"` - AlarmActions *[]resource.ID `lumi:"alarmActions,optional"` - AlarmDescription *string `lumi:"alarmDescription,optional"` - AlarmName *string `lumi:"alarmName,optional"` - Dimensions *[]AlarmDimension `lumi:"dimensions,optional"` - InsufficientDataActions *[]resource.ID `lumi:"insufficientDataActions,optional"` - OKActions *[]resource.ID `lumi:"okActions,optional"` - Unit *AlarmMetric `lumi:"unit,optional"` -} - -// Alarm's properties have constants to make dealing with diffs and property bags easier. -const ( - Alarm_Name = "name" - Alarm_ComparisonOperator = "comparisonOperator" - Alarm_EvaluationPeriods = "evaluationPerids" - Alarm_MetricName = "metricName" - Alarm_Namespace = "namespace" - Alarm_Period = "period" - Alarm_Statistic = "statistic" - Alarm_Threshold = "threshold" - Alarm_ActionsEnabled = "actionsEnabled" - Alarm_AlarmActions = "alarmActions" - Alarm_AlarmDescription = "alarmDescription" - Alarm_AlarmName = "alarmName" - Alarm_Dimensions = "dimensions" - Alarm_InsufficientDataActions = "insufficientDataActions" - Alarm_OKActions = "okActions" - Alarm_Unit = "unit" -) - -/* Marshalable AlarmDimension structure(s) */ - -// AlarmDimension is a marshalable representation of its corresponding IDL type. -type AlarmDimension struct { - Name string `lumi:"name"` - Value interface{} `lumi:"value"` -} - -// AlarmDimension's properties have constants to make dealing with diffs and property bags easier. -const ( - AlarmDimension_Name = "name" - AlarmDimension_Value = "value" -) - -/* Typedefs */ - -type ( - AlarmComparisonOperator string - AlarmMetric string - AlarmStatistic string -) - -/* Constants */ - -const ( - AverageStatistic AlarmStatistic = "Average" - BitsMetric AlarmMetric = "Bits" - BitsPerSecondMetric AlarmMetric = "Bits/Second" - BytesMetric AlarmMetric = "Bytes" - BytesPerSecondMetric AlarmMetric = "Bytes/Second" - CountMetric AlarmMetric = "Count" - CountPerSecondMetric AlarmMetric = "Count/Second" - GigabitsMetric AlarmMetric = "Gigabits" - GigabitsPerSecondMetric AlarmMetric = "Gigabits/Second" - GigabytesMetric AlarmMetric = "Gigabytes" - GigabytesPerSecondMetric AlarmMetric = "Gigabytes/Second" - KilobitsMetric AlarmMetric = "Kilobits" - KilobitsPerSecondMetric AlarmMetric = "Kilobits/Second" - KilobytesMetric AlarmMetric = "Kilobytes" - KilobytesPerSecondMetric AlarmMetric = "Kilobytes/Second" - MaximumStatistic AlarmStatistic = "Maximum" - MegabitsMetric AlarmMetric = "Megabits" - MegabitsPerSecondMetric AlarmMetric = "Megabits/Second" - MegabytesMetric AlarmMetric = "Megabytes" - MegabytesPerSecondMetric AlarmMetric = "Megabytes/Second" - MicrosecondsMetric AlarmMetric = "Microseconds" - MillisecondsMetric AlarmMetric = "Milliseconds" - MinimumStatistic AlarmStatistic = "Minimum" - NoMetric AlarmMetric = "None" - PercentMetric AlarmMetric = "Percent" - SampleCountStatistic AlarmStatistic = "SampleCount" - SecondsMetric AlarmMetric = "Seconds" - SumStatistic AlarmStatistic = "Sum" - TerabitsMetric AlarmMetric = "Terabits" - TerabitsPerSecondMetric AlarmMetric = "Terabits/Second" - TerabytesMetric AlarmMetric = "Terabytes" - TerabytesPerSecondMetric AlarmMetric = "Terabytes/Second" - ThresholdGreaterThan AlarmComparisonOperator = "GreaterThanThreshold" - ThresholdGreaterThanOrEqualTo AlarmComparisonOperator = "GreaterThanOrEqualToThreshold" - ThresholdLessThan AlarmComparisonOperator = "LessThanThreshold" - ThresholdLessThanOrEqualTo AlarmComparisonOperator = "LessThanOrEqualToThreshold" -) - - diff --git a/lib/aws/rpc/cloudwatch/logGroup.go b/lib/aws/rpc/cloudwatch/logGroup.go deleted file mode 100644 index 497539780..000000000 --- a/lib/aws/rpc/cloudwatch/logGroup.go +++ /dev/null @@ -1,212 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package cloudwatch - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for LogGroup resource provider */ - -// LogGroupToken is the type token corresponding to the LogGroup package type. -const LogGroupToken = tokens.Type("aws:cloudwatch/logGroup:LogGroup") - -// LogGroupProviderOps is a pluggable interface for LogGroup-related management functionality. -type LogGroupProviderOps interface { - Check(ctx context.Context, obj *LogGroup, property string) error - Create(ctx context.Context, obj *LogGroup) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*LogGroup, error) - InspectChange(ctx context.Context, - id resource.ID, old *LogGroup, new *LogGroup, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *LogGroup, new *LogGroup, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// LogGroupProvider is a dynamic gRPC-based plugin for managing LogGroup resources. -type LogGroupProvider struct { - ops LogGroupProviderOps -} - -// NewLogGroupProvider allocates a resource provider that delegates to a ops instance. -func NewLogGroupProvider(ops LogGroupProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &LogGroupProvider{ops: ops} -} - -func (p *LogGroupProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(LogGroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogGroup", "name", failure)) - } - } - if !unks["logGroupName"] { - if failure := p.ops.Check(ctx, obj, "logGroupName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogGroup", "logGroupName", failure)) - } - } - if !unks["retentionInDays"] { - if failure := p.ops.Check(ctx, obj, "retentionInDays"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogGroup", "retentionInDays", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *LogGroupProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(LogGroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[LogGroup_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *LogGroupProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(LogGroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *LogGroupProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(LogGroupToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *LogGroupProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(LogGroupToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("logGroupName") { - replaces = append(replaces, "logGroupName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *LogGroupProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(LogGroupToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *LogGroupProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(LogGroupToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *LogGroupProvider) Unmarshal( - v *pbstruct.Struct) (*LogGroup, resource.PropertyMap, error) { - var obj LogGroup - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable LogGroup structure(s) */ - -// LogGroup is a marshalable representation of its corresponding IDL type. -type LogGroup struct { - Name *string `lumi:"name,optional"` - LogGroupName *string `lumi:"logGroupName,optional"` - RetentionInDays *float64 `lumi:"retentionInDays,optional"` -} - -// LogGroup's properties have constants to make dealing with diffs and property bags easier. -const ( - LogGroup_Name = "name" - LogGroup_LogGroupName = "logGroupName" - LogGroup_RetentionInDays = "retentionInDays" -) - - diff --git a/lib/aws/rpc/cloudwatch/logSubscriptionFilter.go b/lib/aws/rpc/cloudwatch/logSubscriptionFilter.go deleted file mode 100644 index ee260e489..000000000 --- a/lib/aws/rpc/cloudwatch/logSubscriptionFilter.go +++ /dev/null @@ -1,256 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package cloudwatch - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - - __aws "github.com/pulumi/lumi/lib/aws/rpc" -) - -/* RPC stubs for LogSubscriptionFilter resource provider */ - -// LogSubscriptionFilterToken is the type token corresponding to the LogSubscriptionFilter package type. -const LogSubscriptionFilterToken = tokens.Type("aws:cloudwatch/logSubscriptionFilter:LogSubscriptionFilter") - -// LogSubscriptionFilterProviderOps is a pluggable interface for LogSubscriptionFilter-related management functionality. -type LogSubscriptionFilterProviderOps interface { - Check(ctx context.Context, obj *LogSubscriptionFilter, property string) error - Create(ctx context.Context, obj *LogSubscriptionFilter) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*LogSubscriptionFilter, error) - InspectChange(ctx context.Context, - id resource.ID, old *LogSubscriptionFilter, new *LogSubscriptionFilter, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *LogSubscriptionFilter, new *LogSubscriptionFilter, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// LogSubscriptionFilterProvider is a dynamic gRPC-based plugin for managing LogSubscriptionFilter resources. -type LogSubscriptionFilterProvider struct { - ops LogSubscriptionFilterProviderOps -} - -// NewLogSubscriptionFilterProvider allocates a resource provider that delegates to a ops instance. -func NewLogSubscriptionFilterProvider(ops LogSubscriptionFilterProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &LogSubscriptionFilterProvider{ops: ops} -} - -func (p *LogSubscriptionFilterProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(LogSubscriptionFilterToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogSubscriptionFilter", "name", failure)) - } - } - if !unks["logGroupName"] { - if failure := p.ops.Check(ctx, obj, "logGroupName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogSubscriptionFilter", "logGroupName", failure)) - } - } - if !unks["filterPattern"] { - if failure := p.ops.Check(ctx, obj, "filterPattern"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogSubscriptionFilter", "filterPattern", failure)) - } - } - if !unks["destinationArn"] { - if failure := p.ops.Check(ctx, obj, "destinationArn"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogSubscriptionFilter", "destinationArn", failure)) - } - } - if !unks["roleArn"] { - if failure := p.ops.Check(ctx, obj, "roleArn"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogSubscriptionFilter", "roleArn", failure)) - } - } - if !unks["distribution"] { - if failure := p.ops.Check(ctx, obj, "distribution"); failure != nil { - failures = append(failures, - resource.NewPropertyError("LogSubscriptionFilter", "distribution", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *LogSubscriptionFilterProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(LogSubscriptionFilterToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[LogSubscriptionFilter_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *LogSubscriptionFilterProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(LogSubscriptionFilterToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *LogSubscriptionFilterProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(LogSubscriptionFilterToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *LogSubscriptionFilterProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(LogSubscriptionFilterToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("logGroupName") { - replaces = append(replaces, "logGroupName") - } - if diff.Changed("destinationArn") { - replaces = append(replaces, "destinationArn") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *LogSubscriptionFilterProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(LogSubscriptionFilterToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *LogSubscriptionFilterProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(LogSubscriptionFilterToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *LogSubscriptionFilterProvider) Unmarshal( - v *pbstruct.Struct) (*LogSubscriptionFilter, resource.PropertyMap, error) { - var obj LogSubscriptionFilter - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable LogSubscriptionFilter structure(s) */ - -// LogSubscriptionFilter is a marshalable representation of its corresponding IDL type. -type LogSubscriptionFilter struct { - Name *string `lumi:"name,optional"` - LogGroupName string `lumi:"logGroupName"` - FilterPattern string `lumi:"filterPattern"` - DestinationArn string `lumi:"destinationArn"` - RoleARN *__aws.ARN `lumi:"roleArn,optional"` - Distribution *LogSubscriptionDistribution `lumi:"distribution,optional"` - CreationTime *float64 `lumi:"creationTime,optional"` -} - -// LogSubscriptionFilter's properties have constants to make dealing with diffs and property bags easier. -const ( - LogSubscriptionFilter_Name = "name" - LogSubscriptionFilter_LogGroupName = "logGroupName" - LogSubscriptionFilter_FilterPattern = "filterPattern" - LogSubscriptionFilter_DestinationArn = "destinationArn" - LogSubscriptionFilter_RoleARN = "roleArn" - LogSubscriptionFilter_Distribution = "distribution" - LogSubscriptionFilter_CreationTime = "creationTime" -) - -/* Typedefs */ - -type ( - LogSubscriptionDistribution string -) - -/* Constants */ - -const ( - ByLogStreamDistribution LogSubscriptionDistribution = "ByLogStream" - RandomDistribution LogSubscriptionDistribution = "Random" -) - - diff --git a/lib/aws/rpc/dynamodb/table.go b/lib/aws/rpc/dynamodb/table.go deleted file mode 100644 index b8497b000..000000000 --- a/lib/aws/rpc/dynamodb/table.go +++ /dev/null @@ -1,314 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package dynamodb - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* Marshalable Attribute structure(s) */ - -// Attribute is a marshalable representation of its corresponding IDL type. -type Attribute struct { - Name string `lumi:"name"` - Type AttributeType `lumi:"type"` -} - -// Attribute's properties have constants to make dealing with diffs and property bags easier. -const ( - Attribute_Name = "name" - Attribute_Type = "type" -) - -/* Marshalable GlobalSecondaryIndex structure(s) */ - -// GlobalSecondaryIndex is a marshalable representation of its corresponding IDL type. -type GlobalSecondaryIndex struct { - IndexName string `lumi:"indexName"` - HashKey string `lumi:"hashKey"` - RangeKey *string `lumi:"rangeKey,optional"` - ReadCapacity float64 `lumi:"readCapacity"` - WriteCapacity float64 `lumi:"writeCapacity"` - NonKeyAttributes []string `lumi:"nonKeyAttributes"` - ProjectionType ProjectionType `lumi:"projectionType"` -} - -// GlobalSecondaryIndex's properties have constants to make dealing with diffs and property bags easier. -const ( - GlobalSecondaryIndex_IndexName = "indexName" - GlobalSecondaryIndex_HashKey = "hashKey" - GlobalSecondaryIndex_RangeKey = "rangeKey" - GlobalSecondaryIndex_ReadCapacity = "readCapacity" - GlobalSecondaryIndex_WriteCapacity = "writeCapacity" - GlobalSecondaryIndex_NonKeyAttributes = "nonKeyAttributes" - GlobalSecondaryIndex_ProjectionType = "projectionType" -) - -/* RPC stubs for Table resource provider */ - -// TableToken is the type token corresponding to the Table package type. -const TableToken = tokens.Type("aws:dynamodb/table:Table") - -// TableProviderOps is a pluggable interface for Table-related management functionality. -type TableProviderOps interface { - Check(ctx context.Context, obj *Table, property string) error - Create(ctx context.Context, obj *Table) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Table, error) - InspectChange(ctx context.Context, - id resource.ID, old *Table, new *Table, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Table, new *Table, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// TableProvider is a dynamic gRPC-based plugin for managing Table resources. -type TableProvider struct { - ops TableProviderOps -} - -// NewTableProvider allocates a resource provider that delegates to a ops instance. -func NewTableProvider(ops TableProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &TableProvider{ops: ops} -} - -func (p *TableProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(TableToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Table", "name", failure)) - } - } - if !unks["hashKey"] { - if failure := p.ops.Check(ctx, obj, "hashKey"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Table", "hashKey", failure)) - } - } - if !unks["attributes"] { - if failure := p.ops.Check(ctx, obj, "attributes"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Table", "attributes", failure)) - } - } - if !unks["readCapacity"] { - if failure := p.ops.Check(ctx, obj, "readCapacity"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Table", "readCapacity", failure)) - } - } - if !unks["writeCapacity"] { - if failure := p.ops.Check(ctx, obj, "writeCapacity"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Table", "writeCapacity", failure)) - } - } - if !unks["rangeKey"] { - if failure := p.ops.Check(ctx, obj, "rangeKey"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Table", "rangeKey", failure)) - } - } - if !unks["tableName"] { - if failure := p.ops.Check(ctx, obj, "tableName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Table", "tableName", failure)) - } - } - if !unks["globalSecondaryIndexes"] { - if failure := p.ops.Check(ctx, obj, "globalSecondaryIndexes"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Table", "globalSecondaryIndexes", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *TableProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(TableToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Table_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *TableProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(TableToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *TableProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(TableToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *TableProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(TableToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("hashKey") { - replaces = append(replaces, "hashKey") - } - if diff.Changed("rangeKey") { - replaces = append(replaces, "rangeKey") - } - if diff.Changed("tableName") { - replaces = append(replaces, "tableName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *TableProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(TableToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *TableProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(TableToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *TableProvider) Unmarshal( - v *pbstruct.Struct) (*Table, resource.PropertyMap, error) { - var obj Table - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Table structure(s) */ - -// Table is a marshalable representation of its corresponding IDL type. -type Table struct { - Name *string `lumi:"name,optional"` - HashKey string `lumi:"hashKey"` - Attributes []Attribute `lumi:"attributes"` - ReadCapacity float64 `lumi:"readCapacity"` - WriteCapacity float64 `lumi:"writeCapacity"` - RangeKey *string `lumi:"rangeKey,optional"` - TableName *string `lumi:"tableName,optional"` - GlobalSecondaryIndexes *[]GlobalSecondaryIndex `lumi:"globalSecondaryIndexes,optional"` -} - -// Table's properties have constants to make dealing with diffs and property bags easier. -const ( - Table_Name = "name" - Table_HashKey = "hashKey" - Table_Attributes = "attributes" - Table_ReadCapacity = "readCapacity" - Table_WriteCapacity = "writeCapacity" - Table_RangeKey = "rangeKey" - Table_TableName = "tableName" - Table_GlobalSecondaryIndexes = "globalSecondaryIndexes" -) - -/* Typedefs */ - -type ( - AttributeType string - ProjectionType string -) - -/* Constants */ - -const ( - AllProjection ProjectionType = "ALL" - BinaryAttribute AttributeType = "B" - IncludeProjection ProjectionType = "INCLUDE" - KeysOnlyProjection ProjectionType = "KEYS_ONLY" - NumberAttribute AttributeType = "N" - StringAttribute AttributeType = "S" -) - - diff --git a/lib/aws/rpc/ec2/instance.go b/lib/aws/rpc/ec2/instance.go deleted file mode 100644 index d95cb3442..000000000 --- a/lib/aws/rpc/ec2/instance.go +++ /dev/null @@ -1,337 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Instance resource provider */ - -// InstanceToken is the type token corresponding to the Instance package type. -const InstanceToken = tokens.Type("aws:ec2/instance:Instance") - -// InstanceProviderOps is a pluggable interface for Instance-related management functionality. -type InstanceProviderOps interface { - Check(ctx context.Context, obj *Instance, property string) error - Create(ctx context.Context, obj *Instance) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Instance, error) - InspectChange(ctx context.Context, - id resource.ID, old *Instance, new *Instance, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Instance, new *Instance, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// InstanceProvider is a dynamic gRPC-based plugin for managing Instance resources. -type InstanceProvider struct { - ops InstanceProviderOps -} - -// NewInstanceProvider allocates a resource provider that delegates to a ops instance. -func NewInstanceProvider(ops InstanceProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &InstanceProvider{ops: ops} -} - -func (p *InstanceProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(InstanceToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Instance", "name", failure)) - } - } - if !unks["imageId"] { - if failure := p.ops.Check(ctx, obj, "imageId"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Instance", "imageId", failure)) - } - } - if !unks["instanceType"] { - if failure := p.ops.Check(ctx, obj, "instanceType"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Instance", "instanceType", failure)) - } - } - if !unks["securityGroups"] { - if failure := p.ops.Check(ctx, obj, "securityGroups"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Instance", "securityGroups", failure)) - } - } - if !unks["keyName"] { - if failure := p.ops.Check(ctx, obj, "keyName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Instance", "keyName", failure)) - } - } - if !unks["tags"] { - if failure := p.ops.Check(ctx, obj, "tags"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Instance", "tags", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *InstanceProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(InstanceToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Instance_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *InstanceProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(InstanceToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *InstanceProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(InstanceToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *InstanceProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(InstanceToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("imageId") { - replaces = append(replaces, "imageId") - } - if diff.Changed("instanceType") { - replaces = append(replaces, "instanceType") - } - if diff.Changed("securityGroups") { - replaces = append(replaces, "securityGroups") - } - if diff.Changed("keyName") { - replaces = append(replaces, "keyName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *InstanceProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(InstanceToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *InstanceProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(InstanceToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *InstanceProvider) Unmarshal( - v *pbstruct.Struct) (*Instance, resource.PropertyMap, error) { - var obj Instance - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Instance structure(s) */ - -// Instance is a marshalable representation of its corresponding IDL type. -type Instance struct { - Name *string `lumi:"name,optional"` - ImageID string `lumi:"imageId"` - InstanceType *InstanceType `lumi:"instanceType,optional"` - SecurityGroups *[]resource.ID `lumi:"securityGroups,optional"` - KeyName *string `lumi:"keyName,optional"` - Tags *[]Tag `lumi:"tags,optional"` - AvailabilityZone string `lumi:"availabilityZone,optional"` - PrivateDNSName *string `lumi:"privateDNSName,optional"` - PublicDNSName *string `lumi:"publicDNSName,optional"` - PrivateIP *string `lumi:"privateIP,optional"` - PublicIP *string `lumi:"publicIP,optional"` -} - -// Instance's properties have constants to make dealing with diffs and property bags easier. -const ( - Instance_Name = "name" - Instance_ImageID = "imageId" - Instance_InstanceType = "instanceType" - Instance_SecurityGroups = "securityGroups" - Instance_KeyName = "keyName" - Instance_Tags = "tags" - Instance_AvailabilityZone = "availabilityZone" - Instance_PrivateDNSName = "privateDNSName" - Instance_PublicDNSName = "publicDNSName" - Instance_PrivateIP = "privateIP" - Instance_PublicIP = "publicIP" -) - -/* Marshalable Tag structure(s) */ - -// Tag is a marshalable representation of its corresponding IDL type. -type Tag struct { - Key string `lumi:"key"` - Value string `lumi:"value"` -} - -// Tag's properties have constants to make dealing with diffs and property bags easier. -const ( - Tag_Key = "key" - Tag_Value = "value" -) - -/* Typedefs */ - -type ( - InstanceType string -) - -/* Constants */ - -const ( - C3Instance2XLarge InstanceType = "c3.2xlarge" - C3Instance4XLarge InstanceType = "c3.4xlarge" - C3Instance8XLarge InstanceType = "c3.8xlarge" - C3InstanceLarge InstanceType = "c3.large" - C3InstanceXLarge InstanceType = "c3.xlarge" - C4Instance2XLarge InstanceType = "c4.2xlarge" - C4Instance4XLarge InstanceType = "c4.4xlarge" - C4Instance8XLarge InstanceType = "c4.8xlarge" - C4InstanceLarge InstanceType = "c4.large" - C4InstanceXLarge InstanceType = "c4.xlarge" - D2Instance2XLarge InstanceType = "d2.2xlarge" - D2Instance4XLarge InstanceType = "d2.4xlarge" - D2Instance8XLarge InstanceType = "d2.8xlarge" - D2InstanceXLarge InstanceType = "d2.xlarge" - F1Instance16XLarge InstanceType = "f1.16xlarge" - F1Instance2XLarge InstanceType = "f1.2xlarge" - G2Instance2XLarge InstanceType = "g2.2xlarge" - G2Instance8XLarge InstanceType = "g2.8xlarge" - I3Instance16XLarge InstanceType = "i3.16xlarge" - I3Instance2XLarge InstanceType = "i3.2xlarge" - I3Instance4XLarge InstanceType = "i3.4xlarge" - I3Instance8XLarge InstanceType = "i3.8xlarge" - I3InstanceLarge InstanceType = "i3.large" - I3InstanceXLarge InstanceType = "i3.xlarge" - M3Instance2XLarge InstanceType = "m3.2xlarge" - M3InstanceLarge InstanceType = "m3.large" - M3InstanceMedium InstanceType = "m3.medium" - M3InstanceXLarge InstanceType = "m3.xlarge" - M4Instance10XLarge InstanceType = "m4.10xlarge" - M4Instance16XLarge InstanceType = "m4.16xlarge" - M4Instance2XLarge InstanceType = "m4.2xlarge" - M4Instance4XLarge InstanceType = "m4.4xlarge" - M4InstanceLarge InstanceType = "m4.large" - M4InstanceXLarge InstanceType = "m4.xlarge" - P2Instance16XLarge InstanceType = "p2.16xlarge" - P2Instance8XLarge InstanceType = "p2.8xlarge" - P2InstanceXLarge InstanceType = "p2.xlarge" - R3Instance2XLarge InstanceType = "r3.2xlarge" - R3Instance4XLarge InstanceType = "r3.4xlarge" - R3Instance8XLarge InstanceType = "r3.8xlarge" - R3InstanceLarge InstanceType = "r3.large" - R3InstanceXLarge InstanceType = "r3.xlarge" - R4Instance16XLarge InstanceType = "r4.16xlarge" - R4Instance2XLarge InstanceType = "r4.2xlarge" - R4Instance4XLarge InstanceType = "r4.4xlarge" - R4Instance8XLarge InstanceType = "r4.8xlarge" - R4InstanceLarge InstanceType = "r4.large" - R4InstanceXLarge InstanceType = "r4.xlarge" - T2Instance2XLarge InstanceType = "t2.2xlarge" - T2InstanceLarge InstanceType = "t2.large" - T2InstanceMedium InstanceType = "t2.medium" - T2InstanceMicro InstanceType = "t2.micro" - T2InstanceNano InstanceType = "t2.nano" - T2InstanceSmall InstanceType = "t2.small" - T2InstanceXLarge InstanceType = "t2.xlarge" - X1Instance16XLarge InstanceType = "x1.16xlarge" - X1Instance32XLarge InstanceType = "x1.32xlarge" -) - - diff --git a/lib/aws/rpc/ec2/internetGateway.go b/lib/aws/rpc/ec2/internetGateway.go deleted file mode 100644 index 87613a18b..000000000 --- a/lib/aws/rpc/ec2/internetGateway.go +++ /dev/null @@ -1,193 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for InternetGateway resource provider */ - -// InternetGatewayToken is the type token corresponding to the InternetGateway package type. -const InternetGatewayToken = tokens.Type("aws:ec2/internetGateway:InternetGateway") - -// InternetGatewayProviderOps is a pluggable interface for InternetGateway-related management functionality. -type InternetGatewayProviderOps interface { - Check(ctx context.Context, obj *InternetGateway, property string) error - Create(ctx context.Context, obj *InternetGateway) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*InternetGateway, error) - InspectChange(ctx context.Context, - id resource.ID, old *InternetGateway, new *InternetGateway, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *InternetGateway, new *InternetGateway, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// InternetGatewayProvider is a dynamic gRPC-based plugin for managing InternetGateway resources. -type InternetGatewayProvider struct { - ops InternetGatewayProviderOps -} - -// NewInternetGatewayProvider allocates a resource provider that delegates to a ops instance. -func NewInternetGatewayProvider(ops InternetGatewayProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &InternetGatewayProvider{ops: ops} -} - -func (p *InternetGatewayProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(InternetGatewayToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("InternetGateway", "name", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *InternetGatewayProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(InternetGatewayToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[InternetGateway_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *InternetGatewayProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(InternetGatewayToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *InternetGatewayProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(InternetGatewayToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *InternetGatewayProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(InternetGatewayToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *InternetGatewayProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(InternetGatewayToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *InternetGatewayProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(InternetGatewayToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *InternetGatewayProvider) Unmarshal( - v *pbstruct.Struct) (*InternetGateway, resource.PropertyMap, error) { - var obj InternetGateway - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable InternetGateway structure(s) */ - -// InternetGateway is a marshalable representation of its corresponding IDL type. -type InternetGateway struct { - Name *string `lumi:"name,optional"` -} - -// InternetGateway's properties have constants to make dealing with diffs and property bags easier. -const ( - InternetGateway_Name = "name" -) - - diff --git a/lib/aws/rpc/ec2/route.go b/lib/aws/rpc/ec2/route.go deleted file mode 100644 index 6e76d84dc..000000000 --- a/lib/aws/rpc/ec2/route.go +++ /dev/null @@ -1,237 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Route resource provider */ - -// RouteToken is the type token corresponding to the Route package type. -const RouteToken = tokens.Type("aws:ec2/route:Route") - -// RouteProviderOps is a pluggable interface for Route-related management functionality. -type RouteProviderOps interface { - Check(ctx context.Context, obj *Route, property string) error - Create(ctx context.Context, obj *Route) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Route, error) - InspectChange(ctx context.Context, - id resource.ID, old *Route, new *Route, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Route, new *Route, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// RouteProvider is a dynamic gRPC-based plugin for managing Route resources. -type RouteProvider struct { - ops RouteProviderOps -} - -// NewRouteProvider allocates a resource provider that delegates to a ops instance. -func NewRouteProvider(ops RouteProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &RouteProvider{ops: ops} -} - -func (p *RouteProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(RouteToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Route", "name", failure)) - } - } - if !unks["destinationCidrBlock"] { - if failure := p.ops.Check(ctx, obj, "destinationCidrBlock"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Route", "destinationCidrBlock", failure)) - } - } - if !unks["routeTable"] { - if failure := p.ops.Check(ctx, obj, "routeTable"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Route", "routeTable", failure)) - } - } - if !unks["internetGateway"] { - if failure := p.ops.Check(ctx, obj, "internetGateway"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Route", "internetGateway", failure)) - } - } - if !unks["vpcGatewayAttachment"] { - if failure := p.ops.Check(ctx, obj, "vpcGatewayAttachment"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Route", "vpcGatewayAttachment", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *RouteProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(RouteToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Route_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *RouteProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(RouteToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *RouteProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(RouteToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *RouteProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(RouteToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("destinationCidrBlock") { - replaces = append(replaces, "destinationCidrBlock") - } - if diff.Changed("routeTable") { - replaces = append(replaces, "routeTable") - } - if diff.Changed("internetGateway") { - replaces = append(replaces, "internetGateway") - } - if diff.Changed("vpcGatewayAttachment") { - replaces = append(replaces, "vpcGatewayAttachment") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *RouteProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(RouteToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *RouteProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(RouteToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *RouteProvider) Unmarshal( - v *pbstruct.Struct) (*Route, resource.PropertyMap, error) { - var obj Route - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Route structure(s) */ - -// Route is a marshalable representation of its corresponding IDL type. -type Route struct { - Name *string `lumi:"name,optional"` - DestinationCidrBlock string `lumi:"destinationCidrBlock"` - RouteTable resource.ID `lumi:"routeTable"` - InternetGateway resource.ID `lumi:"internetGateway"` - VPCGatewayAttachment resource.ID `lumi:"vpcGatewayAttachment"` -} - -// Route's properties have constants to make dealing with diffs and property bags easier. -const ( - Route_Name = "name" - Route_DestinationCidrBlock = "destinationCidrBlock" - Route_RouteTable = "routeTable" - Route_InternetGateway = "internetGateway" - Route_VPCGatewayAttachment = "vpcGatewayAttachment" -) - - diff --git a/lib/aws/rpc/ec2/routeTable.go b/lib/aws/rpc/ec2/routeTable.go deleted file mode 100644 index 4e4a8c513..000000000 --- a/lib/aws/rpc/ec2/routeTable.go +++ /dev/null @@ -1,204 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for RouteTable resource provider */ - -// RouteTableToken is the type token corresponding to the RouteTable package type. -const RouteTableToken = tokens.Type("aws:ec2/routeTable:RouteTable") - -// RouteTableProviderOps is a pluggable interface for RouteTable-related management functionality. -type RouteTableProviderOps interface { - Check(ctx context.Context, obj *RouteTable, property string) error - Create(ctx context.Context, obj *RouteTable) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*RouteTable, error) - InspectChange(ctx context.Context, - id resource.ID, old *RouteTable, new *RouteTable, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *RouteTable, new *RouteTable, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// RouteTableProvider is a dynamic gRPC-based plugin for managing RouteTable resources. -type RouteTableProvider struct { - ops RouteTableProviderOps -} - -// NewRouteTableProvider allocates a resource provider that delegates to a ops instance. -func NewRouteTableProvider(ops RouteTableProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &RouteTableProvider{ops: ops} -} - -func (p *RouteTableProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(RouteTableToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RouteTable", "name", failure)) - } - } - if !unks["vpc"] { - if failure := p.ops.Check(ctx, obj, "vpc"); failure != nil { - failures = append(failures, - resource.NewPropertyError("RouteTable", "vpc", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *RouteTableProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(RouteTableToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[RouteTable_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *RouteTableProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(RouteTableToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *RouteTableProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(RouteTableToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *RouteTableProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(RouteTableToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("vpc") { - replaces = append(replaces, "vpc") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *RouteTableProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(RouteTableToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *RouteTableProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(RouteTableToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *RouteTableProvider) Unmarshal( - v *pbstruct.Struct) (*RouteTable, resource.PropertyMap, error) { - var obj RouteTable - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable RouteTable structure(s) */ - -// RouteTable is a marshalable representation of its corresponding IDL type. -type RouteTable struct { - Name *string `lumi:"name,optional"` - VPC resource.ID `lumi:"vpc"` -} - -// RouteTable's properties have constants to make dealing with diffs and property bags easier. -const ( - RouteTable_Name = "name" - RouteTable_VPC = "vpc" -) - - diff --git a/lib/aws/rpc/ec2/securityGroup.go b/lib/aws/rpc/ec2/securityGroup.go deleted file mode 100644 index e3a982525..000000000 --- a/lib/aws/rpc/ec2/securityGroup.go +++ /dev/null @@ -1,262 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for SecurityGroup resource provider */ - -// SecurityGroupToken is the type token corresponding to the SecurityGroup package type. -const SecurityGroupToken = tokens.Type("aws:ec2/securityGroup:SecurityGroup") - -// SecurityGroupProviderOps is a pluggable interface for SecurityGroup-related management functionality. -type SecurityGroupProviderOps interface { - Check(ctx context.Context, obj *SecurityGroup, property string) error - Create(ctx context.Context, obj *SecurityGroup) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*SecurityGroup, error) - InspectChange(ctx context.Context, - id resource.ID, old *SecurityGroup, new *SecurityGroup, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *SecurityGroup, new *SecurityGroup, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// SecurityGroupProvider is a dynamic gRPC-based plugin for managing SecurityGroup resources. -type SecurityGroupProvider struct { - ops SecurityGroupProviderOps -} - -// NewSecurityGroupProvider allocates a resource provider that delegates to a ops instance. -func NewSecurityGroupProvider(ops SecurityGroupProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &SecurityGroupProvider{ops: ops} -} - -func (p *SecurityGroupProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroup", "name", failure)) - } - } - if !unks["groupDescription"] { - if failure := p.ops.Check(ctx, obj, "groupDescription"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroup", "groupDescription", failure)) - } - } - if !unks["groupName"] { - if failure := p.ops.Check(ctx, obj, "groupName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroup", "groupName", failure)) - } - } - if !unks["vpc"] { - if failure := p.ops.Check(ctx, obj, "vpc"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroup", "vpc", failure)) - } - } - if !unks["securityGroupEgress"] { - if failure := p.ops.Check(ctx, obj, "securityGroupEgress"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroup", "securityGroupEgress", failure)) - } - } - if !unks["securityGroupIngress"] { - if failure := p.ops.Check(ctx, obj, "securityGroupIngress"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroup", "securityGroupIngress", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *SecurityGroupProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[SecurityGroup_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *SecurityGroupProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *SecurityGroupProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *SecurityGroupProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("groupDescription") { - replaces = append(replaces, "groupDescription") - } - if diff.Changed("groupName") { - replaces = append(replaces, "groupName") - } - if diff.Changed("vpc") { - replaces = append(replaces, "vpc") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *SecurityGroupProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SecurityGroupToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SecurityGroupProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SecurityGroupToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SecurityGroupProvider) Unmarshal( - v *pbstruct.Struct) (*SecurityGroup, resource.PropertyMap, error) { - var obj SecurityGroup - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable SecurityGroup structure(s) */ - -// SecurityGroup is a marshalable representation of its corresponding IDL type. -type SecurityGroup struct { - Name *string `lumi:"name,optional"` - GroupDescription string `lumi:"groupDescription"` - GroupName *string `lumi:"groupName,optional"` - VPC *resource.ID `lumi:"vpc,optional"` - SecurityGroupEgress *[]SecurityGroupRule `lumi:"securityGroupEgress,optional"` - SecurityGroupIngress *[]SecurityGroupRule `lumi:"securityGroupIngress,optional"` - GroupID string `lumi:"groupID,optional"` -} - -// SecurityGroup's properties have constants to make dealing with diffs and property bags easier. -const ( - SecurityGroup_Name = "name" - SecurityGroup_GroupDescription = "groupDescription" - SecurityGroup_GroupName = "groupName" - SecurityGroup_VPC = "vpc" - SecurityGroup_SecurityGroupEgress = "securityGroupEgress" - SecurityGroup_SecurityGroupIngress = "securityGroupIngress" - SecurityGroup_GroupID = "groupID" -) - -/* Marshalable SecurityGroupRule structure(s) */ - -// SecurityGroupRule is a marshalable representation of its corresponding IDL type. -type SecurityGroupRule struct { - IPProtocol string `lumi:"ipProtocol"` - CIDRIP *string `lumi:"cidrIp,optional"` - FromPort *float64 `lumi:"fromPort,optional"` - ToPort *float64 `lumi:"toPort,optional"` -} - -// SecurityGroupRule's properties have constants to make dealing with diffs and property bags easier. -const ( - SecurityGroupRule_IPProtocol = "ipProtocol" - SecurityGroupRule_CIDRIP = "cidrIp" - SecurityGroupRule_FromPort = "fromPort" - SecurityGroupRule_ToPort = "toPort" -) - - diff --git a/lib/aws/rpc/ec2/securityGroupEgress.go b/lib/aws/rpc/ec2/securityGroupEgress.go deleted file mode 100644 index 985619d38..000000000 --- a/lib/aws/rpc/ec2/securityGroupEgress.go +++ /dev/null @@ -1,281 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for SecurityGroupEgress resource provider */ - -// SecurityGroupEgressToken is the type token corresponding to the SecurityGroupEgress package type. -const SecurityGroupEgressToken = tokens.Type("aws:ec2/securityGroupEgress:SecurityGroupEgress") - -// SecurityGroupEgressProviderOps is a pluggable interface for SecurityGroupEgress-related management functionality. -type SecurityGroupEgressProviderOps interface { - Check(ctx context.Context, obj *SecurityGroupEgress, property string) error - Create(ctx context.Context, obj *SecurityGroupEgress) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*SecurityGroupEgress, error) - InspectChange(ctx context.Context, - id resource.ID, old *SecurityGroupEgress, new *SecurityGroupEgress, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *SecurityGroupEgress, new *SecurityGroupEgress, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// SecurityGroupEgressProvider is a dynamic gRPC-based plugin for managing SecurityGroupEgress resources. -type SecurityGroupEgressProvider struct { - ops SecurityGroupEgressProviderOps -} - -// NewSecurityGroupEgressProvider allocates a resource provider that delegates to a ops instance. -func NewSecurityGroupEgressProvider(ops SecurityGroupEgressProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &SecurityGroupEgressProvider{ops: ops} -} - -func (p *SecurityGroupEgressProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupEgressToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "name", failure)) - } - } - if !unks["fromPort"] { - if failure := p.ops.Check(ctx, obj, "fromPort"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "fromPort", failure)) - } - } - if !unks["group"] { - if failure := p.ops.Check(ctx, obj, "group"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "group", failure)) - } - } - if !unks["ipProtocol"] { - if failure := p.ops.Check(ctx, obj, "ipProtocol"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "ipProtocol", failure)) - } - } - if !unks["toPort"] { - if failure := p.ops.Check(ctx, obj, "toPort"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "toPort", failure)) - } - } - if !unks["cidrIp"] { - if failure := p.ops.Check(ctx, obj, "cidrIp"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "cidrIp", failure)) - } - } - if !unks["cidrIpv6"] { - if failure := p.ops.Check(ctx, obj, "cidrIpv6"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "cidrIpv6", failure)) - } - } - if !unks["destinationPrefixListId"] { - if failure := p.ops.Check(ctx, obj, "destinationPrefixListId"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "destinationPrefixListId", failure)) - } - } - if !unks["destinationSecurityGroup"] { - if failure := p.ops.Check(ctx, obj, "destinationSecurityGroup"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupEgress", "destinationSecurityGroup", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *SecurityGroupEgressProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupEgressToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[SecurityGroupEgress_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *SecurityGroupEgressProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupEgressToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *SecurityGroupEgressProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupEgressToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *SecurityGroupEgressProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupEgressToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("fromPort") { - replaces = append(replaces, "fromPort") - } - if diff.Changed("group") { - replaces = append(replaces, "group") - } - if diff.Changed("ipProtocol") { - replaces = append(replaces, "ipProtocol") - } - if diff.Changed("toPort") { - replaces = append(replaces, "toPort") - } - if diff.Changed("cidrIp") { - replaces = append(replaces, "cidrIp") - } - if diff.Changed("cidrIpv6") { - replaces = append(replaces, "cidrIpv6") - } - if diff.Changed("destinationPrefixListId") { - replaces = append(replaces, "destinationPrefixListId") - } - if diff.Changed("destinationSecurityGroup") { - replaces = append(replaces, "destinationSecurityGroup") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *SecurityGroupEgressProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SecurityGroupEgressToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SecurityGroupEgressProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SecurityGroupEgressToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SecurityGroupEgressProvider) Unmarshal( - v *pbstruct.Struct) (*SecurityGroupEgress, resource.PropertyMap, error) { - var obj SecurityGroupEgress - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable SecurityGroupEgress structure(s) */ - -// SecurityGroupEgress is a marshalable representation of its corresponding IDL type. -type SecurityGroupEgress struct { - Name *string `lumi:"name,optional"` - FromPort float64 `lumi:"fromPort"` - Group resource.ID `lumi:"group"` - IPProtocol string `lumi:"ipProtocol"` - ToPort float64 `lumi:"toPort"` - CIDRIP *string `lumi:"cidrIp,optional"` - CIDRIPv6 *string `lumi:"cidrIpv6,optional"` - DestinationPrefixListId *string `lumi:"destinationPrefixListId,optional"` - DestinationSecurityGroup *resource.ID `lumi:"destinationSecurityGroup,optional"` -} - -// SecurityGroupEgress's properties have constants to make dealing with diffs and property bags easier. -const ( - SecurityGroupEgress_Name = "name" - SecurityGroupEgress_FromPort = "fromPort" - SecurityGroupEgress_Group = "group" - SecurityGroupEgress_IPProtocol = "ipProtocol" - SecurityGroupEgress_ToPort = "toPort" - SecurityGroupEgress_CIDRIP = "cidrIp" - SecurityGroupEgress_CIDRIPv6 = "cidrIpv6" - SecurityGroupEgress_DestinationPrefixListId = "destinationPrefixListId" - SecurityGroupEgress_DestinationSecurityGroup = "destinationSecurityGroup" -) - - diff --git a/lib/aws/rpc/ec2/securityGroupIngress.go b/lib/aws/rpc/ec2/securityGroupIngress.go deleted file mode 100644 index febe0728b..000000000 --- a/lib/aws/rpc/ec2/securityGroupIngress.go +++ /dev/null @@ -1,303 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for SecurityGroupIngress resource provider */ - -// SecurityGroupIngressToken is the type token corresponding to the SecurityGroupIngress package type. -const SecurityGroupIngressToken = tokens.Type("aws:ec2/securityGroupIngress:SecurityGroupIngress") - -// SecurityGroupIngressProviderOps is a pluggable interface for SecurityGroupIngress-related management functionality. -type SecurityGroupIngressProviderOps interface { - Check(ctx context.Context, obj *SecurityGroupIngress, property string) error - Create(ctx context.Context, obj *SecurityGroupIngress) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*SecurityGroupIngress, error) - InspectChange(ctx context.Context, - id resource.ID, old *SecurityGroupIngress, new *SecurityGroupIngress, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *SecurityGroupIngress, new *SecurityGroupIngress, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// SecurityGroupIngressProvider is a dynamic gRPC-based plugin for managing SecurityGroupIngress resources. -type SecurityGroupIngressProvider struct { - ops SecurityGroupIngressProviderOps -} - -// NewSecurityGroupIngressProvider allocates a resource provider that delegates to a ops instance. -func NewSecurityGroupIngressProvider(ops SecurityGroupIngressProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &SecurityGroupIngressProvider{ops: ops} -} - -func (p *SecurityGroupIngressProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupIngressToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "name", failure)) - } - } - if !unks["ipProtocol"] { - if failure := p.ops.Check(ctx, obj, "ipProtocol"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "ipProtocol", failure)) - } - } - if !unks["cidrIp"] { - if failure := p.ops.Check(ctx, obj, "cidrIp"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "cidrIp", failure)) - } - } - if !unks["cidrIpv6"] { - if failure := p.ops.Check(ctx, obj, "cidrIpv6"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "cidrIpv6", failure)) - } - } - if !unks["fromPort"] { - if failure := p.ops.Check(ctx, obj, "fromPort"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "fromPort", failure)) - } - } - if !unks["group"] { - if failure := p.ops.Check(ctx, obj, "group"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "group", failure)) - } - } - if !unks["groupName"] { - if failure := p.ops.Check(ctx, obj, "groupName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "groupName", failure)) - } - } - if !unks["sourceSecurityGroup"] { - if failure := p.ops.Check(ctx, obj, "sourceSecurityGroup"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "sourceSecurityGroup", failure)) - } - } - if !unks["sourceSecurityGroupName"] { - if failure := p.ops.Check(ctx, obj, "sourceSecurityGroupName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "sourceSecurityGroupName", failure)) - } - } - if !unks["sourceSecurityGroupOwnerId"] { - if failure := p.ops.Check(ctx, obj, "sourceSecurityGroupOwnerId"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "sourceSecurityGroupOwnerId", failure)) - } - } - if !unks["toPort"] { - if failure := p.ops.Check(ctx, obj, "toPort"); failure != nil { - failures = append(failures, - resource.NewPropertyError("SecurityGroupIngress", "toPort", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *SecurityGroupIngressProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupIngressToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[SecurityGroupIngress_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *SecurityGroupIngressProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupIngressToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *SecurityGroupIngressProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupIngressToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *SecurityGroupIngressProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(SecurityGroupIngressToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("ipProtocol") { - replaces = append(replaces, "ipProtocol") - } - if diff.Changed("cidrIp") { - replaces = append(replaces, "cidrIp") - } - if diff.Changed("cidrIpv6") { - replaces = append(replaces, "cidrIpv6") - } - if diff.Changed("fromPort") { - replaces = append(replaces, "fromPort") - } - if diff.Changed("group") { - replaces = append(replaces, "group") - } - if diff.Changed("groupName") { - replaces = append(replaces, "groupName") - } - if diff.Changed("sourceSecurityGroup") { - replaces = append(replaces, "sourceSecurityGroup") - } - if diff.Changed("sourceSecurityGroupName") { - replaces = append(replaces, "sourceSecurityGroupName") - } - if diff.Changed("sourceSecurityGroupOwnerId") { - replaces = append(replaces, "sourceSecurityGroupOwnerId") - } - if diff.Changed("toPort") { - replaces = append(replaces, "toPort") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *SecurityGroupIngressProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SecurityGroupIngressToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SecurityGroupIngressProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SecurityGroupIngressToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SecurityGroupIngressProvider) Unmarshal( - v *pbstruct.Struct) (*SecurityGroupIngress, resource.PropertyMap, error) { - var obj SecurityGroupIngress - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable SecurityGroupIngress structure(s) */ - -// SecurityGroupIngress is a marshalable representation of its corresponding IDL type. -type SecurityGroupIngress struct { - Name *string `lumi:"name,optional"` - IPProtocol string `lumi:"ipProtocol"` - CIDRIP *string `lumi:"cidrIp,optional"` - CIDRIPv6 *string `lumi:"cidrIpv6,optional"` - FromPort *float64 `lumi:"fromPort,optional"` - Group *resource.ID `lumi:"group,optional"` - GroupName *string `lumi:"groupName,optional"` - SourceSecurityGroup *resource.ID `lumi:"sourceSecurityGroup,optional"` - SourceSecurityGroupName *string `lumi:"sourceSecurityGroupName,optional"` - SourceSecurityGroupOwnerId *string `lumi:"sourceSecurityGroupOwnerId,optional"` - ToPort *float64 `lumi:"toPort,optional"` -} - -// SecurityGroupIngress's properties have constants to make dealing with diffs and property bags easier. -const ( - SecurityGroupIngress_Name = "name" - SecurityGroupIngress_IPProtocol = "ipProtocol" - SecurityGroupIngress_CIDRIP = "cidrIp" - SecurityGroupIngress_CIDRIPv6 = "cidrIpv6" - SecurityGroupIngress_FromPort = "fromPort" - SecurityGroupIngress_Group = "group" - SecurityGroupIngress_GroupName = "groupName" - SecurityGroupIngress_SourceSecurityGroup = "sourceSecurityGroup" - SecurityGroupIngress_SourceSecurityGroupName = "sourceSecurityGroupName" - SecurityGroupIngress_SourceSecurityGroupOwnerId = "sourceSecurityGroupOwnerId" - SecurityGroupIngress_ToPort = "toPort" -) - - diff --git a/lib/aws/rpc/ec2/subnet.go b/lib/aws/rpc/ec2/subnet.go deleted file mode 100644 index b2ed2c02c..000000000 --- a/lib/aws/rpc/ec2/subnet.go +++ /dev/null @@ -1,234 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Subnet resource provider */ - -// SubnetToken is the type token corresponding to the Subnet package type. -const SubnetToken = tokens.Type("aws:ec2/subnet:Subnet") - -// SubnetProviderOps is a pluggable interface for Subnet-related management functionality. -type SubnetProviderOps interface { - Check(ctx context.Context, obj *Subnet, property string) error - Create(ctx context.Context, obj *Subnet) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Subnet, error) - InspectChange(ctx context.Context, - id resource.ID, old *Subnet, new *Subnet, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Subnet, new *Subnet, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// SubnetProvider is a dynamic gRPC-based plugin for managing Subnet resources. -type SubnetProvider struct { - ops SubnetProviderOps -} - -// NewSubnetProvider allocates a resource provider that delegates to a ops instance. -func NewSubnetProvider(ops SubnetProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &SubnetProvider{ops: ops} -} - -func (p *SubnetProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(SubnetToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subnet", "name", failure)) - } - } - if !unks["cidrBlock"] { - if failure := p.ops.Check(ctx, obj, "cidrBlock"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subnet", "cidrBlock", failure)) - } - } - if !unks["vpc"] { - if failure := p.ops.Check(ctx, obj, "vpc"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subnet", "vpc", failure)) - } - } - if !unks["availabilityZone"] { - if failure := p.ops.Check(ctx, obj, "availabilityZone"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subnet", "availabilityZone", failure)) - } - } - if !unks["mapPublicIpOnLaunch"] { - if failure := p.ops.Check(ctx, obj, "mapPublicIpOnLaunch"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subnet", "mapPublicIpOnLaunch", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *SubnetProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(SubnetToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Subnet_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *SubnetProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(SubnetToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *SubnetProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(SubnetToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *SubnetProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(SubnetToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("cidrBlock") { - replaces = append(replaces, "cidrBlock") - } - if diff.Changed("vpc") { - replaces = append(replaces, "vpc") - } - if diff.Changed("availabilityZone") { - replaces = append(replaces, "availabilityZone") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *SubnetProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SubnetToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SubnetProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SubnetToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SubnetProvider) Unmarshal( - v *pbstruct.Struct) (*Subnet, resource.PropertyMap, error) { - var obj Subnet - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Subnet structure(s) */ - -// Subnet is a marshalable representation of its corresponding IDL type. -type Subnet struct { - Name *string `lumi:"name,optional"` - CIDRBlock string `lumi:"cidrBlock"` - VPC resource.ID `lumi:"vpc"` - AvailabilityZone *string `lumi:"availabilityZone,optional"` - MapPublicIpOnLaunch *bool `lumi:"mapPublicIpOnLaunch,optional"` -} - -// Subnet's properties have constants to make dealing with diffs and property bags easier. -const ( - Subnet_Name = "name" - Subnet_CIDRBlock = "cidrBlock" - Subnet_VPC = "vpc" - Subnet_AvailabilityZone = "availabilityZone" - Subnet_MapPublicIpOnLaunch = "mapPublicIpOnLaunch" -) - - diff --git a/lib/aws/rpc/ec2/vpc.go b/lib/aws/rpc/ec2/vpc.go deleted file mode 100644 index 1b213c4b0..000000000 --- a/lib/aws/rpc/ec2/vpc.go +++ /dev/null @@ -1,245 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for VPC resource provider */ - -// VPCToken is the type token corresponding to the VPC package type. -const VPCToken = tokens.Type("aws:ec2/vpc:VPC") - -// VPCProviderOps is a pluggable interface for VPC-related management functionality. -type VPCProviderOps interface { - Check(ctx context.Context, obj *VPC, property string) error - Create(ctx context.Context, obj *VPC) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*VPC, error) - InspectChange(ctx context.Context, - id resource.ID, old *VPC, new *VPC, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *VPC, new *VPC, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// VPCProvider is a dynamic gRPC-based plugin for managing VPC resources. -type VPCProvider struct { - ops VPCProviderOps -} - -// NewVPCProvider allocates a resource provider that delegates to a ops instance. -func NewVPCProvider(ops VPCProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &VPCProvider{ops: ops} -} - -func (p *VPCProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(VPCToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPC", "name", failure)) - } - } - if !unks["cidrBlock"] { - if failure := p.ops.Check(ctx, obj, "cidrBlock"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPC", "cidrBlock", failure)) - } - } - if !unks["instanceTenancy"] { - if failure := p.ops.Check(ctx, obj, "instanceTenancy"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPC", "instanceTenancy", failure)) - } - } - if !unks["enableDnsSupport"] { - if failure := p.ops.Check(ctx, obj, "enableDnsSupport"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPC", "enableDnsSupport", failure)) - } - } - if !unks["enableDnsHostnames"] { - if failure := p.ops.Check(ctx, obj, "enableDnsHostnames"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPC", "enableDnsHostnames", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *VPCProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(VPCToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[VPC_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *VPCProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(VPCToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *VPCProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(VPCToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *VPCProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(VPCToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("cidrBlock") { - replaces = append(replaces, "cidrBlock") - } - if diff.Changed("instanceTenancy") { - replaces = append(replaces, "instanceTenancy") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *VPCProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(VPCToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *VPCProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(VPCToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *VPCProvider) Unmarshal( - v *pbstruct.Struct) (*VPC, resource.PropertyMap, error) { - var obj VPC - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable VPC structure(s) */ - -// VPC is a marshalable representation of its corresponding IDL type. -type VPC struct { - Name *string `lumi:"name,optional"` - CIDRBlock string `lumi:"cidrBlock"` - InstanceTenancy *InstanceTenancy `lumi:"instanceTenancy,optional"` - EnableDNSSupport *bool `lumi:"enableDnsSupport,optional"` - EnableDNSHostnames *bool `lumi:"enableDnsHostnames,optional"` -} - -// VPC's properties have constants to make dealing with diffs and property bags easier. -const ( - VPC_Name = "name" - VPC_CIDRBlock = "cidrBlock" - VPC_InstanceTenancy = "instanceTenancy" - VPC_EnableDNSSupport = "enableDnsSupport" - VPC_EnableDNSHostnames = "enableDnsHostnames" -) - -/* Typedefs */ - -type ( - InstanceTenancy string -) - -/* Constants */ - -const ( - DedicatedTenancy InstanceTenancy = "dedicated" - DefaultTenancy InstanceTenancy = "default" - HostTenancy InstanceTenancy = "host" -) - - diff --git a/lib/aws/rpc/ec2/vpcGatewayAttachment.go b/lib/aws/rpc/ec2/vpcGatewayAttachment.go deleted file mode 100644 index 3555704a8..000000000 --- a/lib/aws/rpc/ec2/vpcGatewayAttachment.go +++ /dev/null @@ -1,215 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for VPCGatewayAttachment resource provider */ - -// VPCGatewayAttachmentToken is the type token corresponding to the VPCGatewayAttachment package type. -const VPCGatewayAttachmentToken = tokens.Type("aws:ec2/vpcGatewayAttachment:VPCGatewayAttachment") - -// VPCGatewayAttachmentProviderOps is a pluggable interface for VPCGatewayAttachment-related management functionality. -type VPCGatewayAttachmentProviderOps interface { - Check(ctx context.Context, obj *VPCGatewayAttachment, property string) error - Create(ctx context.Context, obj *VPCGatewayAttachment) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*VPCGatewayAttachment, error) - InspectChange(ctx context.Context, - id resource.ID, old *VPCGatewayAttachment, new *VPCGatewayAttachment, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *VPCGatewayAttachment, new *VPCGatewayAttachment, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// VPCGatewayAttachmentProvider is a dynamic gRPC-based plugin for managing VPCGatewayAttachment resources. -type VPCGatewayAttachmentProvider struct { - ops VPCGatewayAttachmentProviderOps -} - -// NewVPCGatewayAttachmentProvider allocates a resource provider that delegates to a ops instance. -func NewVPCGatewayAttachmentProvider(ops VPCGatewayAttachmentProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &VPCGatewayAttachmentProvider{ops: ops} -} - -func (p *VPCGatewayAttachmentProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(VPCGatewayAttachmentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPCGatewayAttachment", "name", failure)) - } - } - if !unks["vpc"] { - if failure := p.ops.Check(ctx, obj, "vpc"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPCGatewayAttachment", "vpc", failure)) - } - } - if !unks["internetGateway"] { - if failure := p.ops.Check(ctx, obj, "internetGateway"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPCGatewayAttachment", "internetGateway", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *VPCGatewayAttachmentProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(VPCGatewayAttachmentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[VPCGatewayAttachment_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *VPCGatewayAttachmentProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(VPCGatewayAttachmentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *VPCGatewayAttachmentProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(VPCGatewayAttachmentToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *VPCGatewayAttachmentProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(VPCGatewayAttachmentToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("vpc") { - replaces = append(replaces, "vpc") - } - if diff.Changed("internetGateway") { - replaces = append(replaces, "internetGateway") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *VPCGatewayAttachmentProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(VPCGatewayAttachmentToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *VPCGatewayAttachmentProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(VPCGatewayAttachmentToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *VPCGatewayAttachmentProvider) Unmarshal( - v *pbstruct.Struct) (*VPCGatewayAttachment, resource.PropertyMap, error) { - var obj VPCGatewayAttachment - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable VPCGatewayAttachment structure(s) */ - -// VPCGatewayAttachment is a marshalable representation of its corresponding IDL type. -type VPCGatewayAttachment struct { - Name *string `lumi:"name,optional"` - VPC resource.ID `lumi:"vpc"` - InternetGateway resource.ID `lumi:"internetGateway"` -} - -// VPCGatewayAttachment's properties have constants to make dealing with diffs and property bags easier. -const ( - VPCGatewayAttachment_Name = "name" - VPCGatewayAttachment_VPC = "vpc" - VPCGatewayAttachment_InternetGateway = "internetGateway" -) - - diff --git a/lib/aws/rpc/ec2/vpcPeeringConnection.go b/lib/aws/rpc/ec2/vpcPeeringConnection.go deleted file mode 100644 index ddfd8151c..000000000 --- a/lib/aws/rpc/ec2/vpcPeeringConnection.go +++ /dev/null @@ -1,215 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package ec2 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for VPCPeeringConnection resource provider */ - -// VPCPeeringConnectionToken is the type token corresponding to the VPCPeeringConnection package type. -const VPCPeeringConnectionToken = tokens.Type("aws:ec2/vpcPeeringConnection:VPCPeeringConnection") - -// VPCPeeringConnectionProviderOps is a pluggable interface for VPCPeeringConnection-related management functionality. -type VPCPeeringConnectionProviderOps interface { - Check(ctx context.Context, obj *VPCPeeringConnection, property string) error - Create(ctx context.Context, obj *VPCPeeringConnection) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*VPCPeeringConnection, error) - InspectChange(ctx context.Context, - id resource.ID, old *VPCPeeringConnection, new *VPCPeeringConnection, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *VPCPeeringConnection, new *VPCPeeringConnection, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// VPCPeeringConnectionProvider is a dynamic gRPC-based plugin for managing VPCPeeringConnection resources. -type VPCPeeringConnectionProvider struct { - ops VPCPeeringConnectionProviderOps -} - -// NewVPCPeeringConnectionProvider allocates a resource provider that delegates to a ops instance. -func NewVPCPeeringConnectionProvider(ops VPCPeeringConnectionProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &VPCPeeringConnectionProvider{ops: ops} -} - -func (p *VPCPeeringConnectionProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(VPCPeeringConnectionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPCPeeringConnection", "name", failure)) - } - } - if !unks["peerVpc"] { - if failure := p.ops.Check(ctx, obj, "peerVpc"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPCPeeringConnection", "peerVpc", failure)) - } - } - if !unks["vpc"] { - if failure := p.ops.Check(ctx, obj, "vpc"); failure != nil { - failures = append(failures, - resource.NewPropertyError("VPCPeeringConnection", "vpc", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *VPCPeeringConnectionProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(VPCPeeringConnectionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[VPCPeeringConnection_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *VPCPeeringConnectionProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(VPCPeeringConnectionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *VPCPeeringConnectionProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(VPCPeeringConnectionToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *VPCPeeringConnectionProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(VPCPeeringConnectionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("peerVpc") { - replaces = append(replaces, "peerVpc") - } - if diff.Changed("vpc") { - replaces = append(replaces, "vpc") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *VPCPeeringConnectionProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(VPCPeeringConnectionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *VPCPeeringConnectionProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(VPCPeeringConnectionToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *VPCPeeringConnectionProvider) Unmarshal( - v *pbstruct.Struct) (*VPCPeeringConnection, resource.PropertyMap, error) { - var obj VPCPeeringConnection - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable VPCPeeringConnection structure(s) */ - -// VPCPeeringConnection is a marshalable representation of its corresponding IDL type. -type VPCPeeringConnection struct { - Name *string `lumi:"name,optional"` - PeerVPC resource.ID `lumi:"peerVpc"` - VPC resource.ID `lumi:"vpc"` -} - -// VPCPeeringConnection's properties have constants to make dealing with diffs and property bags easier. -const ( - VPCPeeringConnection_Name = "name" - VPCPeeringConnection_PeerVPC = "peerVpc" - VPCPeeringConnection_VPC = "vpc" -) - - diff --git a/lib/aws/rpc/elasticbeanstalk/application.go b/lib/aws/rpc/elasticbeanstalk/application.go deleted file mode 100644 index b44d6a9ee..000000000 --- a/lib/aws/rpc/elasticbeanstalk/application.go +++ /dev/null @@ -1,212 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package elasticbeanstalk - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Application resource provider */ - -// ApplicationToken is the type token corresponding to the Application package type. -const ApplicationToken = tokens.Type("aws:elasticbeanstalk/application:Application") - -// ApplicationProviderOps is a pluggable interface for Application-related management functionality. -type ApplicationProviderOps interface { - Check(ctx context.Context, obj *Application, property string) error - Create(ctx context.Context, obj *Application) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Application, error) - InspectChange(ctx context.Context, - id resource.ID, old *Application, new *Application, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Application, new *Application, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// ApplicationProvider is a dynamic gRPC-based plugin for managing Application resources. -type ApplicationProvider struct { - ops ApplicationProviderOps -} - -// NewApplicationProvider allocates a resource provider that delegates to a ops instance. -func NewApplicationProvider(ops ApplicationProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &ApplicationProvider{ops: ops} -} - -func (p *ApplicationProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(ApplicationToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Application", "name", failure)) - } - } - if !unks["applicationName"] { - if failure := p.ops.Check(ctx, obj, "applicationName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Application", "applicationName", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Application", "description", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *ApplicationProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(ApplicationToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Application_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *ApplicationProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(ApplicationToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *ApplicationProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(ApplicationToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *ApplicationProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(ApplicationToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("applicationName") { - replaces = append(replaces, "applicationName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *ApplicationProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ApplicationToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ApplicationProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ApplicationToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ApplicationProvider) Unmarshal( - v *pbstruct.Struct) (*Application, resource.PropertyMap, error) { - var obj Application - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Application structure(s) */ - -// Application is a marshalable representation of its corresponding IDL type. -type Application struct { - Name *string `lumi:"name,optional"` - ApplicationName *string `lumi:"applicationName,optional"` - Description *string `lumi:"description,optional"` -} - -// Application's properties have constants to make dealing with diffs and property bags easier. -const ( - Application_Name = "name" - Application_ApplicationName = "applicationName" - Application_Description = "description" -) - - diff --git a/lib/aws/rpc/elasticbeanstalk/applicationVersion.go b/lib/aws/rpc/elasticbeanstalk/applicationVersion.go deleted file mode 100644 index d69d2a9c8..000000000 --- a/lib/aws/rpc/elasticbeanstalk/applicationVersion.go +++ /dev/null @@ -1,234 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package elasticbeanstalk - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for ApplicationVersion resource provider */ - -// ApplicationVersionToken is the type token corresponding to the ApplicationVersion package type. -const ApplicationVersionToken = tokens.Type("aws:elasticbeanstalk/applicationVersion:ApplicationVersion") - -// ApplicationVersionProviderOps is a pluggable interface for ApplicationVersion-related management functionality. -type ApplicationVersionProviderOps interface { - Check(ctx context.Context, obj *ApplicationVersion, property string) error - Create(ctx context.Context, obj *ApplicationVersion) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*ApplicationVersion, error) - InspectChange(ctx context.Context, - id resource.ID, old *ApplicationVersion, new *ApplicationVersion, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *ApplicationVersion, new *ApplicationVersion, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// ApplicationVersionProvider is a dynamic gRPC-based plugin for managing ApplicationVersion resources. -type ApplicationVersionProvider struct { - ops ApplicationVersionProviderOps -} - -// NewApplicationVersionProvider allocates a resource provider that delegates to a ops instance. -func NewApplicationVersionProvider(ops ApplicationVersionProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &ApplicationVersionProvider{ops: ops} -} - -func (p *ApplicationVersionProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(ApplicationVersionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ApplicationVersion", "name", failure)) - } - } - if !unks["application"] { - if failure := p.ops.Check(ctx, obj, "application"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ApplicationVersion", "application", failure)) - } - } - if !unks["versionLabel"] { - if failure := p.ops.Check(ctx, obj, "versionLabel"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ApplicationVersion", "versionLabel", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ApplicationVersion", "description", failure)) - } - } - if !unks["sourceBundle"] { - if failure := p.ops.Check(ctx, obj, "sourceBundle"); failure != nil { - failures = append(failures, - resource.NewPropertyError("ApplicationVersion", "sourceBundle", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *ApplicationVersionProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(ApplicationVersionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[ApplicationVersion_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *ApplicationVersionProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(ApplicationVersionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *ApplicationVersionProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(ApplicationVersionToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *ApplicationVersionProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(ApplicationVersionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("application") { - replaces = append(replaces, "application") - } - if diff.Changed("versionLabel") { - replaces = append(replaces, "versionLabel") - } - if diff.Changed("sourceBundle") { - replaces = append(replaces, "sourceBundle") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *ApplicationVersionProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ApplicationVersionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ApplicationVersionProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ApplicationVersionToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ApplicationVersionProvider) Unmarshal( - v *pbstruct.Struct) (*ApplicationVersion, resource.PropertyMap, error) { - var obj ApplicationVersion - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable ApplicationVersion structure(s) */ - -// ApplicationVersion is a marshalable representation of its corresponding IDL type. -type ApplicationVersion struct { - Name *string `lumi:"name,optional"` - Application resource.ID `lumi:"application"` - VersionLabel *string `lumi:"versionLabel,optional"` - Description *string `lumi:"description,optional"` - SourceBundle resource.ID `lumi:"sourceBundle"` -} - -// ApplicationVersion's properties have constants to make dealing with diffs and property bags easier. -const ( - ApplicationVersion_Name = "name" - ApplicationVersion_Application = "application" - ApplicationVersion_VersionLabel = "versionLabel" - ApplicationVersion_Description = "description" - ApplicationVersion_SourceBundle = "sourceBundle" -) - - diff --git a/lib/aws/rpc/elasticbeanstalk/environment.go b/lib/aws/rpc/elasticbeanstalk/environment.go deleted file mode 100644 index 8a6372a47..000000000 --- a/lib/aws/rpc/elasticbeanstalk/environment.go +++ /dev/null @@ -1,338 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package elasticbeanstalk - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Environment resource provider */ - -// EnvironmentToken is the type token corresponding to the Environment package type. -const EnvironmentToken = tokens.Type("aws:elasticbeanstalk/environment:Environment") - -// EnvironmentProviderOps is a pluggable interface for Environment-related management functionality. -type EnvironmentProviderOps interface { - Check(ctx context.Context, obj *Environment, property string) error - Create(ctx context.Context, obj *Environment) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Environment, error) - InspectChange(ctx context.Context, - id resource.ID, old *Environment, new *Environment, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Environment, new *Environment, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// EnvironmentProvider is a dynamic gRPC-based plugin for managing Environment resources. -type EnvironmentProvider struct { - ops EnvironmentProviderOps -} - -// NewEnvironmentProvider allocates a resource provider that delegates to a ops instance. -func NewEnvironmentProvider(ops EnvironmentProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &EnvironmentProvider{ops: ops} -} - -func (p *EnvironmentProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(EnvironmentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "name", failure)) - } - } - if !unks["application"] { - if failure := p.ops.Check(ctx, obj, "application"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "application", failure)) - } - } - if !unks["cnamePrefix"] { - if failure := p.ops.Check(ctx, obj, "cnamePrefix"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "cnamePrefix", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "description", failure)) - } - } - if !unks["environmentName"] { - if failure := p.ops.Check(ctx, obj, "environmentName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "environmentName", failure)) - } - } - if !unks["optionSettings"] { - if failure := p.ops.Check(ctx, obj, "optionSettings"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "optionSettings", failure)) - } - } - if !unks["solutionStackName"] { - if failure := p.ops.Check(ctx, obj, "solutionStackName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "solutionStackName", failure)) - } - } - if !unks["tags"] { - if failure := p.ops.Check(ctx, obj, "tags"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "tags", failure)) - } - } - if !unks["templateName"] { - if failure := p.ops.Check(ctx, obj, "templateName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "templateName", failure)) - } - } - if !unks["tier"] { - if failure := p.ops.Check(ctx, obj, "tier"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "tier", failure)) - } - } - if !unks["version"] { - if failure := p.ops.Check(ctx, obj, "version"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Environment", "version", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *EnvironmentProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(EnvironmentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Environment_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *EnvironmentProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(EnvironmentToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *EnvironmentProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(EnvironmentToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *EnvironmentProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(EnvironmentToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("application") { - replaces = append(replaces, "application") - } - if diff.Changed("cnamePrefix") { - replaces = append(replaces, "cnamePrefix") - } - if diff.Changed("environmentName") { - replaces = append(replaces, "environmentName") - } - if diff.Changed("solutionStackName") { - replaces = append(replaces, "solutionStackName") - } - if diff.Changed("tags") { - replaces = append(replaces, "tags") - } - if diff.Changed("tier") { - replaces = append(replaces, "tier") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *EnvironmentProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(EnvironmentToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *EnvironmentProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(EnvironmentToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *EnvironmentProvider) Unmarshal( - v *pbstruct.Struct) (*Environment, resource.PropertyMap, error) { - var obj Environment - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Environment structure(s) */ - -// Environment is a marshalable representation of its corresponding IDL type. -type Environment struct { - Name *string `lumi:"name,optional"` - Application resource.ID `lumi:"application"` - CNAMEPrefix *string `lumi:"cnamePrefix,optional"` - Description *string `lumi:"description,optional"` - EnvironmentName *string `lumi:"environmentName,optional"` - OptionSettings *[]OptionSetting `lumi:"optionSettings,optional"` - SolutionStackName *string `lumi:"solutionStackName,optional"` - Tags *[]Tag `lumi:"tags,optional"` - TemplateName *string `lumi:"templateName,optional"` - Tier *Tier `lumi:"tier,optional"` - Version *resource.ID `lumi:"version,optional"` - EndpointURL string `lumi:"endpointURL,optional"` - AllOptionSettings *[]OptionSetting `lumi:"allOptionSettings,optional"` -} - -// Environment's properties have constants to make dealing with diffs and property bags easier. -const ( - Environment_Name = "name" - Environment_Application = "application" - Environment_CNAMEPrefix = "cnamePrefix" - Environment_Description = "description" - Environment_EnvironmentName = "environmentName" - Environment_OptionSettings = "optionSettings" - Environment_SolutionStackName = "solutionStackName" - Environment_Tags = "tags" - Environment_TemplateName = "templateName" - Environment_Tier = "tier" - Environment_Version = "version" - Environment_EndpointURL = "endpointURL" - Environment_AllOptionSettings = "allOptionSettings" -) - -/* Marshalable OptionSetting structure(s) */ - -// OptionSetting is a marshalable representation of its corresponding IDL type. -type OptionSetting struct { - Namespace string `lumi:"namespace"` - OptionName string `lumi:"optionName"` - Value string `lumi:"value"` -} - -// OptionSetting's properties have constants to make dealing with diffs and property bags easier. -const ( - OptionSetting_Namespace = "namespace" - OptionSetting_OptionName = "optionName" - OptionSetting_Value = "value" -) - -/* Marshalable Tag structure(s) */ - -// Tag is a marshalable representation of its corresponding IDL type. -type Tag struct { - Key string `lumi:"key"` - Value string `lumi:"value"` -} - -// Tag's properties have constants to make dealing with diffs and property bags easier. -const ( - Tag_Key = "key" - Tag_Value = "value" -) - -/* Typedefs */ - -type ( - Tier string -) - -/* Constants */ - -const ( - WebServerTier Tier = "WebServer::Standard::1.0" - WorkerTier Tier = "Worker::SQS/HTTP::1.0" -) - - diff --git a/lib/aws/rpc/iam/group.go b/lib/aws/rpc/iam/group.go deleted file mode 100644 index 9a926e3d0..000000000 --- a/lib/aws/rpc/iam/group.go +++ /dev/null @@ -1,228 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package iam - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Group resource provider */ - -// GroupToken is the type token corresponding to the Group package type. -const GroupToken = tokens.Type("aws:iam/group:Group") - -// GroupProviderOps is a pluggable interface for Group-related management functionality. -type GroupProviderOps interface { - Check(ctx context.Context, obj *Group, property string) error - Create(ctx context.Context, obj *Group) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Group, error) - InspectChange(ctx context.Context, - id resource.ID, old *Group, new *Group, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Group, new *Group, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// GroupProvider is a dynamic gRPC-based plugin for managing Group resources. -type GroupProvider struct { - ops GroupProviderOps -} - -// NewGroupProvider allocates a resource provider that delegates to a ops instance. -func NewGroupProvider(ops GroupProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &GroupProvider{ops: ops} -} - -func (p *GroupProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(GroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Group", "name", failure)) - } - } - if !unks["groupName"] { - if failure := p.ops.Check(ctx, obj, "groupName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Group", "groupName", failure)) - } - } - if !unks["managedPolicies"] { - if failure := p.ops.Check(ctx, obj, "managedPolicies"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Group", "managedPolicies", failure)) - } - } - if !unks["path"] { - if failure := p.ops.Check(ctx, obj, "path"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Group", "path", failure)) - } - } - if !unks["policies"] { - if failure := p.ops.Check(ctx, obj, "policies"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Group", "policies", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *GroupProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(GroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Group_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *GroupProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(GroupToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *GroupProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(GroupToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *GroupProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(GroupToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("groupName") { - replaces = append(replaces, "groupName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *GroupProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(GroupToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *GroupProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(GroupToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *GroupProvider) Unmarshal( - v *pbstruct.Struct) (*Group, resource.PropertyMap, error) { - var obj Group - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Group structure(s) */ - -// Group is a marshalable representation of its corresponding IDL type. -type Group struct { - Name *string `lumi:"name,optional"` - GroupName *string `lumi:"groupName,optional"` - ManagedPolicies *[]resource.ID `lumi:"managedPolicies,optional"` - Path *string `lumi:"path,optional"` - Policies *InlinePolicy `lumi:"policies,optional"` -} - -// Group's properties have constants to make dealing with diffs and property bags easier. -const ( - Group_Name = "name" - Group_GroupName = "groupName" - Group_ManagedPolicies = "managedPolicies" - Group_Path = "path" - Group_Policies = "policies" -) - - diff --git a/lib/aws/rpc/iam/instanceprofile.go b/lib/aws/rpc/iam/instanceprofile.go deleted file mode 100644 index 51655b64b..000000000 --- a/lib/aws/rpc/iam/instanceprofile.go +++ /dev/null @@ -1,227 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package iam - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - - __aws "github.com/pulumi/lumi/lib/aws/rpc" -) - -/* RPC stubs for InstanceProfile resource provider */ - -// InstanceProfileToken is the type token corresponding to the InstanceProfile package type. -const InstanceProfileToken = tokens.Type("aws:iam/instanceprofile:InstanceProfile") - -// InstanceProfileProviderOps is a pluggable interface for InstanceProfile-related management functionality. -type InstanceProfileProviderOps interface { - Check(ctx context.Context, obj *InstanceProfile, property string) error - Create(ctx context.Context, obj *InstanceProfile) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*InstanceProfile, error) - InspectChange(ctx context.Context, - id resource.ID, old *InstanceProfile, new *InstanceProfile, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *InstanceProfile, new *InstanceProfile, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// InstanceProfileProvider is a dynamic gRPC-based plugin for managing InstanceProfile resources. -type InstanceProfileProvider struct { - ops InstanceProfileProviderOps -} - -// NewInstanceProfileProvider allocates a resource provider that delegates to a ops instance. -func NewInstanceProfileProvider(ops InstanceProfileProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &InstanceProfileProvider{ops: ops} -} - -func (p *InstanceProfileProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(InstanceProfileToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("InstanceProfile", "name", failure)) - } - } - if !unks["path"] { - if failure := p.ops.Check(ctx, obj, "path"); failure != nil { - failures = append(failures, - resource.NewPropertyError("InstanceProfile", "path", failure)) - } - } - if !unks["instanceProfileName"] { - if failure := p.ops.Check(ctx, obj, "instanceProfileName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("InstanceProfile", "instanceProfileName", failure)) - } - } - if !unks["roles"] { - if failure := p.ops.Check(ctx, obj, "roles"); failure != nil { - failures = append(failures, - resource.NewPropertyError("InstanceProfile", "roles", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *InstanceProfileProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(InstanceProfileToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[InstanceProfile_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *InstanceProfileProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(InstanceProfileToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *InstanceProfileProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(InstanceProfileToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *InstanceProfileProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(InstanceProfileToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("path") { - replaces = append(replaces, "path") - } - if diff.Changed("instanceProfileName") { - replaces = append(replaces, "instanceProfileName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *InstanceProfileProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(InstanceProfileToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *InstanceProfileProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(InstanceProfileToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *InstanceProfileProvider) Unmarshal( - v *pbstruct.Struct) (*InstanceProfile, resource.PropertyMap, error) { - var obj InstanceProfile - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable InstanceProfile structure(s) */ - -// InstanceProfile is a marshalable representation of its corresponding IDL type. -type InstanceProfile struct { - Name *string `lumi:"name,optional"` - Path *string `lumi:"path,optional"` - InstanceProfileName *string `lumi:"instanceProfileName,optional"` - Roles []resource.ID `lumi:"roles"` - ARN __aws.ARN `lumi:"arn,optional"` -} - -// InstanceProfile's properties have constants to make dealing with diffs and property bags easier. -const ( - InstanceProfile_Name = "name" - InstanceProfile_Path = "path" - InstanceProfile_InstanceProfileName = "instanceProfileName" - InstanceProfile_Roles = "roles" - InstanceProfile_ARN = "arn" -) - - diff --git a/lib/aws/rpc/iam/policy.go b/lib/aws/rpc/iam/policy.go deleted file mode 100644 index 13f88406f..000000000 --- a/lib/aws/rpc/iam/policy.go +++ /dev/null @@ -1,247 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package iam - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* Marshalable InlinePolicy structure(s) */ - -// InlinePolicy is a marshalable representation of its corresponding IDL type. -type InlinePolicy struct { - PolicyDocument interface{} `lumi:"policyDocument"` - PolicyName string `lumi:"policyName"` -} - -// InlinePolicy's properties have constants to make dealing with diffs and property bags easier. -const ( - InlinePolicy_PolicyDocument = "policyDocument" - InlinePolicy_PolicyName = "policyName" -) - -/* RPC stubs for Policy resource provider */ - -// PolicyToken is the type token corresponding to the Policy package type. -const PolicyToken = tokens.Type("aws:iam/policy:Policy") - -// PolicyProviderOps is a pluggable interface for Policy-related management functionality. -type PolicyProviderOps interface { - Check(ctx context.Context, obj *Policy, property string) error - Create(ctx context.Context, obj *Policy) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Policy, error) - InspectChange(ctx context.Context, - id resource.ID, old *Policy, new *Policy, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Policy, new *Policy, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// PolicyProvider is a dynamic gRPC-based plugin for managing Policy resources. -type PolicyProvider struct { - ops PolicyProviderOps -} - -// NewPolicyProvider allocates a resource provider that delegates to a ops instance. -func NewPolicyProvider(ops PolicyProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &PolicyProvider{ops: ops} -} - -func (p *PolicyProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(PolicyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Policy", "name", failure)) - } - } - if !unks["policyDocument"] { - if failure := p.ops.Check(ctx, obj, "policyDocument"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Policy", "policyDocument", failure)) - } - } - if !unks["policyName"] { - if failure := p.ops.Check(ctx, obj, "policyName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Policy", "policyName", failure)) - } - } - if !unks["groups"] { - if failure := p.ops.Check(ctx, obj, "groups"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Policy", "groups", failure)) - } - } - if !unks["roles"] { - if failure := p.ops.Check(ctx, obj, "roles"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Policy", "roles", failure)) - } - } - if !unks["users"] { - if failure := p.ops.Check(ctx, obj, "users"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Policy", "users", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *PolicyProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(PolicyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Policy_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *PolicyProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(PolicyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *PolicyProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(PolicyToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *PolicyProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(PolicyToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *PolicyProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(PolicyToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *PolicyProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(PolicyToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *PolicyProvider) Unmarshal( - v *pbstruct.Struct) (*Policy, resource.PropertyMap, error) { - var obj Policy - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Policy structure(s) */ - -// Policy is a marshalable representation of its corresponding IDL type. -type Policy struct { - Name *string `lumi:"name,optional"` - PolicyDocument interface{} `lumi:"policyDocument"` - PolicyName string `lumi:"policyName"` - Groups *[]resource.ID `lumi:"groups,optional"` - Roles *[]resource.ID `lumi:"roles,optional"` - Users *[]resource.ID `lumi:"users,optional"` -} - -// Policy's properties have constants to make dealing with diffs and property bags easier. -const ( - Policy_Name = "name" - Policy_PolicyDocument = "policyDocument" - Policy_PolicyName = "policyName" - Policy_Groups = "groups" - Policy_Roles = "roles" - Policy_Users = "users" -) - - diff --git a/lib/aws/rpc/iam/role.go b/lib/aws/rpc/iam/role.go deleted file mode 100644 index 64dcfb7f6..000000000 --- a/lib/aws/rpc/iam/role.go +++ /dev/null @@ -1,243 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package iam - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - - __aws "github.com/pulumi/lumi/lib/aws/rpc" -) - -/* RPC stubs for Role resource provider */ - -// RoleToken is the type token corresponding to the Role package type. -const RoleToken = tokens.Type("aws:iam/role:Role") - -// RoleProviderOps is a pluggable interface for Role-related management functionality. -type RoleProviderOps interface { - Check(ctx context.Context, obj *Role, property string) error - Create(ctx context.Context, obj *Role) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Role, error) - InspectChange(ctx context.Context, - id resource.ID, old *Role, new *Role, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Role, new *Role, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// RoleProvider is a dynamic gRPC-based plugin for managing Role resources. -type RoleProvider struct { - ops RoleProviderOps -} - -// NewRoleProvider allocates a resource provider that delegates to a ops instance. -func NewRoleProvider(ops RoleProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &RoleProvider{ops: ops} -} - -func (p *RoleProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(RoleToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Role", "name", failure)) - } - } - if !unks["assumeRolePolicyDocument"] { - if failure := p.ops.Check(ctx, obj, "assumeRolePolicyDocument"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Role", "assumeRolePolicyDocument", failure)) - } - } - if !unks["path"] { - if failure := p.ops.Check(ctx, obj, "path"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Role", "path", failure)) - } - } - if !unks["roleName"] { - if failure := p.ops.Check(ctx, obj, "roleName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Role", "roleName", failure)) - } - } - if !unks["managedPolicyARNs"] { - if failure := p.ops.Check(ctx, obj, "managedPolicyARNs"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Role", "managedPolicyARNs", failure)) - } - } - if !unks["policies"] { - if failure := p.ops.Check(ctx, obj, "policies"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Role", "policies", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *RoleProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(RoleToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Role_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *RoleProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(RoleToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *RoleProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(RoleToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *RoleProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(RoleToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("path") { - replaces = append(replaces, "path") - } - if diff.Changed("roleName") { - replaces = append(replaces, "roleName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *RoleProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(RoleToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *RoleProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(RoleToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *RoleProvider) Unmarshal( - v *pbstruct.Struct) (*Role, resource.PropertyMap, error) { - var obj Role - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Role structure(s) */ - -// Role is a marshalable representation of its corresponding IDL type. -type Role struct { - Name *string `lumi:"name,optional"` - AssumeRolePolicyDocument interface{} `lumi:"assumeRolePolicyDocument"` - Path *string `lumi:"path,optional"` - RoleName *string `lumi:"roleName,optional"` - ManagedPolicyARNs *[]__aws.ARN `lumi:"managedPolicyARNs,optional"` - Policies *[]InlinePolicy `lumi:"policies,optional"` - ARN __aws.ARN `lumi:"arn,optional"` -} - -// Role's properties have constants to make dealing with diffs and property bags easier. -const ( - Role_Name = "name" - Role_AssumeRolePolicyDocument = "assumeRolePolicyDocument" - Role_Path = "path" - Role_RoleName = "roleName" - Role_ManagedPolicyARNs = "managedPolicyARNs" - Role_Policies = "policies" - Role_ARN = "arn" -) - - diff --git a/lib/aws/rpc/iam/user.go b/lib/aws/rpc/iam/user.go deleted file mode 100644 index 8856f8513..000000000 --- a/lib/aws/rpc/iam/user.go +++ /dev/null @@ -1,258 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package iam - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* Marshalable LoginProfile structure(s) */ - -// LoginProfile is a marshalable representation of its corresponding IDL type. -type LoginProfile struct { - Password string `lumi:"password"` - PasswordResetRequired *bool `lumi:"passwordResetRequired,optional"` -} - -// LoginProfile's properties have constants to make dealing with diffs and property bags easier. -const ( - LoginProfile_Password = "password" - LoginProfile_PasswordResetRequired = "passwordResetRequired" -) - -/* RPC stubs for User resource provider */ - -// UserToken is the type token corresponding to the User package type. -const UserToken = tokens.Type("aws:iam/user:User") - -// UserProviderOps is a pluggable interface for User-related management functionality. -type UserProviderOps interface { - Check(ctx context.Context, obj *User, property string) error - Create(ctx context.Context, obj *User) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*User, error) - InspectChange(ctx context.Context, - id resource.ID, old *User, new *User, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *User, new *User, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// UserProvider is a dynamic gRPC-based plugin for managing User resources. -type UserProvider struct { - ops UserProviderOps -} - -// NewUserProvider allocates a resource provider that delegates to a ops instance. -func NewUserProvider(ops UserProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &UserProvider{ops: ops} -} - -func (p *UserProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(UserToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("User", "name", failure)) - } - } - if !unks["userName"] { - if failure := p.ops.Check(ctx, obj, "userName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("User", "userName", failure)) - } - } - if !unks["groups"] { - if failure := p.ops.Check(ctx, obj, "groups"); failure != nil { - failures = append(failures, - resource.NewPropertyError("User", "groups", failure)) - } - } - if !unks["loginProfile"] { - if failure := p.ops.Check(ctx, obj, "loginProfile"); failure != nil { - failures = append(failures, - resource.NewPropertyError("User", "loginProfile", failure)) - } - } - if !unks["managedPolicies"] { - if failure := p.ops.Check(ctx, obj, "managedPolicies"); failure != nil { - failures = append(failures, - resource.NewPropertyError("User", "managedPolicies", failure)) - } - } - if !unks["path"] { - if failure := p.ops.Check(ctx, obj, "path"); failure != nil { - failures = append(failures, - resource.NewPropertyError("User", "path", failure)) - } - } - if !unks["policies"] { - if failure := p.ops.Check(ctx, obj, "policies"); failure != nil { - failures = append(failures, - resource.NewPropertyError("User", "policies", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *UserProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(UserToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[User_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *UserProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(UserToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *UserProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(UserToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *UserProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(UserToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("userName") { - replaces = append(replaces, "userName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *UserProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(UserToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *UserProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(UserToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *UserProvider) Unmarshal( - v *pbstruct.Struct) (*User, resource.PropertyMap, error) { - var obj User - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable User structure(s) */ - -// User is a marshalable representation of its corresponding IDL type. -type User struct { - Name *string `lumi:"name,optional"` - UserName *string `lumi:"userName,optional"` - Groups *[]resource.ID `lumi:"groups,optional"` - LoginProfile *LoginProfile `lumi:"loginProfile,optional"` - ManagedPolicies *[]resource.ID `lumi:"managedPolicies,optional"` - Path *string `lumi:"path,optional"` - Policies *[]InlinePolicy `lumi:"policies,optional"` -} - -// User's properties have constants to make dealing with diffs and property bags easier. -const ( - User_Name = "name" - User_UserName = "userName" - User_Groups = "groups" - User_LoginProfile = "loginProfile" - User_ManagedPolicies = "managedPolicies" - User_Path = "path" - User_Policies = "policies" -) - - diff --git a/lib/aws/rpc/kms/key.go b/lib/aws/rpc/kms/key.go deleted file mode 100644 index cb476fe71..000000000 --- a/lib/aws/rpc/kms/key.go +++ /dev/null @@ -1,225 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package kms - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Key resource provider */ - -// KeyToken is the type token corresponding to the Key package type. -const KeyToken = tokens.Type("aws:kms/key:Key") - -// KeyProviderOps is a pluggable interface for Key-related management functionality. -type KeyProviderOps interface { - Check(ctx context.Context, obj *Key, property string) error - Create(ctx context.Context, obj *Key) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Key, error) - InspectChange(ctx context.Context, - id resource.ID, old *Key, new *Key, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Key, new *Key, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// KeyProvider is a dynamic gRPC-based plugin for managing Key resources. -type KeyProvider struct { - ops KeyProviderOps -} - -// NewKeyProvider allocates a resource provider that delegates to a ops instance. -func NewKeyProvider(ops KeyProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &KeyProvider{ops: ops} -} - -func (p *KeyProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(KeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Key", "name", failure)) - } - } - if !unks["keyPolicy"] { - if failure := p.ops.Check(ctx, obj, "keyPolicy"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Key", "keyPolicy", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Key", "description", failure)) - } - } - if !unks["enabled"] { - if failure := p.ops.Check(ctx, obj, "enabled"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Key", "enabled", failure)) - } - } - if !unks["enableKeyRotation"] { - if failure := p.ops.Check(ctx, obj, "enableKeyRotation"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Key", "enableKeyRotation", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *KeyProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(KeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Key_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *KeyProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(KeyToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *KeyProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(KeyToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *KeyProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(KeyToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *KeyProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(KeyToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *KeyProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(KeyToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *KeyProvider) Unmarshal( - v *pbstruct.Struct) (*Key, resource.PropertyMap, error) { - var obj Key - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Key structure(s) */ - -// Key is a marshalable representation of its corresponding IDL type. -type Key struct { - Name *string `lumi:"name,optional"` - KeyPolicy interface{} `lumi:"keyPolicy"` - Description *string `lumi:"description,optional"` - Enabled *bool `lumi:"enabled,optional"` - EnableKeyRotation *bool `lumi:"enableKeyRotation,optional"` -} - -// Key's properties have constants to make dealing with diffs and property bags easier. -const ( - Key_Name = "name" - Key_KeyPolicy = "keyPolicy" - Key_Description = "description" - Key_Enabled = "enabled" - Key_EnableKeyRotation = "enableKeyRotation" -) - - diff --git a/lib/aws/rpc/lambda/function.go b/lib/aws/rpc/lambda/function.go deleted file mode 100644 index 2fd8a9032..000000000 --- a/lib/aws/rpc/lambda/function.go +++ /dev/null @@ -1,344 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package lambda - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - - __aws "github.com/pulumi/lumi/lib/aws/rpc" -) - -/* Marshalable DeadLetterConfig structure(s) */ - -// DeadLetterConfig is a marshalable representation of its corresponding IDL type. -type DeadLetterConfig struct { - Target resource.ID `lumi:"target"` -} - -// DeadLetterConfig's properties have constants to make dealing with diffs and property bags easier. -const ( - DeadLetterConfig_Target = "target" -) - -/* RPC stubs for Function resource provider */ - -// FunctionToken is the type token corresponding to the Function package type. -const FunctionToken = tokens.Type("aws:lambda/function:Function") - -// FunctionProviderOps is a pluggable interface for Function-related management functionality. -type FunctionProviderOps interface { - Check(ctx context.Context, obj *Function, property string) error - Create(ctx context.Context, obj *Function) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Function, error) - InspectChange(ctx context.Context, - id resource.ID, old *Function, new *Function, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Function, new *Function, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// FunctionProvider is a dynamic gRPC-based plugin for managing Function resources. -type FunctionProvider struct { - ops FunctionProviderOps -} - -// NewFunctionProvider allocates a resource provider that delegates to a ops instance. -func NewFunctionProvider(ops FunctionProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &FunctionProvider{ops: ops} -} - -func (p *FunctionProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(FunctionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "name", failure)) - } - } - if !unks["code"] { - if failure := p.ops.Check(ctx, obj, "code"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "code", failure)) - } - } - if !unks["handler"] { - if failure := p.ops.Check(ctx, obj, "handler"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "handler", failure)) - } - } - if !unks["role"] { - if failure := p.ops.Check(ctx, obj, "role"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "role", failure)) - } - } - if !unks["runtime"] { - if failure := p.ops.Check(ctx, obj, "runtime"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "runtime", failure)) - } - } - if !unks["functionName"] { - if failure := p.ops.Check(ctx, obj, "functionName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "functionName", failure)) - } - } - if !unks["deadLetterConfig"] { - if failure := p.ops.Check(ctx, obj, "deadLetterConfig"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "deadLetterConfig", failure)) - } - } - if !unks["description"] { - if failure := p.ops.Check(ctx, obj, "description"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "description", failure)) - } - } - if !unks["environment"] { - if failure := p.ops.Check(ctx, obj, "environment"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "environment", failure)) - } - } - if !unks["kmsKey"] { - if failure := p.ops.Check(ctx, obj, "kmsKey"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "kmsKey", failure)) - } - } - if !unks["memorySize"] { - if failure := p.ops.Check(ctx, obj, "memorySize"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "memorySize", failure)) - } - } - if !unks["timeout"] { - if failure := p.ops.Check(ctx, obj, "timeout"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "timeout", failure)) - } - } - if !unks["vpcConfig"] { - if failure := p.ops.Check(ctx, obj, "vpcConfig"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Function", "vpcConfig", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *FunctionProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(FunctionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Function_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *FunctionProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(FunctionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *FunctionProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(FunctionToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *FunctionProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(FunctionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *FunctionProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(FunctionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *FunctionProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(FunctionToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *FunctionProvider) Unmarshal( - v *pbstruct.Struct) (*Function, resource.PropertyMap, error) { - var obj Function - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Function structure(s) */ - -// Function is a marshalable representation of its corresponding IDL type. -type Function struct { - Name *string `lumi:"name,optional"` - Code resource.Archive `lumi:"code"` - Handler string `lumi:"handler"` - Role resource.ID `lumi:"role"` - Runtime Runtime `lumi:"runtime"` - FunctionName *string `lumi:"functionName,optional"` - DeadLetterConfig *DeadLetterConfig `lumi:"deadLetterConfig,optional"` - Description *string `lumi:"description,optional"` - Environment *Environment `lumi:"environment,optional"` - KMSKey *resource.ID `lumi:"kmsKey,optional"` - MemorySize *float64 `lumi:"memorySize,optional"` - Timeout *float64 `lumi:"timeout,optional"` - VPCConfig *VPCConfig `lumi:"vpcConfig,optional"` - ARN __aws.ARN `lumi:"arn,optional"` - Version string `lumi:"version,optional"` - CodeSHA256 string `lumi:"codeSHA256,optional"` - LastModified string `lumi:"lastModified,optional"` -} - -// Function's properties have constants to make dealing with diffs and property bags easier. -const ( - Function_Name = "name" - Function_Code = "code" - Function_Handler = "handler" - Function_Role = "role" - Function_Runtime = "runtime" - Function_FunctionName = "functionName" - Function_DeadLetterConfig = "deadLetterConfig" - Function_Description = "description" - Function_Environment = "environment" - Function_KMSKey = "kmsKey" - Function_MemorySize = "memorySize" - Function_Timeout = "timeout" - Function_VPCConfig = "vpcConfig" - Function_ARN = "arn" - Function_Version = "version" - Function_CodeSHA256 = "codeSHA256" - Function_LastModified = "lastModified" -) - -/* Marshalable VPCConfig structure(s) */ - -// VPCConfig is a marshalable representation of its corresponding IDL type. -type VPCConfig struct { - SecurityGroups []resource.ID `lumi:"securityGroups"` - Subnets []resource.ID `lumi:"subnets"` -} - -// VPCConfig's properties have constants to make dealing with diffs and property bags easier. -const ( - VPCConfig_SecurityGroups = "securityGroups" - VPCConfig_Subnets = "subnets" -) - -/* Typedefs */ - -type ( - Environment map[string]string - Runtime string -) - -/* Constants */ - -const ( - DotnetCore1d0Runtime Runtime = "dotnetcore1.0" - Java8Runtime Runtime = "java8" - NodeJS4d3EdgeRuntime Runtime = "nodejs4.3-edge" - NodeJS4d3Runtime Runtime = "nodejs4.3" - NodeJS6d10Runtime Runtime = "nodejs6.10" - NodeJSRuntime Runtime = "nodejs" - Python2d7Runtime Runtime = "python2.7" -) - - diff --git a/lib/aws/rpc/lambda/permission.go b/lib/aws/rpc/lambda/permission.go deleted file mode 100644 index d0fb51e1b..000000000 --- a/lib/aws/rpc/lambda/permission.go +++ /dev/null @@ -1,250 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package lambda - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" - - __aws "github.com/pulumi/lumi/lib/aws/rpc" -) - -/* RPC stubs for Permission resource provider */ - -// PermissionToken is the type token corresponding to the Permission package type. -const PermissionToken = tokens.Type("aws:lambda/permission:Permission") - -// PermissionProviderOps is a pluggable interface for Permission-related management functionality. -type PermissionProviderOps interface { - Check(ctx context.Context, obj *Permission, property string) error - Create(ctx context.Context, obj *Permission) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Permission, error) - InspectChange(ctx context.Context, - id resource.ID, old *Permission, new *Permission, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Permission, new *Permission, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// PermissionProvider is a dynamic gRPC-based plugin for managing Permission resources. -type PermissionProvider struct { - ops PermissionProviderOps -} - -// NewPermissionProvider allocates a resource provider that delegates to a ops instance. -func NewPermissionProvider(ops PermissionProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &PermissionProvider{ops: ops} -} - -func (p *PermissionProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(PermissionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Permission", "name", failure)) - } - } - if !unks["action"] { - if failure := p.ops.Check(ctx, obj, "action"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Permission", "action", failure)) - } - } - if !unks["function"] { - if failure := p.ops.Check(ctx, obj, "function"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Permission", "function", failure)) - } - } - if !unks["principal"] { - if failure := p.ops.Check(ctx, obj, "principal"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Permission", "principal", failure)) - } - } - if !unks["sourceAccount"] { - if failure := p.ops.Check(ctx, obj, "sourceAccount"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Permission", "sourceAccount", failure)) - } - } - if !unks["sourceARN"] { - if failure := p.ops.Check(ctx, obj, "sourceARN"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Permission", "sourceARN", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *PermissionProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(PermissionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Permission_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *PermissionProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(PermissionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *PermissionProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(PermissionToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *PermissionProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(PermissionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("action") { - replaces = append(replaces, "action") - } - if diff.Changed("function") { - replaces = append(replaces, "function") - } - if diff.Changed("principal") { - replaces = append(replaces, "principal") - } - if diff.Changed("sourceAccount") { - replaces = append(replaces, "sourceAccount") - } - if diff.Changed("sourceARN") { - replaces = append(replaces, "sourceARN") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *PermissionProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(PermissionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *PermissionProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(PermissionToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *PermissionProvider) Unmarshal( - v *pbstruct.Struct) (*Permission, resource.PropertyMap, error) { - var obj Permission - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Permission structure(s) */ - -// Permission is a marshalable representation of its corresponding IDL type. -type Permission struct { - Name *string `lumi:"name,optional"` - Action string `lumi:"action"` - Function resource.ID `lumi:"function"` - Principal string `lumi:"principal"` - SourceAccount *string `lumi:"sourceAccount,optional"` - SourceARN *__aws.ARN `lumi:"sourceARN,optional"` -} - -// Permission's properties have constants to make dealing with diffs and property bags easier. -const ( - Permission_Name = "name" - Permission_Action = "action" - Permission_Function = "function" - Permission_Principal = "principal" - Permission_SourceAccount = "sourceAccount" - Permission_SourceARN = "sourceARN" -) - - diff --git a/lib/aws/rpc/s3/acl.go b/lib/aws/rpc/s3/acl.go deleted file mode 100644 index d0b49d8e1..000000000 --- a/lib/aws/rpc/s3/acl.go +++ /dev/null @@ -1,25 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package s3 - -/* Typedefs */ - -type ( - CannedACL string -) - -/* Constants */ - -const ( - AWSExecReadACL CannedACL = "aws-exec-read" - AuthenticatedReadACL CannedACL = "authenticated-read" - BucketOwnerFullControlACL CannedACL = "bucket-owner-full-control" - BucketOwnerReadACL CannedACL = "bucket-owner-read" - LogDeliveryWriteACL CannedACL = "log-delivery-write" - PrivateACL CannedACL = "private" - PublicReadACL CannedACL = "public-read" - PublicReadWriteACL CannedACL = "public-read-write" -) - - diff --git a/lib/aws/rpc/s3/bucket.go b/lib/aws/rpc/s3/bucket.go deleted file mode 100644 index 11afc9dc5..000000000 --- a/lib/aws/rpc/s3/bucket.go +++ /dev/null @@ -1,212 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package s3 - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Bucket resource provider */ - -// BucketToken is the type token corresponding to the Bucket package type. -const BucketToken = tokens.Type("aws:s3/bucket:Bucket") - -// BucketProviderOps is a pluggable interface for Bucket-related management functionality. -type BucketProviderOps interface { - Check(ctx context.Context, obj *Bucket, property string) error - Create(ctx context.Context, obj *Bucket) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Bucket, error) - InspectChange(ctx context.Context, - id resource.ID, old *Bucket, new *Bucket, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Bucket, new *Bucket, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// BucketProvider is a dynamic gRPC-based plugin for managing Bucket resources. -type BucketProvider struct { - ops BucketProviderOps -} - -// NewBucketProvider allocates a resource provider that delegates to a ops instance. -func NewBucketProvider(ops BucketProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &BucketProvider{ops: ops} -} - -func (p *BucketProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(BucketToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Bucket", "name", failure)) - } - } - if !unks["bucketName"] { - if failure := p.ops.Check(ctx, obj, "bucketName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Bucket", "bucketName", failure)) - } - } - if !unks["accessControl"] { - if failure := p.ops.Check(ctx, obj, "accessControl"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Bucket", "accessControl", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *BucketProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(BucketToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Bucket_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *BucketProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(BucketToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *BucketProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(BucketToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *BucketProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(BucketToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("bucketName") { - replaces = append(replaces, "bucketName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *BucketProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(BucketToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *BucketProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(BucketToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *BucketProvider) Unmarshal( - v *pbstruct.Struct) (*Bucket, resource.PropertyMap, error) { - var obj Bucket - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Bucket structure(s) */ - -// Bucket is a marshalable representation of its corresponding IDL type. -type Bucket struct { - Name *string `lumi:"name,optional"` - BucketName *string `lumi:"bucketName,optional"` - AccessControl *CannedACL `lumi:"accessControl,optional"` -} - -// Bucket's properties have constants to make dealing with diffs and property bags easier. -const ( - Bucket_Name = "name" - Bucket_BucketName = "bucketName" - Bucket_AccessControl = "accessControl" -) - - diff --git a/lib/aws/rpc/s3/object.go b/lib/aws/rpc/s3/object.go deleted file mode 100644 index 7b67c1739..000000000 --- a/lib/aws/rpc/s3/object.go +++ /dev/null @@ -1,254 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package s3 - -import ( - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Object resource provider */ - -// ObjectToken is the type token corresponding to the Object package type. -const ObjectToken = tokens.Type("aws:s3/object:Object") - -// ObjectProviderOps is a pluggable interface for Object-related management functionality. -type ObjectProviderOps interface { - Check(ctx context.Context, obj *Object, property string) error - Name(ctx context.Context, obj *Object) (string, error) - Create(ctx context.Context, obj *Object) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Object, error) - InspectChange(ctx context.Context, - id resource.ID, old *Object, new *Object, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Object, new *Object, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// ObjectProvider is a dynamic gRPC-based plugin for managing Object resources. -type ObjectProvider struct { - ops ObjectProviderOps -} - -// NewObjectProvider allocates a resource provider that delegates to a ops instance. -func NewObjectProvider(ops ObjectProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &ObjectProvider{ops: ops} -} - -func (p *ObjectProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(ObjectToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["key"] { - if failure := p.ops.Check(ctx, obj, "key"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "key", failure)) - } - } - if !unks["bucket"] { - if failure := p.ops.Check(ctx, obj, "bucket"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "bucket", failure)) - } - } - if !unks["source"] { - if failure := p.ops.Check(ctx, obj, "source"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "source", failure)) - } - } - if !unks["contentType"] { - if failure := p.ops.Check(ctx, obj, "contentType"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "contentType", failure)) - } - } - if !unks["contentDisposition"] { - if failure := p.ops.Check(ctx, obj, "contentDisposition"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "contentDisposition", failure)) - } - } - if !unks["cacheControl"] { - if failure := p.ops.Check(ctx, obj, "cacheControl"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "cacheControl", failure)) - } - } - if !unks["contentEncoding"] { - if failure := p.ops.Check(ctx, obj, "contentEncoding"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "contentEncoding", failure)) - } - } - if !unks["contentLanguage"] { - if failure := p.ops.Check(ctx, obj, "contentLanguage"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "contentLanguage", failure)) - } - } - if !unks["contentLength"] { - if failure := p.ops.Check(ctx, obj, "contentLength"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Object", "contentLength", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *ObjectProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(ObjectToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - name, err := p.ops.Name(ctx, obj) - return &lumirpc.NameResponse{Name: name}, err -} - -func (p *ObjectProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(ObjectToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *ObjectProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(ObjectToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *ObjectProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(ObjectToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("key") { - replaces = append(replaces, "key") - } - if diff.Changed("bucket") { - replaces = append(replaces, "bucket") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *ObjectProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ObjectToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ObjectProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(ObjectToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *ObjectProvider) Unmarshal( - v *pbstruct.Struct) (*Object, resource.PropertyMap, error) { - var obj Object - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Object structure(s) */ - -// Object is a marshalable representation of its corresponding IDL type. -type Object struct { - Key string `lumi:"key"` - Bucket resource.ID `lumi:"bucket"` - Source *resource.Asset `lumi:"source,optional"` - ContentType *string `lumi:"contentType,optional"` - ContentDisposition *string `lumi:"contentDisposition,optional"` - CacheControl *string `lumi:"cacheControl,optional"` - ContentEncoding *string `lumi:"contentEncoding,optional"` - ContentLanguage *string `lumi:"contentLanguage,optional"` - ContentLength *float64 `lumi:"contentLength,optional"` -} - -// Object's properties have constants to make dealing with diffs and property bags easier. -const ( - Object_Key = "key" - Object_Bucket = "bucket" - Object_Source = "source" - Object_ContentType = "contentType" - Object_ContentDisposition = "contentDisposition" - Object_CacheControl = "cacheControl" - Object_ContentEncoding = "contentEncoding" - Object_ContentLanguage = "contentLanguage" - Object_ContentLength = "contentLength" -) - - diff --git a/lib/aws/rpc/sns/subscription.go b/lib/aws/rpc/sns/subscription.go deleted file mode 100644 index 13c4e4f75..000000000 --- a/lib/aws/rpc/sns/subscription.go +++ /dev/null @@ -1,245 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package sns - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Subscription resource provider */ - -// SubscriptionToken is the type token corresponding to the Subscription package type. -const SubscriptionToken = tokens.Type("aws:sns/subscription:Subscription") - -// SubscriptionProviderOps is a pluggable interface for Subscription-related management functionality. -type SubscriptionProviderOps interface { - Check(ctx context.Context, obj *Subscription, property string) error - Create(ctx context.Context, obj *Subscription) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Subscription, error) - InspectChange(ctx context.Context, - id resource.ID, old *Subscription, new *Subscription, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Subscription, new *Subscription, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// SubscriptionProvider is a dynamic gRPC-based plugin for managing Subscription resources. -type SubscriptionProvider struct { - ops SubscriptionProviderOps -} - -// NewSubscriptionProvider allocates a resource provider that delegates to a ops instance. -func NewSubscriptionProvider(ops SubscriptionProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &SubscriptionProvider{ops: ops} -} - -func (p *SubscriptionProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(SubscriptionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subscription", "name", failure)) - } - } - if !unks["topic"] { - if failure := p.ops.Check(ctx, obj, "topic"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subscription", "topic", failure)) - } - } - if !unks["protocol"] { - if failure := p.ops.Check(ctx, obj, "protocol"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subscription", "protocol", failure)) - } - } - if !unks["endpoint"] { - if failure := p.ops.Check(ctx, obj, "endpoint"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Subscription", "endpoint", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *SubscriptionProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(SubscriptionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Subscription_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *SubscriptionProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(SubscriptionToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *SubscriptionProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(SubscriptionToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *SubscriptionProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(SubscriptionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("topic") { - replaces = append(replaces, "topic") - } - if diff.Changed("protocol") { - replaces = append(replaces, "protocol") - } - if diff.Changed("endpoint") { - replaces = append(replaces, "endpoint") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *SubscriptionProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SubscriptionToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SubscriptionProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(SubscriptionToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *SubscriptionProvider) Unmarshal( - v *pbstruct.Struct) (*Subscription, resource.PropertyMap, error) { - var obj Subscription - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Subscription structure(s) */ - -// Subscription is a marshalable representation of its corresponding IDL type. -type Subscription struct { - Name *string `lumi:"name,optional"` - Topic resource.ID `lumi:"topic"` - Protocol Protocol `lumi:"protocol"` - Endpoint string `lumi:"endpoint"` -} - -// Subscription's properties have constants to make dealing with diffs and property bags easier. -const ( - Subscription_Name = "name" - Subscription_Topic = "topic" - Subscription_Protocol = "protocol" - Subscription_Endpoint = "endpoint" -) - -/* Typedefs */ - -type ( - Protocol string -) - -/* Constants */ - -const ( - ApplicationSubscription Protocol = "application" - EmailJSONSubscription Protocol = "email-json" - EmailSubscription Protocol = "email" - HTTPSSubscription Protocol = "https" - HTTSubscription Protocol = "http" - LambdaSubscription Protocol = "lambda" - SMSSubscription Protocol = "sms" - SQSSubscription Protocol = "sqs" -) - - diff --git a/lib/aws/rpc/sns/topic.go b/lib/aws/rpc/sns/topic.go deleted file mode 100644 index f212ad13b..000000000 --- a/lib/aws/rpc/sns/topic.go +++ /dev/null @@ -1,212 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package sns - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Topic resource provider */ - -// TopicToken is the type token corresponding to the Topic package type. -const TopicToken = tokens.Type("aws:sns/topic:Topic") - -// TopicProviderOps is a pluggable interface for Topic-related management functionality. -type TopicProviderOps interface { - Check(ctx context.Context, obj *Topic, property string) error - Create(ctx context.Context, obj *Topic) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Topic, error) - InspectChange(ctx context.Context, - id resource.ID, old *Topic, new *Topic, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Topic, new *Topic, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// TopicProvider is a dynamic gRPC-based plugin for managing Topic resources. -type TopicProvider struct { - ops TopicProviderOps -} - -// NewTopicProvider allocates a resource provider that delegates to a ops instance. -func NewTopicProvider(ops TopicProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &TopicProvider{ops: ops} -} - -func (p *TopicProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(TopicToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Topic", "name", failure)) - } - } - if !unks["topicName"] { - if failure := p.ops.Check(ctx, obj, "topicName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Topic", "topicName", failure)) - } - } - if !unks["displayName"] { - if failure := p.ops.Check(ctx, obj, "displayName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Topic", "displayName", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *TopicProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(TopicToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Topic_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *TopicProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(TopicToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *TopicProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(TopicToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *TopicProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(TopicToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("topicName") { - replaces = append(replaces, "topicName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *TopicProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(TopicToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *TopicProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(TopicToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *TopicProvider) Unmarshal( - v *pbstruct.Struct) (*Topic, resource.PropertyMap, error) { - var obj Topic - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Topic structure(s) */ - -// Topic is a marshalable representation of its corresponding IDL type. -type Topic struct { - Name *string `lumi:"name,optional"` - TopicName *string `lumi:"topicName,optional"` - DisplayName *string `lumi:"displayName,optional"` -} - -// Topic's properties have constants to make dealing with diffs and property bags easier. -const ( - Topic_Name = "name" - Topic_TopicName = "topicName" - Topic_DisplayName = "displayName" -) - - diff --git a/lib/aws/rpc/sqs/queue.go b/lib/aws/rpc/sqs/queue.go deleted file mode 100644 index 2af8bf88c..000000000 --- a/lib/aws/rpc/sqs/queue.go +++ /dev/null @@ -1,285 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package sqs - -import ( - "errors" - - pbempty "github.com/golang/protobuf/ptypes/empty" - pbstruct "github.com/golang/protobuf/ptypes/struct" - "golang.org/x/net/context" - - "github.com/pulumi/lumi/pkg/resource" - "github.com/pulumi/lumi/pkg/resource/plugin" - "github.com/pulumi/lumi/pkg/tokens" - "github.com/pulumi/lumi/pkg/util/contract" - "github.com/pulumi/lumi/pkg/util/mapper" - "github.com/pulumi/lumi/sdk/go/pkg/lumirpc" -) - -/* RPC stubs for Queue resource provider */ - -// QueueToken is the type token corresponding to the Queue package type. -const QueueToken = tokens.Type("aws:sqs/queue:Queue") - -// QueueProviderOps is a pluggable interface for Queue-related management functionality. -type QueueProviderOps interface { - Check(ctx context.Context, obj *Queue, property string) error - Create(ctx context.Context, obj *Queue) (resource.ID, error) - Get(ctx context.Context, id resource.ID) (*Queue, error) - InspectChange(ctx context.Context, - id resource.ID, old *Queue, new *Queue, diff *resource.ObjectDiff) ([]string, error) - Update(ctx context.Context, - id resource.ID, old *Queue, new *Queue, diff *resource.ObjectDiff) error - Delete(ctx context.Context, id resource.ID) error -} - -// QueueProvider is a dynamic gRPC-based plugin for managing Queue resources. -type QueueProvider struct { - ops QueueProviderOps -} - -// NewQueueProvider allocates a resource provider that delegates to a ops instance. -func NewQueueProvider(ops QueueProviderOps) lumirpc.ResourceProviderServer { - contract.Assert(ops != nil) - return &QueueProvider{ops: ops} -} - -func (p *QueueProvider) Check( - ctx context.Context, req *lumirpc.CheckRequest) (*lumirpc.CheckResponse, error) { - contract.Assert(req.GetType() == string(QueueToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return plugin.NewCheckResponse(err), nil - } - var failures []error - if failure := p.ops.Check(ctx, obj, ""); failure != nil { - failures = append(failures, failure) - } - unks := req.GetUnknowns() - if !unks["name"] { - if failure := p.ops.Check(ctx, obj, "name"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "name", failure)) - } - } - if !unks["fifoQueue"] { - if failure := p.ops.Check(ctx, obj, "fifoQueue"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "fifoQueue", failure)) - } - } - if !unks["queueName"] { - if failure := p.ops.Check(ctx, obj, "queueName"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "queueName", failure)) - } - } - if !unks["contentBasedDeduplication"] { - if failure := p.ops.Check(ctx, obj, "contentBasedDeduplication"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "contentBasedDeduplication", failure)) - } - } - if !unks["delaySeconds"] { - if failure := p.ops.Check(ctx, obj, "delaySeconds"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "delaySeconds", failure)) - } - } - if !unks["maximumMessageSize"] { - if failure := p.ops.Check(ctx, obj, "maximumMessageSize"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "maximumMessageSize", failure)) - } - } - if !unks["messageRetentionPeriod"] { - if failure := p.ops.Check(ctx, obj, "messageRetentionPeriod"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "messageRetentionPeriod", failure)) - } - } - if !unks["receiveMessageWaitTimeSeconds"] { - if failure := p.ops.Check(ctx, obj, "receiveMessageWaitTimeSeconds"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "receiveMessageWaitTimeSeconds", failure)) - } - } - if !unks["redrivePolicy"] { - if failure := p.ops.Check(ctx, obj, "redrivePolicy"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "redrivePolicy", failure)) - } - } - if !unks["visibilityTimeout"] { - if failure := p.ops.Check(ctx, obj, "visibilityTimeout"); failure != nil { - failures = append(failures, - resource.NewPropertyError("Queue", "visibilityTimeout", failure)) - } - } - if len(failures) > 0 { - return plugin.NewCheckResponse(resource.NewErrors(failures)), nil - } - return plugin.NewCheckResponse(nil), nil -} - -func (p *QueueProvider) Name( - ctx context.Context, req *lumirpc.NameRequest) (*lumirpc.NameResponse, error) { - contract.Assert(req.GetType() == string(QueueToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - if obj.Name == nil || *obj.Name == "" { - if req.Unknowns[Queue_Name] { - return nil, errors.New("Name property cannot be computed from unknown outputs") - } - return nil, errors.New("Name property cannot be empty") - } - return &lumirpc.NameResponse{Name: *obj.Name}, nil -} - -func (p *QueueProvider) Create( - ctx context.Context, req *lumirpc.CreateRequest) (*lumirpc.CreateResponse, error) { - contract.Assert(req.GetType() == string(QueueToken)) - obj, _, err := p.Unmarshal(req.GetProperties()) - if err != nil { - return nil, err - } - id, err := p.ops.Create(ctx, obj) - if err != nil { - return nil, err - } - return &lumirpc.CreateResponse{Id: string(id)}, nil -} - -func (p *QueueProvider) Get( - ctx context.Context, req *lumirpc.GetRequest) (*lumirpc.GetResponse, error) { - contract.Assert(req.GetType() == string(QueueToken)) - id := resource.ID(req.GetId()) - obj, err := p.ops.Get(ctx, id) - if err != nil { - return nil, err - } - return &lumirpc.GetResponse{ - Properties: plugin.MarshalProperties( - resource.NewPropertyMap(obj), plugin.MarshalOptions{}), - }, nil -} - -func (p *QueueProvider) InspectChange( - ctx context.Context, req *lumirpc.InspectChangeRequest) (*lumirpc.InspectChangeResponse, error) { - contract.Assert(req.GetType() == string(QueueToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - var replaces []string - diff := oldprops.Diff(newprops) - if diff != nil { - if diff.Changed("name") { - replaces = append(replaces, "name") - } - if diff.Changed("fifoQueue") { - replaces = append(replaces, "fifoQueue") - } - if diff.Changed("queueName") { - replaces = append(replaces, "queueName") - } - } - more, err := p.ops.InspectChange(ctx, id, old, new, diff) - if err != nil { - return nil, err - } - return &lumirpc.InspectChangeResponse{ - Replaces: append(replaces, more...), - }, err -} - -func (p *QueueProvider) Update( - ctx context.Context, req *lumirpc.UpdateRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(QueueToken)) - id := resource.ID(req.GetId()) - old, oldprops, err := p.Unmarshal(req.GetOlds()) - if err != nil { - return nil, err - } - new, newprops, err := p.Unmarshal(req.GetNews()) - if err != nil { - return nil, err - } - diff := oldprops.Diff(newprops) - if err := p.ops.Update(ctx, id, old, new, diff); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *QueueProvider) Delete( - ctx context.Context, req *lumirpc.DeleteRequest) (*pbempty.Empty, error) { - contract.Assert(req.GetType() == string(QueueToken)) - id := resource.ID(req.GetId()) - if err := p.ops.Delete(ctx, id); err != nil { - return nil, err - } - return &pbempty.Empty{}, nil -} - -func (p *QueueProvider) Unmarshal( - v *pbstruct.Struct) (*Queue, resource.PropertyMap, error) { - var obj Queue - props := plugin.UnmarshalProperties(v, plugin.MarshalOptions{RawResources: true}) - return &obj, props, mapper.MapIU(props.Mappable(), &obj) -} - -/* Marshalable Queue structure(s) */ - -// Queue is a marshalable representation of its corresponding IDL type. -type Queue struct { - Name *string `lumi:"name,optional"` - FIFOQueue *bool `lumi:"fifoQueue,optional"` - QueueName *string `lumi:"queueName,optional"` - ContentBasedDeduplication *bool `lumi:"contentBasedDeduplication,optional"` - DelaySeconds *float64 `lumi:"delaySeconds,optional"` - MaximumMessageSize *float64 `lumi:"maximumMessageSize,optional"` - MessageRetentionPeriod *float64 `lumi:"messageRetentionPeriod,optional"` - ReceiveMessageWaitTimeSeconds *float64 `lumi:"receiveMessageWaitTimeSeconds,optional"` - RedrivePolicy *RedrivePolicy `lumi:"redrivePolicy,optional"` - VisibilityTimeout *float64 `lumi:"visibilityTimeout,optional"` -} - -// Queue's properties have constants to make dealing with diffs and property bags easier. -const ( - Queue_Name = "name" - Queue_FIFOQueue = "fifoQueue" - Queue_QueueName = "queueName" - Queue_ContentBasedDeduplication = "contentBasedDeduplication" - Queue_DelaySeconds = "delaySeconds" - Queue_MaximumMessageSize = "maximumMessageSize" - Queue_MessageRetentionPeriod = "messageRetentionPeriod" - Queue_ReceiveMessageWaitTimeSeconds = "receiveMessageWaitTimeSeconds" - Queue_RedrivePolicy = "redrivePolicy" - Queue_VisibilityTimeout = "visibilityTimeout" -) - -/* Marshalable RedrivePolicy structure(s) */ - -// RedrivePolicy is a marshalable representation of its corresponding IDL type. -type RedrivePolicy struct { - DeadLetterTarget resource.ID `lumi:"deadLetterTarget"` - MaxReceiveCount float64 `lumi:"maxReceiveCount"` -} - -// RedrivePolicy's properties have constants to make dealing with diffs and property bags easier. -const ( - RedrivePolicy_DeadLetterTarget = "deadLetterTarget" - RedrivePolicy_MaxReceiveCount = "maxReceiveCount" -) - - diff --git a/lib/aws/rpc/types.go b/lib/aws/rpc/types.go deleted file mode 100644 index 0237967b6..000000000 --- a/lib/aws/rpc/types.go +++ /dev/null @@ -1,32 +0,0 @@ -// *** WARNING: this file was generated by the Lumi IDL Compiler (LUMIDL). *** -// *** Do not edit by hand unless you're certain you know what you are doing! *** - -package aws - -/* Typedefs */ - -type ( - ARN string - Region string -) - -/* Constants */ - -const ( - APNortheast1Region Region = "ap-northeast-1" - APNortheast2Region Region = "ap-northeast-2" - APSouth1Region Region = "ap-south-1" - APSouthEast2Region Region = "ap-southeast-2" - APSoutheast1Region Region = "ap-southeast-1" - CACentralRegion Region = "ca-central" - EUCentral1Region Region = "eu-central-1" - EUWest1Region Region = "eu-west-1" - EUWest2Region Region = "eu-west-2" - SAEast1Region Region = "sa-east-1" - USEast1Region Region = "us-east-1" - USEast2Region Region = "us-east-2" - USWest1Region Region = "us-west-1" - USWest2Region Region = "us-west-2" -) - -