From 7ea9d57295224a45d4b667314c6ee82d30cdbc4c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Jul 2019 15:18:26 -0400 Subject: [PATCH 01/23] Include 07/2019 AppMesh preview channel from 'https://github.com/ewbankkit/aws-sdk-go/tree/appmesh-preview-07-2019'. --- .../aws-sdk-go/service/appmeshpreview/api.go | 8779 +++++++++++++++++ .../appmeshpreviewiface/interface.go | 194 + .../aws-sdk-go/service/appmeshpreview/doc.go | 43 + .../service/appmeshpreview/errors.go | 76 + .../service/appmeshpreview/service.go | 98 + 5 files changed, 9190 insertions(+) create mode 100644 vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/appmeshpreviewiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/service.go diff --git a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go new file mode 100644 index 00000000000..f1b71bdbba0 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go @@ -0,0 +1,8779 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package appmeshpreview + +import ( + "fmt" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/private/protocol" + "github.com/aws/aws-sdk-go/private/protocol/restjson" +) + +const opCreateMesh = "CreateMesh" + +// CreateMeshRequest generates a "aws/request.Request" representing the +// client's request for the CreateMesh operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateMesh for more information on using the CreateMesh +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateMeshRequest method. +// req, resp := client.CreateMeshRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateMesh +func (c *AppMeshPreview) CreateMeshRequest(input *CreateMeshInput) (req *request.Request, output *CreateMeshOutput) { + op := &request.Operation{ + Name: opCreateMesh, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes", + } + + if input == nil { + input = &CreateMeshInput{} + } + + output = &CreateMeshOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateMesh API operation for AWS App Mesh Preview. +// +// Creates a service mesh. A service mesh is a logical boundary for network +// traffic between the services that reside within it. +// +// After you create your service mesh, you can create virtual services, virtual +// nodes, virtual routers, and routes to distribute traffic between the applications +// in your mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation CreateMesh for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateMesh +func (c *AppMeshPreview) CreateMesh(input *CreateMeshInput) (*CreateMeshOutput, error) { + req, out := c.CreateMeshRequest(input) + return out, req.Send() +} + +// CreateMeshWithContext is the same as CreateMesh with the addition of +// the ability to pass a context and additional request options. +// +// See CreateMesh for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) CreateMeshWithContext(ctx aws.Context, input *CreateMeshInput, opts ...request.Option) (*CreateMeshOutput, error) { + req, out := c.CreateMeshRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateRoute = "CreateRoute" + +// CreateRouteRequest generates a "aws/request.Request" representing the +// client's request for the CreateRoute operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateRoute for more information on using the CreateRoute +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateRouteRequest method. +// req, resp := client.CreateRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateRoute +func (c *AppMeshPreview) CreateRouteRequest(input *CreateRouteInput) (req *request.Request, output *CreateRouteOutput) { + op := &request.Operation{ + Name: opCreateRoute, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes", + } + + if input == nil { + input = &CreateRouteInput{} + } + + output = &CreateRouteOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateRoute API operation for AWS App Mesh Preview. +// +// Creates a route that is associated with a virtual router. +// +// You can use the prefix parameter in your route specification for path-based +// routing of requests. For example, if your virtual service name is my-service.local +// and you want the route to match requests to my-service.local/metrics, your +// prefix should be /metrics. +// +// If your route matches a request, you can distribute traffic to one or more +// target virtual nodes with relative weighting. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation CreateRoute for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateRoute +func (c *AppMeshPreview) CreateRoute(input *CreateRouteInput) (*CreateRouteOutput, error) { + req, out := c.CreateRouteRequest(input) + return out, req.Send() +} + +// CreateRouteWithContext is the same as CreateRoute with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRoute for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) CreateRouteWithContext(ctx aws.Context, input *CreateRouteInput, opts ...request.Option) (*CreateRouteOutput, error) { + req, out := c.CreateRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateVirtualNode = "CreateVirtualNode" + +// CreateVirtualNodeRequest generates a "aws/request.Request" representing the +// client's request for the CreateVirtualNode operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateVirtualNode for more information on using the CreateVirtualNode +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateVirtualNodeRequest method. +// req, resp := client.CreateVirtualNodeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateVirtualNode +func (c *AppMeshPreview) CreateVirtualNodeRequest(input *CreateVirtualNodeInput) (req *request.Request, output *CreateVirtualNodeOutput) { + op := &request.Operation{ + Name: opCreateVirtualNode, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}/virtualNodes", + } + + if input == nil { + input = &CreateVirtualNodeInput{} + } + + output = &CreateVirtualNodeOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateVirtualNode API operation for AWS App Mesh Preview. +// +// Creates a virtual node within a service mesh. +// +// A virtual node acts as a logical pointer to a particular task group, such +// as an Amazon ECS service or a Kubernetes deployment. When you create a virtual +// node, you can specify the service discovery information for your task group. +// +// Any inbound traffic that your virtual node expects should be specified as +// a listener. Any outbound traffic that your virtual node expects to reach +// should be specified as a backend. +// +// The response metadata for your new virtual node contains the arn that is +// associated with the virtual node. Set this value (either the full ARN or +// the truncated resource name: for example, mesh/default/virtualNode/simpleapp) +// as the APPMESH_VIRTUAL_NODE_NAME environment variable for your task group's +// Envoy proxy container in your task definition or pod spec. This is then mapped +// to the node.id and node.cluster Envoy parameters. +// +// If you require your Envoy stats or tracing to use a different name, you can +// override the node.cluster value that is set by APPMESH_VIRTUAL_NODE_NAME +// with the APPMESH_VIRTUAL_NODE_CLUSTER environment variable. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation CreateVirtualNode for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateVirtualNode +func (c *AppMeshPreview) CreateVirtualNode(input *CreateVirtualNodeInput) (*CreateVirtualNodeOutput, error) { + req, out := c.CreateVirtualNodeRequest(input) + return out, req.Send() +} + +// CreateVirtualNodeWithContext is the same as CreateVirtualNode with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVirtualNode for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) CreateVirtualNodeWithContext(ctx aws.Context, input *CreateVirtualNodeInput, opts ...request.Option) (*CreateVirtualNodeOutput, error) { + req, out := c.CreateVirtualNodeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateVirtualRouter = "CreateVirtualRouter" + +// CreateVirtualRouterRequest generates a "aws/request.Request" representing the +// client's request for the CreateVirtualRouter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateVirtualRouter for more information on using the CreateVirtualRouter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateVirtualRouterRequest method. +// req, resp := client.CreateVirtualRouterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateVirtualRouter +func (c *AppMeshPreview) CreateVirtualRouterRequest(input *CreateVirtualRouterInput) (req *request.Request, output *CreateVirtualRouterOutput) { + op := &request.Operation{ + Name: opCreateVirtualRouter, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouters", + } + + if input == nil { + input = &CreateVirtualRouterInput{} + } + + output = &CreateVirtualRouterOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateVirtualRouter API operation for AWS App Mesh Preview. +// +// Creates a virtual router within a service mesh. +// +// Any inbound traffic that your virtual router expects should be specified +// as a listener. +// +// Virtual routers handle traffic for one or more virtual services within your +// mesh. After you create your virtual router, create and associate routes for +// your virtual router that direct incoming requests to different virtual nodes. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation CreateVirtualRouter for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateVirtualRouter +func (c *AppMeshPreview) CreateVirtualRouter(input *CreateVirtualRouterInput) (*CreateVirtualRouterOutput, error) { + req, out := c.CreateVirtualRouterRequest(input) + return out, req.Send() +} + +// CreateVirtualRouterWithContext is the same as CreateVirtualRouter with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVirtualRouter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) CreateVirtualRouterWithContext(ctx aws.Context, input *CreateVirtualRouterInput, opts ...request.Option) (*CreateVirtualRouterOutput, error) { + req, out := c.CreateVirtualRouterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateVirtualService = "CreateVirtualService" + +// CreateVirtualServiceRequest generates a "aws/request.Request" representing the +// client's request for the CreateVirtualService operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateVirtualService for more information on using the CreateVirtualService +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateVirtualServiceRequest method. +// req, resp := client.CreateVirtualServiceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateVirtualService +func (c *AppMeshPreview) CreateVirtualServiceRequest(input *CreateVirtualServiceInput) (req *request.Request, output *CreateVirtualServiceOutput) { + op := &request.Operation{ + Name: opCreateVirtualService, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}/virtualServices", + } + + if input == nil { + input = &CreateVirtualServiceInput{} + } + + output = &CreateVirtualServiceOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateVirtualService API operation for AWS App Mesh Preview. +// +// Creates a virtual service within a service mesh. +// +// A virtual service is an abstraction of a real service that is provided by +// a virtual node directly or indirectly by means of a virtual router. Dependent +// services call your virtual service by its virtualServiceName, and those requests +// are routed to the virtual node or virtual router that is specified as the +// provider for the virtual service. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation CreateVirtualService for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/CreateVirtualService +func (c *AppMeshPreview) CreateVirtualService(input *CreateVirtualServiceInput) (*CreateVirtualServiceOutput, error) { + req, out := c.CreateVirtualServiceRequest(input) + return out, req.Send() +} + +// CreateVirtualServiceWithContext is the same as CreateVirtualService with the addition of +// the ability to pass a context and additional request options. +// +// See CreateVirtualService for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) CreateVirtualServiceWithContext(ctx aws.Context, input *CreateVirtualServiceInput, opts ...request.Option) (*CreateVirtualServiceOutput, error) { + req, out := c.CreateVirtualServiceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteMesh = "DeleteMesh" + +// DeleteMeshRequest generates a "aws/request.Request" representing the +// client's request for the DeleteMesh operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteMesh for more information on using the DeleteMesh +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteMeshRequest method. +// req, resp := client.DeleteMeshRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteMesh +func (c *AppMeshPreview) DeleteMeshRequest(input *DeleteMeshInput) (req *request.Request, output *DeleteMeshOutput) { + op := &request.Operation{ + Name: opDeleteMesh, + HTTPMethod: "DELETE", + HTTPPath: "/v20190125/meshes/{meshName}", + } + + if input == nil { + input = &DeleteMeshInput{} + } + + output = &DeleteMeshOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteMesh API operation for AWS App Mesh Preview. +// +// Deletes an existing service mesh. +// +// You must delete all resources (virtual services, routes, virtual routers, +// and virtual nodes) in the service mesh before you can delete the mesh itself. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DeleteMesh for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeResourceInUseException "ResourceInUseException" +// You can't delete the specified resource because it's in use or required by +// another resource. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteMesh +func (c *AppMeshPreview) DeleteMesh(input *DeleteMeshInput) (*DeleteMeshOutput, error) { + req, out := c.DeleteMeshRequest(input) + return out, req.Send() +} + +// DeleteMeshWithContext is the same as DeleteMesh with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteMesh for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DeleteMeshWithContext(ctx aws.Context, input *DeleteMeshInput, opts ...request.Option) (*DeleteMeshOutput, error) { + req, out := c.DeleteMeshRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteRoute = "DeleteRoute" + +// DeleteRouteRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRoute operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteRoute for more information on using the DeleteRoute +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteRouteRequest method. +// req, resp := client.DeleteRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteRoute +func (c *AppMeshPreview) DeleteRouteRequest(input *DeleteRouteInput) (req *request.Request, output *DeleteRouteOutput) { + op := &request.Operation{ + Name: opDeleteRoute, + HTTPMethod: "DELETE", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}", + } + + if input == nil { + input = &DeleteRouteInput{} + } + + output = &DeleteRouteOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteRoute API operation for AWS App Mesh Preview. +// +// Deletes an existing route. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DeleteRoute for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeResourceInUseException "ResourceInUseException" +// You can't delete the specified resource because it's in use or required by +// another resource. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteRoute +func (c *AppMeshPreview) DeleteRoute(input *DeleteRouteInput) (*DeleteRouteOutput, error) { + req, out := c.DeleteRouteRequest(input) + return out, req.Send() +} + +// DeleteRouteWithContext is the same as DeleteRoute with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRoute for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DeleteRouteWithContext(ctx aws.Context, input *DeleteRouteInput, opts ...request.Option) (*DeleteRouteOutput, error) { + req, out := c.DeleteRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteVirtualNode = "DeleteVirtualNode" + +// DeleteVirtualNodeRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVirtualNode operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteVirtualNode for more information on using the DeleteVirtualNode +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteVirtualNodeRequest method. +// req, resp := client.DeleteVirtualNodeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteVirtualNode +func (c *AppMeshPreview) DeleteVirtualNodeRequest(input *DeleteVirtualNodeInput) (req *request.Request, output *DeleteVirtualNodeOutput) { + op := &request.Operation{ + Name: opDeleteVirtualNode, + HTTPMethod: "DELETE", + HTTPPath: "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}", + } + + if input == nil { + input = &DeleteVirtualNodeInput{} + } + + output = &DeleteVirtualNodeOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteVirtualNode API operation for AWS App Mesh Preview. +// +// Deletes an existing virtual node. +// +// You must delete any virtual services that list a virtual node as a service +// provider before you can delete the virtual node itself. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DeleteVirtualNode for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeResourceInUseException "ResourceInUseException" +// You can't delete the specified resource because it's in use or required by +// another resource. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteVirtualNode +func (c *AppMeshPreview) DeleteVirtualNode(input *DeleteVirtualNodeInput) (*DeleteVirtualNodeOutput, error) { + req, out := c.DeleteVirtualNodeRequest(input) + return out, req.Send() +} + +// DeleteVirtualNodeWithContext is the same as DeleteVirtualNode with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVirtualNode for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DeleteVirtualNodeWithContext(ctx aws.Context, input *DeleteVirtualNodeInput, opts ...request.Option) (*DeleteVirtualNodeOutput, error) { + req, out := c.DeleteVirtualNodeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteVirtualRouter = "DeleteVirtualRouter" + +// DeleteVirtualRouterRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVirtualRouter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteVirtualRouter for more information on using the DeleteVirtualRouter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteVirtualRouterRequest method. +// req, resp := client.DeleteVirtualRouterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteVirtualRouter +func (c *AppMeshPreview) DeleteVirtualRouterRequest(input *DeleteVirtualRouterInput) (req *request.Request, output *DeleteVirtualRouterOutput) { + op := &request.Operation{ + Name: opDeleteVirtualRouter, + HTTPMethod: "DELETE", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}", + } + + if input == nil { + input = &DeleteVirtualRouterInput{} + } + + output = &DeleteVirtualRouterOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteVirtualRouter API operation for AWS App Mesh Preview. +// +// Deletes an existing virtual router. +// +// You must delete any routes associated with the virtual router before you +// can delete the router itself. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DeleteVirtualRouter for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeResourceInUseException "ResourceInUseException" +// You can't delete the specified resource because it's in use or required by +// another resource. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteVirtualRouter +func (c *AppMeshPreview) DeleteVirtualRouter(input *DeleteVirtualRouterInput) (*DeleteVirtualRouterOutput, error) { + req, out := c.DeleteVirtualRouterRequest(input) + return out, req.Send() +} + +// DeleteVirtualRouterWithContext is the same as DeleteVirtualRouter with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVirtualRouter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DeleteVirtualRouterWithContext(ctx aws.Context, input *DeleteVirtualRouterInput, opts ...request.Option) (*DeleteVirtualRouterOutput, error) { + req, out := c.DeleteVirtualRouterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteVirtualService = "DeleteVirtualService" + +// DeleteVirtualServiceRequest generates a "aws/request.Request" representing the +// client's request for the DeleteVirtualService operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteVirtualService for more information on using the DeleteVirtualService +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteVirtualServiceRequest method. +// req, resp := client.DeleteVirtualServiceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteVirtualService +func (c *AppMeshPreview) DeleteVirtualServiceRequest(input *DeleteVirtualServiceInput) (req *request.Request, output *DeleteVirtualServiceOutput) { + op := &request.Operation{ + Name: opDeleteVirtualService, + HTTPMethod: "DELETE", + HTTPPath: "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}", + } + + if input == nil { + input = &DeleteVirtualServiceInput{} + } + + output = &DeleteVirtualServiceOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteVirtualService API operation for AWS App Mesh Preview. +// +// Deletes an existing virtual service. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DeleteVirtualService for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DeleteVirtualService +func (c *AppMeshPreview) DeleteVirtualService(input *DeleteVirtualServiceInput) (*DeleteVirtualServiceOutput, error) { + req, out := c.DeleteVirtualServiceRequest(input) + return out, req.Send() +} + +// DeleteVirtualServiceWithContext is the same as DeleteVirtualService with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteVirtualService for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DeleteVirtualServiceWithContext(ctx aws.Context, input *DeleteVirtualServiceInput, opts ...request.Option) (*DeleteVirtualServiceOutput, error) { + req, out := c.DeleteVirtualServiceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeMesh = "DescribeMesh" + +// DescribeMeshRequest generates a "aws/request.Request" representing the +// client's request for the DescribeMesh operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeMesh for more information on using the DescribeMesh +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeMeshRequest method. +// req, resp := client.DescribeMeshRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeMesh +func (c *AppMeshPreview) DescribeMeshRequest(input *DescribeMeshInput) (req *request.Request, output *DescribeMeshOutput) { + op := &request.Operation{ + Name: opDescribeMesh, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}", + } + + if input == nil { + input = &DescribeMeshInput{} + } + + output = &DescribeMeshOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeMesh API operation for AWS App Mesh Preview. +// +// Describes an existing service mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DescribeMesh for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeMesh +func (c *AppMeshPreview) DescribeMesh(input *DescribeMeshInput) (*DescribeMeshOutput, error) { + req, out := c.DescribeMeshRequest(input) + return out, req.Send() +} + +// DescribeMeshWithContext is the same as DescribeMesh with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeMesh for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DescribeMeshWithContext(ctx aws.Context, input *DescribeMeshInput, opts ...request.Option) (*DescribeMeshOutput, error) { + req, out := c.DescribeMeshRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeRoute = "DescribeRoute" + +// DescribeRouteRequest generates a "aws/request.Request" representing the +// client's request for the DescribeRoute operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeRoute for more information on using the DescribeRoute +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeRouteRequest method. +// req, resp := client.DescribeRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeRoute +func (c *AppMeshPreview) DescribeRouteRequest(input *DescribeRouteInput) (req *request.Request, output *DescribeRouteOutput) { + op := &request.Operation{ + Name: opDescribeRoute, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}", + } + + if input == nil { + input = &DescribeRouteInput{} + } + + output = &DescribeRouteOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeRoute API operation for AWS App Mesh Preview. +// +// Describes an existing route. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DescribeRoute for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeRoute +func (c *AppMeshPreview) DescribeRoute(input *DescribeRouteInput) (*DescribeRouteOutput, error) { + req, out := c.DescribeRouteRequest(input) + return out, req.Send() +} + +// DescribeRouteWithContext is the same as DescribeRoute with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeRoute for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DescribeRouteWithContext(ctx aws.Context, input *DescribeRouteInput, opts ...request.Option) (*DescribeRouteOutput, error) { + req, out := c.DescribeRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeVirtualNode = "DescribeVirtualNode" + +// DescribeVirtualNodeRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVirtualNode operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeVirtualNode for more information on using the DescribeVirtualNode +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeVirtualNodeRequest method. +// req, resp := client.DescribeVirtualNodeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeVirtualNode +func (c *AppMeshPreview) DescribeVirtualNodeRequest(input *DescribeVirtualNodeInput) (req *request.Request, output *DescribeVirtualNodeOutput) { + op := &request.Operation{ + Name: opDescribeVirtualNode, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}", + } + + if input == nil { + input = &DescribeVirtualNodeInput{} + } + + output = &DescribeVirtualNodeOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeVirtualNode API operation for AWS App Mesh Preview. +// +// Describes an existing virtual node. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DescribeVirtualNode for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeVirtualNode +func (c *AppMeshPreview) DescribeVirtualNode(input *DescribeVirtualNodeInput) (*DescribeVirtualNodeOutput, error) { + req, out := c.DescribeVirtualNodeRequest(input) + return out, req.Send() +} + +// DescribeVirtualNodeWithContext is the same as DescribeVirtualNode with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVirtualNode for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DescribeVirtualNodeWithContext(ctx aws.Context, input *DescribeVirtualNodeInput, opts ...request.Option) (*DescribeVirtualNodeOutput, error) { + req, out := c.DescribeVirtualNodeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeVirtualRouter = "DescribeVirtualRouter" + +// DescribeVirtualRouterRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVirtualRouter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeVirtualRouter for more information on using the DescribeVirtualRouter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeVirtualRouterRequest method. +// req, resp := client.DescribeVirtualRouterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeVirtualRouter +func (c *AppMeshPreview) DescribeVirtualRouterRequest(input *DescribeVirtualRouterInput) (req *request.Request, output *DescribeVirtualRouterOutput) { + op := &request.Operation{ + Name: opDescribeVirtualRouter, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}", + } + + if input == nil { + input = &DescribeVirtualRouterInput{} + } + + output = &DescribeVirtualRouterOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeVirtualRouter API operation for AWS App Mesh Preview. +// +// Describes an existing virtual router. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DescribeVirtualRouter for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeVirtualRouter +func (c *AppMeshPreview) DescribeVirtualRouter(input *DescribeVirtualRouterInput) (*DescribeVirtualRouterOutput, error) { + req, out := c.DescribeVirtualRouterRequest(input) + return out, req.Send() +} + +// DescribeVirtualRouterWithContext is the same as DescribeVirtualRouter with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVirtualRouter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DescribeVirtualRouterWithContext(ctx aws.Context, input *DescribeVirtualRouterInput, opts ...request.Option) (*DescribeVirtualRouterOutput, error) { + req, out := c.DescribeVirtualRouterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDescribeVirtualService = "DescribeVirtualService" + +// DescribeVirtualServiceRequest generates a "aws/request.Request" representing the +// client's request for the DescribeVirtualService operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DescribeVirtualService for more information on using the DescribeVirtualService +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DescribeVirtualServiceRequest method. +// req, resp := client.DescribeVirtualServiceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeVirtualService +func (c *AppMeshPreview) DescribeVirtualServiceRequest(input *DescribeVirtualServiceInput) (req *request.Request, output *DescribeVirtualServiceOutput) { + op := &request.Operation{ + Name: opDescribeVirtualService, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}", + } + + if input == nil { + input = &DescribeVirtualServiceInput{} + } + + output = &DescribeVirtualServiceOutput{} + req = c.newRequest(op, input, output) + return +} + +// DescribeVirtualService API operation for AWS App Mesh Preview. +// +// Describes an existing virtual service. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation DescribeVirtualService for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/DescribeVirtualService +func (c *AppMeshPreview) DescribeVirtualService(input *DescribeVirtualServiceInput) (*DescribeVirtualServiceOutput, error) { + req, out := c.DescribeVirtualServiceRequest(input) + return out, req.Send() +} + +// DescribeVirtualServiceWithContext is the same as DescribeVirtualService with the addition of +// the ability to pass a context and additional request options. +// +// See DescribeVirtualService for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) DescribeVirtualServiceWithContext(ctx aws.Context, input *DescribeVirtualServiceInput, opts ...request.Option) (*DescribeVirtualServiceOutput, error) { + req, out := c.DescribeVirtualServiceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opListMeshes = "ListMeshes" + +// ListMeshesRequest generates a "aws/request.Request" representing the +// client's request for the ListMeshes operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListMeshes for more information on using the ListMeshes +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListMeshesRequest method. +// req, resp := client.ListMeshesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListMeshes +func (c *AppMeshPreview) ListMeshesRequest(input *ListMeshesInput) (req *request.Request, output *ListMeshesOutput) { + op := &request.Operation{ + Name: opListMeshes, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListMeshesInput{} + } + + output = &ListMeshesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListMeshes API operation for AWS App Mesh Preview. +// +// Returns a list of existing service meshes. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation ListMeshes for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListMeshes +func (c *AppMeshPreview) ListMeshes(input *ListMeshesInput) (*ListMeshesOutput, error) { + req, out := c.ListMeshesRequest(input) + return out, req.Send() +} + +// ListMeshesWithContext is the same as ListMeshes with the addition of +// the ability to pass a context and additional request options. +// +// See ListMeshes for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListMeshesWithContext(ctx aws.Context, input *ListMeshesInput, opts ...request.Option) (*ListMeshesOutput, error) { + req, out := c.ListMeshesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListMeshesPages iterates over the pages of a ListMeshes operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListMeshes method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListMeshes operation. +// pageNum := 0 +// err := client.ListMeshesPages(params, +// func(page *appmeshpreview.ListMeshesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *AppMeshPreview) ListMeshesPages(input *ListMeshesInput, fn func(*ListMeshesOutput, bool) bool) error { + return c.ListMeshesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListMeshesPagesWithContext same as ListMeshesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListMeshesPagesWithContext(ctx aws.Context, input *ListMeshesInput, fn func(*ListMeshesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListMeshesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListMeshesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListMeshesOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListRoutes = "ListRoutes" + +// ListRoutesRequest generates a "aws/request.Request" representing the +// client's request for the ListRoutes operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListRoutes for more information on using the ListRoutes +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListRoutesRequest method. +// req, resp := client.ListRoutesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListRoutes +func (c *AppMeshPreview) ListRoutesRequest(input *ListRoutesInput) (req *request.Request, output *ListRoutesOutput) { + op := &request.Operation{ + Name: opListRoutes, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListRoutesInput{} + } + + output = &ListRoutesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListRoutes API operation for AWS App Mesh Preview. +// +// Returns a list of existing routes in a service mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation ListRoutes for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListRoutes +func (c *AppMeshPreview) ListRoutes(input *ListRoutesInput) (*ListRoutesOutput, error) { + req, out := c.ListRoutesRequest(input) + return out, req.Send() +} + +// ListRoutesWithContext is the same as ListRoutes with the addition of +// the ability to pass a context and additional request options. +// +// See ListRoutes for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListRoutesWithContext(ctx aws.Context, input *ListRoutesInput, opts ...request.Option) (*ListRoutesOutput, error) { + req, out := c.ListRoutesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListRoutesPages iterates over the pages of a ListRoutes operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListRoutes method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListRoutes operation. +// pageNum := 0 +// err := client.ListRoutesPages(params, +// func(page *appmeshpreview.ListRoutesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *AppMeshPreview) ListRoutesPages(input *ListRoutesInput, fn func(*ListRoutesOutput, bool) bool) error { + return c.ListRoutesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListRoutesPagesWithContext same as ListRoutesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListRoutesPagesWithContext(ctx aws.Context, input *ListRoutesInput, fn func(*ListRoutesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListRoutesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListRoutesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListRoutesOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListTagsForResource = "ListTagsForResource" + +// ListTagsForResourceRequest generates a "aws/request.Request" representing the +// client's request for the ListTagsForResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListTagsForResource for more information on using the ListTagsForResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListTagsForResourceRequest method. +// req, resp := client.ListTagsForResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListTagsForResource +func (c *AppMeshPreview) ListTagsForResourceRequest(input *ListTagsForResourceInput) (req *request.Request, output *ListTagsForResourceOutput) { + op := &request.Operation{ + Name: opListTagsForResource, + HTTPMethod: "GET", + HTTPPath: "/v20190125/tags", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListTagsForResourceInput{} + } + + output = &ListTagsForResourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListTagsForResource API operation for AWS App Mesh Preview. +// +// List the tags for an App Mesh resource. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation ListTagsForResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListTagsForResource +func (c *AppMeshPreview) ListTagsForResource(input *ListTagsForResourceInput) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + return out, req.Send() +} + +// ListTagsForResourceWithContext is the same as ListTagsForResource with the addition of +// the ability to pass a context and additional request options. +// +// See ListTagsForResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListTagsForResourceWithContext(ctx aws.Context, input *ListTagsForResourceInput, opts ...request.Option) (*ListTagsForResourceOutput, error) { + req, out := c.ListTagsForResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListTagsForResourcePages iterates over the pages of a ListTagsForResource operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListTagsForResource method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListTagsForResource operation. +// pageNum := 0 +// err := client.ListTagsForResourcePages(params, +// func(page *appmeshpreview.ListTagsForResourceOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *AppMeshPreview) ListTagsForResourcePages(input *ListTagsForResourceInput, fn func(*ListTagsForResourceOutput, bool) bool) error { + return c.ListTagsForResourcePagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListTagsForResourcePagesWithContext same as ListTagsForResourcePages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListTagsForResourcePagesWithContext(ctx aws.Context, input *ListTagsForResourceInput, fn func(*ListTagsForResourceOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListTagsForResourceInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListTagsForResourceRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListTagsForResourceOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListVirtualNodes = "ListVirtualNodes" + +// ListVirtualNodesRequest generates a "aws/request.Request" representing the +// client's request for the ListVirtualNodes operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListVirtualNodes for more information on using the ListVirtualNodes +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListVirtualNodesRequest method. +// req, resp := client.ListVirtualNodesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListVirtualNodes +func (c *AppMeshPreview) ListVirtualNodesRequest(input *ListVirtualNodesInput) (req *request.Request, output *ListVirtualNodesOutput) { + op := &request.Operation{ + Name: opListVirtualNodes, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}/virtualNodes", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListVirtualNodesInput{} + } + + output = &ListVirtualNodesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListVirtualNodes API operation for AWS App Mesh Preview. +// +// Returns a list of existing virtual nodes. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation ListVirtualNodes for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListVirtualNodes +func (c *AppMeshPreview) ListVirtualNodes(input *ListVirtualNodesInput) (*ListVirtualNodesOutput, error) { + req, out := c.ListVirtualNodesRequest(input) + return out, req.Send() +} + +// ListVirtualNodesWithContext is the same as ListVirtualNodes with the addition of +// the ability to pass a context and additional request options. +// +// See ListVirtualNodes for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListVirtualNodesWithContext(ctx aws.Context, input *ListVirtualNodesInput, opts ...request.Option) (*ListVirtualNodesOutput, error) { + req, out := c.ListVirtualNodesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListVirtualNodesPages iterates over the pages of a ListVirtualNodes operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListVirtualNodes method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListVirtualNodes operation. +// pageNum := 0 +// err := client.ListVirtualNodesPages(params, +// func(page *appmeshpreview.ListVirtualNodesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *AppMeshPreview) ListVirtualNodesPages(input *ListVirtualNodesInput, fn func(*ListVirtualNodesOutput, bool) bool) error { + return c.ListVirtualNodesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListVirtualNodesPagesWithContext same as ListVirtualNodesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListVirtualNodesPagesWithContext(ctx aws.Context, input *ListVirtualNodesInput, fn func(*ListVirtualNodesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListVirtualNodesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListVirtualNodesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListVirtualNodesOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListVirtualRouters = "ListVirtualRouters" + +// ListVirtualRoutersRequest generates a "aws/request.Request" representing the +// client's request for the ListVirtualRouters operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListVirtualRouters for more information on using the ListVirtualRouters +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListVirtualRoutersRequest method. +// req, resp := client.ListVirtualRoutersRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListVirtualRouters +func (c *AppMeshPreview) ListVirtualRoutersRequest(input *ListVirtualRoutersInput) (req *request.Request, output *ListVirtualRoutersOutput) { + op := &request.Operation{ + Name: opListVirtualRouters, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouters", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListVirtualRoutersInput{} + } + + output = &ListVirtualRoutersOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListVirtualRouters API operation for AWS App Mesh Preview. +// +// Returns a list of existing virtual routers in a service mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation ListVirtualRouters for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListVirtualRouters +func (c *AppMeshPreview) ListVirtualRouters(input *ListVirtualRoutersInput) (*ListVirtualRoutersOutput, error) { + req, out := c.ListVirtualRoutersRequest(input) + return out, req.Send() +} + +// ListVirtualRoutersWithContext is the same as ListVirtualRouters with the addition of +// the ability to pass a context and additional request options. +// +// See ListVirtualRouters for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListVirtualRoutersWithContext(ctx aws.Context, input *ListVirtualRoutersInput, opts ...request.Option) (*ListVirtualRoutersOutput, error) { + req, out := c.ListVirtualRoutersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListVirtualRoutersPages iterates over the pages of a ListVirtualRouters operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListVirtualRouters method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListVirtualRouters operation. +// pageNum := 0 +// err := client.ListVirtualRoutersPages(params, +// func(page *appmeshpreview.ListVirtualRoutersOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *AppMeshPreview) ListVirtualRoutersPages(input *ListVirtualRoutersInput, fn func(*ListVirtualRoutersOutput, bool) bool) error { + return c.ListVirtualRoutersPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListVirtualRoutersPagesWithContext same as ListVirtualRoutersPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListVirtualRoutersPagesWithContext(ctx aws.Context, input *ListVirtualRoutersInput, fn func(*ListVirtualRoutersOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListVirtualRoutersInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListVirtualRoutersRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListVirtualRoutersOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListVirtualServices = "ListVirtualServices" + +// ListVirtualServicesRequest generates a "aws/request.Request" representing the +// client's request for the ListVirtualServices operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ListVirtualServices for more information on using the ListVirtualServices +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ListVirtualServicesRequest method. +// req, resp := client.ListVirtualServicesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListVirtualServices +func (c *AppMeshPreview) ListVirtualServicesRequest(input *ListVirtualServicesInput) (req *request.Request, output *ListVirtualServicesOutput) { + op := &request.Operation{ + Name: opListVirtualServices, + HTTPMethod: "GET", + HTTPPath: "/v20190125/meshes/{meshName}/virtualServices", + Paginator: &request.Paginator{ + InputTokens: []string{"nextToken"}, + OutputTokens: []string{"nextToken"}, + LimitToken: "limit", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListVirtualServicesInput{} + } + + output = &ListVirtualServicesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListVirtualServices API operation for AWS App Mesh Preview. +// +// Returns a list of existing virtual services in a service mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation ListVirtualServices for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/ListVirtualServices +func (c *AppMeshPreview) ListVirtualServices(input *ListVirtualServicesInput) (*ListVirtualServicesOutput, error) { + req, out := c.ListVirtualServicesRequest(input) + return out, req.Send() +} + +// ListVirtualServicesWithContext is the same as ListVirtualServices with the addition of +// the ability to pass a context and additional request options. +// +// See ListVirtualServices for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListVirtualServicesWithContext(ctx aws.Context, input *ListVirtualServicesInput, opts ...request.Option) (*ListVirtualServicesOutput, error) { + req, out := c.ListVirtualServicesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListVirtualServicesPages iterates over the pages of a ListVirtualServices operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListVirtualServices method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListVirtualServices operation. +// pageNum := 0 +// err := client.ListVirtualServicesPages(params, +// func(page *appmeshpreview.ListVirtualServicesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *AppMeshPreview) ListVirtualServicesPages(input *ListVirtualServicesInput, fn func(*ListVirtualServicesOutput, bool) bool) error { + return c.ListVirtualServicesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListVirtualServicesPagesWithContext same as ListVirtualServicesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) ListVirtualServicesPagesWithContext(ctx aws.Context, input *ListVirtualServicesInput, fn func(*ListVirtualServicesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListVirtualServicesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListVirtualServicesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListVirtualServicesOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opTagResource = "TagResource" + +// TagResourceRequest generates a "aws/request.Request" representing the +// client's request for the TagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TagResource for more information on using the TagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the TagResourceRequest method. +// req, resp := client.TagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/TagResource +func (c *AppMeshPreview) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { + op := &request.Operation{ + Name: opTagResource, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/tag", + } + + if input == nil { + input = &TagResourceInput{} + } + + output = &TagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restjson.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// TagResource API operation for AWS App Mesh Preview. +// +// Associates the specified tags to a resource with the specified resourceArn. +// If existing tags on a resource aren't specified in the request parameters, +// they aren't changed. When a resource is deleted, the tags associated with +// that resource are also deleted. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation TagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// * ErrCodeTooManyTagsException "TooManyTagsException" +// The request exceeds the maximum allowed number of tags allowed per resource. +// The current limit is 50 user tags per resource. You must reduce the number +// of tags in the request. None of the tags in this request were applied. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/TagResource +func (c *AppMeshPreview) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + return out, req.Send() +} + +// TagResourceWithContext is the same as TagResource with the addition of +// the ability to pass a context and additional request options. +// +// See TagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUntagResource = "UntagResource" + +// UntagResourceRequest generates a "aws/request.Request" representing the +// client's request for the UntagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UntagResource for more information on using the UntagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UntagResourceRequest method. +// req, resp := client.UntagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UntagResource +func (c *AppMeshPreview) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { + op := &request.Operation{ + Name: opUntagResource, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/untag", + } + + if input == nil { + input = &UntagResourceInput{} + } + + output = &UntagResourceOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restjson.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + return +} + +// UntagResource API operation for AWS App Mesh Preview. +// +// Deletes specified tags from a resource. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation UntagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UntagResource +func (c *AppMeshPreview) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + return out, req.Send() +} + +// UntagResourceWithContext is the same as UntagResource with the addition of +// the ability to pass a context and additional request options. +// +// See UntagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateMesh = "UpdateMesh" + +// UpdateMeshRequest generates a "aws/request.Request" representing the +// client's request for the UpdateMesh operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateMesh for more information on using the UpdateMesh +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UpdateMeshRequest method. +// req, resp := client.UpdateMeshRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateMesh +func (c *AppMeshPreview) UpdateMeshRequest(input *UpdateMeshInput) (req *request.Request, output *UpdateMeshOutput) { + op := &request.Operation{ + Name: opUpdateMesh, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}", + } + + if input == nil { + input = &UpdateMeshInput{} + } + + output = &UpdateMeshOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateMesh API operation for AWS App Mesh Preview. +// +// Updates an existing service mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation UpdateMesh for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateMesh +func (c *AppMeshPreview) UpdateMesh(input *UpdateMeshInput) (*UpdateMeshOutput, error) { + req, out := c.UpdateMeshRequest(input) + return out, req.Send() +} + +// UpdateMeshWithContext is the same as UpdateMesh with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateMesh for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) UpdateMeshWithContext(ctx aws.Context, input *UpdateMeshInput, opts ...request.Option) (*UpdateMeshOutput, error) { + req, out := c.UpdateMeshRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateRoute = "UpdateRoute" + +// UpdateRouteRequest generates a "aws/request.Request" representing the +// client's request for the UpdateRoute operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateRoute for more information on using the UpdateRoute +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UpdateRouteRequest method. +// req, resp := client.UpdateRouteRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateRoute +func (c *AppMeshPreview) UpdateRouteRequest(input *UpdateRouteInput) (req *request.Request, output *UpdateRouteOutput) { + op := &request.Operation{ + Name: opUpdateRoute, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouter/{virtualRouterName}/routes/{routeName}", + } + + if input == nil { + input = &UpdateRouteInput{} + } + + output = &UpdateRouteOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateRoute API operation for AWS App Mesh Preview. +// +// Updates an existing route for a specified service mesh and virtual router. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation UpdateRoute for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateRoute +func (c *AppMeshPreview) UpdateRoute(input *UpdateRouteInput) (*UpdateRouteOutput, error) { + req, out := c.UpdateRouteRequest(input) + return out, req.Send() +} + +// UpdateRouteWithContext is the same as UpdateRoute with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRoute for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) UpdateRouteWithContext(ctx aws.Context, input *UpdateRouteInput, opts ...request.Option) (*UpdateRouteOutput, error) { + req, out := c.UpdateRouteRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateVirtualNode = "UpdateVirtualNode" + +// UpdateVirtualNodeRequest generates a "aws/request.Request" representing the +// client's request for the UpdateVirtualNode operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateVirtualNode for more information on using the UpdateVirtualNode +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UpdateVirtualNodeRequest method. +// req, resp := client.UpdateVirtualNodeRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateVirtualNode +func (c *AppMeshPreview) UpdateVirtualNodeRequest(input *UpdateVirtualNodeInput) (req *request.Request, output *UpdateVirtualNodeOutput) { + op := &request.Operation{ + Name: opUpdateVirtualNode, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}/virtualNodes/{virtualNodeName}", + } + + if input == nil { + input = &UpdateVirtualNodeInput{} + } + + output = &UpdateVirtualNodeOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateVirtualNode API operation for AWS App Mesh Preview. +// +// Updates an existing virtual node in a specified service mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation UpdateVirtualNode for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateVirtualNode +func (c *AppMeshPreview) UpdateVirtualNode(input *UpdateVirtualNodeInput) (*UpdateVirtualNodeOutput, error) { + req, out := c.UpdateVirtualNodeRequest(input) + return out, req.Send() +} + +// UpdateVirtualNodeWithContext is the same as UpdateVirtualNode with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateVirtualNode for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) UpdateVirtualNodeWithContext(ctx aws.Context, input *UpdateVirtualNodeInput, opts ...request.Option) (*UpdateVirtualNodeOutput, error) { + req, out := c.UpdateVirtualNodeRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateVirtualRouter = "UpdateVirtualRouter" + +// UpdateVirtualRouterRequest generates a "aws/request.Request" representing the +// client's request for the UpdateVirtualRouter operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateVirtualRouter for more information on using the UpdateVirtualRouter +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UpdateVirtualRouterRequest method. +// req, resp := client.UpdateVirtualRouterRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateVirtualRouter +func (c *AppMeshPreview) UpdateVirtualRouterRequest(input *UpdateVirtualRouterInput) (req *request.Request, output *UpdateVirtualRouterOutput) { + op := &request.Operation{ + Name: opUpdateVirtualRouter, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}/virtualRouters/{virtualRouterName}", + } + + if input == nil { + input = &UpdateVirtualRouterInput{} + } + + output = &UpdateVirtualRouterOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateVirtualRouter API operation for AWS App Mesh Preview. +// +// Updates an existing virtual router in a specified service mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation UpdateVirtualRouter for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateVirtualRouter +func (c *AppMeshPreview) UpdateVirtualRouter(input *UpdateVirtualRouterInput) (*UpdateVirtualRouterOutput, error) { + req, out := c.UpdateVirtualRouterRequest(input) + return out, req.Send() +} + +// UpdateVirtualRouterWithContext is the same as UpdateVirtualRouter with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateVirtualRouter for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) UpdateVirtualRouterWithContext(ctx aws.Context, input *UpdateVirtualRouterInput, opts ...request.Option) (*UpdateVirtualRouterOutput, error) { + req, out := c.UpdateVirtualRouterRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateVirtualService = "UpdateVirtualService" + +// UpdateVirtualServiceRequest generates a "aws/request.Request" representing the +// client's request for the UpdateVirtualService operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateVirtualService for more information on using the UpdateVirtualService +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UpdateVirtualServiceRequest method. +// req, resp := client.UpdateVirtualServiceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateVirtualService +func (c *AppMeshPreview) UpdateVirtualServiceRequest(input *UpdateVirtualServiceInput) (req *request.Request, output *UpdateVirtualServiceOutput) { + op := &request.Operation{ + Name: opUpdateVirtualService, + HTTPMethod: "PUT", + HTTPPath: "/v20190125/meshes/{meshName}/virtualServices/{virtualServiceName}", + } + + if input == nil { + input = &UpdateVirtualServiceInput{} + } + + output = &UpdateVirtualServiceOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateVirtualService API operation for AWS App Mesh Preview. +// +// Updates an existing virtual service in a specified service mesh. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for AWS App Mesh Preview's +// API operation UpdateVirtualService for usage and error information. +// +// Returned Error Codes: +// * ErrCodeBadRequestException "BadRequestException" +// The request syntax was malformed. Check your request syntax and try again. +// +// * ErrCodeConflictException "ConflictException" +// The request contains a client token that was used for a previous update resource +// call with different specifications. Try the request again with a new client +// token. +// +// * ErrCodeForbiddenException "ForbiddenException" +// You don't have permissions to perform this action. +// +// * ErrCodeInternalServerErrorException "InternalServerErrorException" +// The request processing has failed because of an unknown error, exception, +// or failure. +// +// * ErrCodeLimitExceededException "LimitExceededException" +// You have exceeded a service limit for your account. For more information, +// see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) +// in the AWS App Mesh User Guide. +// +// * ErrCodeNotFoundException "NotFoundException" +// The specified resource doesn't exist. Check your request syntax and try again. +// +// * ErrCodeServiceUnavailableException "ServiceUnavailableException" +// The request has failed due to a temporary failure of the service. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// The maximum request rate permitted by the App Mesh APIs has been exceeded +// for your account. For best results, use an increasing or variable sleep interval +// between requests. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25/UpdateVirtualService +func (c *AppMeshPreview) UpdateVirtualService(input *UpdateVirtualServiceInput) (*UpdateVirtualServiceOutput, error) { + req, out := c.UpdateVirtualServiceRequest(input) + return out, req.Send() +} + +// UpdateVirtualServiceWithContext is the same as UpdateVirtualService with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateVirtualService for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *AppMeshPreview) UpdateVirtualServiceWithContext(ctx aws.Context, input *UpdateVirtualServiceInput, opts ...request.Option) (*UpdateVirtualServiceOutput, error) { + req, out := c.UpdateVirtualServiceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// An object representing the access logging information for a virtual node. +type AccessLog struct { + _ struct{} `type:"structure"` + + // The file object to send virtual node access logs to. + File *FileAccessLog `locationName:"file" type:"structure"` +} + +// String returns the string representation +func (s AccessLog) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AccessLog) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AccessLog) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AccessLog"} + if s.File != nil { + if err := s.File.Validate(); err != nil { + invalidParams.AddNested("File", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFile sets the File field's value. +func (s *AccessLog) SetFile(v *FileAccessLog) *AccessLog { + s.File = v + return s +} + +// An object representing the AWS Cloud Map attribute information for your virtual +// node. +type AwsCloudMapInstanceAttribute struct { + _ struct{} `type:"structure"` + + // The name of an AWS Cloud Map service instance attribute key. Any AWS Cloud + // Map service instance that contains the specified key and value is returned. + // + // Key is a required field + Key *string `locationName:"key" min:"1" type:"string" required:"true"` + + // The value of an AWS Cloud Map service instance attribute key. Any AWS Cloud + // Map service instance that contains the specified key and value is returned. + // + // Value is a required field + Value *string `locationName:"value" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s AwsCloudMapInstanceAttribute) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AwsCloudMapInstanceAttribute) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AwsCloudMapInstanceAttribute) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AwsCloudMapInstanceAttribute"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + if s.Value == nil { + invalidParams.Add(request.NewErrParamRequired("Value")) + } + if s.Value != nil && len(*s.Value) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Value", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKey sets the Key field's value. +func (s *AwsCloudMapInstanceAttribute) SetKey(v string) *AwsCloudMapInstanceAttribute { + s.Key = &v + return s +} + +// SetValue sets the Value field's value. +func (s *AwsCloudMapInstanceAttribute) SetValue(v string) *AwsCloudMapInstanceAttribute { + s.Value = &v + return s +} + +// An object representing the AWS Cloud Map service discovery information for +// your virtual node. +type AwsCloudMapServiceDiscovery struct { + _ struct{} `type:"structure"` + + // A string map that contains attributes with values that you can use to filter + // instances by any custom attribute that you specified when you registered + // the instance. Only instances that match all of the specified key/value pairs + // will be returned. + Attributes []*AwsCloudMapInstanceAttribute `locationName:"attributes" type:"list"` + + // The name of the AWS Cloud Map namespace to use. + // + // NamespaceName is a required field + NamespaceName *string `locationName:"namespaceName" min:"1" type:"string" required:"true"` + + // The name of the AWS Cloud Map service to use. + // + // ServiceName is a required field + ServiceName *string `locationName:"serviceName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s AwsCloudMapServiceDiscovery) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s AwsCloudMapServiceDiscovery) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *AwsCloudMapServiceDiscovery) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "AwsCloudMapServiceDiscovery"} + if s.NamespaceName == nil { + invalidParams.Add(request.NewErrParamRequired("NamespaceName")) + } + if s.NamespaceName != nil && len(*s.NamespaceName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NamespaceName", 1)) + } + if s.ServiceName == nil { + invalidParams.Add(request.NewErrParamRequired("ServiceName")) + } + if s.ServiceName != nil && len(*s.ServiceName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ServiceName", 1)) + } + if s.Attributes != nil { + for i, v := range s.Attributes { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Attributes", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAttributes sets the Attributes field's value. +func (s *AwsCloudMapServiceDiscovery) SetAttributes(v []*AwsCloudMapInstanceAttribute) *AwsCloudMapServiceDiscovery { + s.Attributes = v + return s +} + +// SetNamespaceName sets the NamespaceName field's value. +func (s *AwsCloudMapServiceDiscovery) SetNamespaceName(v string) *AwsCloudMapServiceDiscovery { + s.NamespaceName = &v + return s +} + +// SetServiceName sets the ServiceName field's value. +func (s *AwsCloudMapServiceDiscovery) SetServiceName(v string) *AwsCloudMapServiceDiscovery { + s.ServiceName = &v + return s +} + +// An object representing the backends that a virtual node is expected to send +// outbound traffic to. +type Backend struct { + _ struct{} `type:"structure"` + + // Specifies a virtual service to use as a backend for a virtual node. + VirtualService *VirtualServiceBackend `locationName:"virtualService" type:"structure"` +} + +// String returns the string representation +func (s Backend) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Backend) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Backend) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Backend"} + if s.VirtualService != nil { + if err := s.VirtualService.Validate(); err != nil { + invalidParams.AddNested("VirtualService", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetVirtualService sets the VirtualService field's value. +func (s *Backend) SetVirtualService(v *VirtualServiceBackend) *Backend { + s.VirtualService = v + return s +} + +type CreateMeshInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name to use for the service mesh. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The service mesh specification to apply. + Spec *MeshSpec `locationName:"spec" type:"structure"` + + // Optional metadata that you can apply to the service mesh to assist with categorization + // and organization. Each tag consists of a key and an optional value, both + // of which you define. Tag keys can have a maximum character length of 128 + // characters, and tag values can have a maximum length of 256 characters. + Tags []*TagRef `locationName:"tags" type:"list"` +} + +// String returns the string representation +func (s CreateMeshInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateMeshInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateMeshInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateMeshInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateMeshInput) SetClientToken(v string) *CreateMeshInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *CreateMeshInput) SetMeshName(v string) *CreateMeshInput { + s.MeshName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *CreateMeshInput) SetSpec(v *MeshSpec) *CreateMeshInput { + s.Spec = v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateMeshInput) SetTags(v []*TagRef) *CreateMeshInput { + s.Tags = v + return s +} + +type CreateMeshOutput struct { + _ struct{} `type:"structure" payload:"Mesh"` + + // The full description of your service mesh following the create call. + // + // Mesh is a required field + Mesh *MeshData `locationName:"mesh" type:"structure" required:"true"` +} + +// String returns the string representation +func (s CreateMeshOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateMeshOutput) GoString() string { + return s.String() +} + +// SetMesh sets the Mesh field's value. +func (s *CreateMeshOutput) SetMesh(v *MeshData) *CreateMeshOutput { + s.Mesh = v + return s +} + +type CreateRouteInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh to create the route in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name to use for the route. + // + // RouteName is a required field + RouteName *string `locationName:"routeName" min:"1" type:"string" required:"true"` + + // The route specification to apply. + // + // Spec is a required field + Spec *RouteSpec `locationName:"spec" type:"structure" required:"true"` + + // Optional metadata that you can apply to the route to assist with categorization + // and organization. Each tag consists of a key and an optional value, both + // of which you define. Tag keys can have a maximum character length of 128 + // characters, and tag values can have a maximum length of 256 characters. + Tags []*TagRef `locationName:"tags" type:"list"` + + // The name of the virtual router in which to create the route. + // + // VirtualRouterName is a required field + VirtualRouterName *string `location:"uri" locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateRouteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRouteInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateRouteInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.RouteName == nil { + invalidParams.Add(request.NewErrParamRequired("RouteName")) + } + if s.RouteName != nil && len(*s.RouteName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RouteName", 1)) + } + if s.Spec == nil { + invalidParams.Add(request.NewErrParamRequired("Spec")) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateRouteInput) SetClientToken(v string) *CreateRouteInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *CreateRouteInput) SetMeshName(v string) *CreateRouteInput { + s.MeshName = &v + return s +} + +// SetRouteName sets the RouteName field's value. +func (s *CreateRouteInput) SetRouteName(v string) *CreateRouteInput { + s.RouteName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *CreateRouteInput) SetSpec(v *RouteSpec) *CreateRouteInput { + s.Spec = v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateRouteInput) SetTags(v []*TagRef) *CreateRouteInput { + s.Tags = v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *CreateRouteInput) SetVirtualRouterName(v string) *CreateRouteInput { + s.VirtualRouterName = &v + return s +} + +type CreateRouteOutput struct { + _ struct{} `type:"structure" payload:"Route"` + + // The full description of your mesh following the create call. + // + // Route is a required field + Route *RouteData `locationName:"route" type:"structure" required:"true"` +} + +// String returns the string representation +func (s CreateRouteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRouteOutput) GoString() string { + return s.String() +} + +// SetRoute sets the Route field's value. +func (s *CreateRouteOutput) SetRoute(v *RouteData) *CreateRouteOutput { + s.Route = v + return s +} + +type CreateVirtualNodeInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh to create the virtual node in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The virtual node specification to apply. + // + // Spec is a required field + Spec *VirtualNodeSpec `locationName:"spec" type:"structure" required:"true"` + + // Optional metadata that you can apply to the virtual node to assist with categorization + // and organization. Each tag consists of a key and an optional value, both + // of which you define. Tag keys can have a maximum character length of 128 + // characters, and tag values can have a maximum length of 256 characters. + Tags []*TagRef `locationName:"tags" type:"list"` + + // The name to use for the virtual node. + // + // VirtualNodeName is a required field + VirtualNodeName *string `locationName:"virtualNodeName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateVirtualNodeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVirtualNodeInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVirtualNodeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVirtualNodeInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.Spec == nil { + invalidParams.Add(request.NewErrParamRequired("Spec")) + } + if s.VirtualNodeName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualNodeName")) + } + if s.VirtualNodeName != nil && len(*s.VirtualNodeName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualNodeName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateVirtualNodeInput) SetClientToken(v string) *CreateVirtualNodeInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *CreateVirtualNodeInput) SetMeshName(v string) *CreateVirtualNodeInput { + s.MeshName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *CreateVirtualNodeInput) SetSpec(v *VirtualNodeSpec) *CreateVirtualNodeInput { + s.Spec = v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateVirtualNodeInput) SetTags(v []*TagRef) *CreateVirtualNodeInput { + s.Tags = v + return s +} + +// SetVirtualNodeName sets the VirtualNodeName field's value. +func (s *CreateVirtualNodeInput) SetVirtualNodeName(v string) *CreateVirtualNodeInput { + s.VirtualNodeName = &v + return s +} + +type CreateVirtualNodeOutput struct { + _ struct{} `type:"structure" payload:"VirtualNode"` + + // The full description of your virtual node following the create call. + // + // VirtualNode is a required field + VirtualNode *VirtualNodeData `locationName:"virtualNode" type:"structure" required:"true"` +} + +// String returns the string representation +func (s CreateVirtualNodeOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVirtualNodeOutput) GoString() string { + return s.String() +} + +// SetVirtualNode sets the VirtualNode field's value. +func (s *CreateVirtualNodeOutput) SetVirtualNode(v *VirtualNodeData) *CreateVirtualNodeOutput { + s.VirtualNode = v + return s +} + +type CreateVirtualRouterInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh to create the virtual router in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The virtual router specification to apply. + // + // Spec is a required field + Spec *VirtualRouterSpec `locationName:"spec" type:"structure" required:"true"` + + // Optional metadata that you can apply to the virtual router to assist with + // categorization and organization. Each tag consists of a key and an optional + // value, both of which you define. Tag keys can have a maximum character length + // of 128 characters, and tag values can have a maximum length of 256 characters. + Tags []*TagRef `locationName:"tags" type:"list"` + + // The name to use for the virtual router. + // + // VirtualRouterName is a required field + VirtualRouterName *string `locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateVirtualRouterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVirtualRouterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVirtualRouterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVirtualRouterInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.Spec == nil { + invalidParams.Add(request.NewErrParamRequired("Spec")) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateVirtualRouterInput) SetClientToken(v string) *CreateVirtualRouterInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *CreateVirtualRouterInput) SetMeshName(v string) *CreateVirtualRouterInput { + s.MeshName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *CreateVirtualRouterInput) SetSpec(v *VirtualRouterSpec) *CreateVirtualRouterInput { + s.Spec = v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateVirtualRouterInput) SetTags(v []*TagRef) *CreateVirtualRouterInput { + s.Tags = v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *CreateVirtualRouterInput) SetVirtualRouterName(v string) *CreateVirtualRouterInput { + s.VirtualRouterName = &v + return s +} + +type CreateVirtualRouterOutput struct { + _ struct{} `type:"structure" payload:"VirtualRouter"` + + // The full description of your virtual router following the create call. + // + // VirtualRouter is a required field + VirtualRouter *VirtualRouterData `locationName:"virtualRouter" type:"structure" required:"true"` +} + +// String returns the string representation +func (s CreateVirtualRouterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVirtualRouterOutput) GoString() string { + return s.String() +} + +// SetVirtualRouter sets the VirtualRouter field's value. +func (s *CreateVirtualRouterOutput) SetVirtualRouter(v *VirtualRouterData) *CreateVirtualRouterOutput { + s.VirtualRouter = v + return s +} + +type CreateVirtualServiceInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh to create the virtual service in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The virtual service specification to apply. + // + // Spec is a required field + Spec *VirtualServiceSpec `locationName:"spec" type:"structure" required:"true"` + + // Optional metadata that you can apply to the virtual service to assist with + // categorization and organization. Each tag consists of a key and an optional + // value, both of which you define. Tag keys can have a maximum character length + // of 128 characters, and tag values can have a maximum length of 256 characters. + Tags []*TagRef `locationName:"tags" type:"list"` + + // The name to use for the virtual service. + // + // VirtualServiceName is a required field + VirtualServiceName *string `locationName:"virtualServiceName" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateVirtualServiceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVirtualServiceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateVirtualServiceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateVirtualServiceInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.Spec == nil { + invalidParams.Add(request.NewErrParamRequired("Spec")) + } + if s.VirtualServiceName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualServiceName")) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *CreateVirtualServiceInput) SetClientToken(v string) *CreateVirtualServiceInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *CreateVirtualServiceInput) SetMeshName(v string) *CreateVirtualServiceInput { + s.MeshName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *CreateVirtualServiceInput) SetSpec(v *VirtualServiceSpec) *CreateVirtualServiceInput { + s.Spec = v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateVirtualServiceInput) SetTags(v []*TagRef) *CreateVirtualServiceInput { + s.Tags = v + return s +} + +// SetVirtualServiceName sets the VirtualServiceName field's value. +func (s *CreateVirtualServiceInput) SetVirtualServiceName(v string) *CreateVirtualServiceInput { + s.VirtualServiceName = &v + return s +} + +type CreateVirtualServiceOutput struct { + _ struct{} `type:"structure" payload:"VirtualService"` + + // The full description of your virtual service following the create call. + // + // VirtualService is a required field + VirtualService *VirtualServiceData `locationName:"virtualService" type:"structure" required:"true"` +} + +// String returns the string representation +func (s CreateVirtualServiceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateVirtualServiceOutput) GoString() string { + return s.String() +} + +// SetVirtualService sets the VirtualService field's value. +func (s *CreateVirtualServiceOutput) SetVirtualService(v *VirtualServiceData) *CreateVirtualServiceOutput { + s.VirtualService = v + return s +} + +type DeleteMeshInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh to delete. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteMeshInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteMeshInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteMeshInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteMeshInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DeleteMeshInput) SetMeshName(v string) *DeleteMeshInput { + s.MeshName = &v + return s +} + +type DeleteMeshOutput struct { + _ struct{} `type:"structure" payload:"Mesh"` + + // The service mesh that was deleted. + // + // Mesh is a required field + Mesh *MeshData `locationName:"mesh" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DeleteMeshOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteMeshOutput) GoString() string { + return s.String() +} + +// SetMesh sets the Mesh field's value. +func (s *DeleteMeshOutput) SetMesh(v *MeshData) *DeleteMeshOutput { + s.Mesh = v + return s +} + +type DeleteRouteInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh to delete the route in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the route to delete. + // + // RouteName is a required field + RouteName *string `location:"uri" locationName:"routeName" min:"1" type:"string" required:"true"` + + // The name of the virtual router to delete the route in. + // + // VirtualRouterName is a required field + VirtualRouterName *string `location:"uri" locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteRouteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRouteInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRouteInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.RouteName == nil { + invalidParams.Add(request.NewErrParamRequired("RouteName")) + } + if s.RouteName != nil && len(*s.RouteName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RouteName", 1)) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DeleteRouteInput) SetMeshName(v string) *DeleteRouteInput { + s.MeshName = &v + return s +} + +// SetRouteName sets the RouteName field's value. +func (s *DeleteRouteInput) SetRouteName(v string) *DeleteRouteInput { + s.RouteName = &v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *DeleteRouteInput) SetVirtualRouterName(v string) *DeleteRouteInput { + s.VirtualRouterName = &v + return s +} + +type DeleteRouteOutput struct { + _ struct{} `type:"structure" payload:"Route"` + + // The route that was deleted. + // + // Route is a required field + Route *RouteData `locationName:"route" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DeleteRouteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRouteOutput) GoString() string { + return s.String() +} + +// SetRoute sets the Route field's value. +func (s *DeleteRouteOutput) SetRoute(v *RouteData) *DeleteRouteOutput { + s.Route = v + return s +} + +type DeleteVirtualNodeInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh to delete the virtual node in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual node to delete. + // + // VirtualNodeName is a required field + VirtualNodeName *string `location:"uri" locationName:"virtualNodeName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteVirtualNodeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVirtualNodeInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVirtualNodeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVirtualNodeInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.VirtualNodeName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualNodeName")) + } + if s.VirtualNodeName != nil && len(*s.VirtualNodeName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualNodeName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DeleteVirtualNodeInput) SetMeshName(v string) *DeleteVirtualNodeInput { + s.MeshName = &v + return s +} + +// SetVirtualNodeName sets the VirtualNodeName field's value. +func (s *DeleteVirtualNodeInput) SetVirtualNodeName(v string) *DeleteVirtualNodeInput { + s.VirtualNodeName = &v + return s +} + +type DeleteVirtualNodeOutput struct { + _ struct{} `type:"structure" payload:"VirtualNode"` + + // The virtual node that was deleted. + // + // VirtualNode is a required field + VirtualNode *VirtualNodeData `locationName:"virtualNode" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DeleteVirtualNodeOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVirtualNodeOutput) GoString() string { + return s.String() +} + +// SetVirtualNode sets the VirtualNode field's value. +func (s *DeleteVirtualNodeOutput) SetVirtualNode(v *VirtualNodeData) *DeleteVirtualNodeOutput { + s.VirtualNode = v + return s +} + +type DeleteVirtualRouterInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh to delete the virtual router in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual router to delete. + // + // VirtualRouterName is a required field + VirtualRouterName *string `location:"uri" locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteVirtualRouterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVirtualRouterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVirtualRouterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVirtualRouterInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DeleteVirtualRouterInput) SetMeshName(v string) *DeleteVirtualRouterInput { + s.MeshName = &v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *DeleteVirtualRouterInput) SetVirtualRouterName(v string) *DeleteVirtualRouterInput { + s.VirtualRouterName = &v + return s +} + +type DeleteVirtualRouterOutput struct { + _ struct{} `type:"structure" payload:"VirtualRouter"` + + // The virtual router that was deleted. + // + // VirtualRouter is a required field + VirtualRouter *VirtualRouterData `locationName:"virtualRouter" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DeleteVirtualRouterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVirtualRouterOutput) GoString() string { + return s.String() +} + +// SetVirtualRouter sets the VirtualRouter field's value. +func (s *DeleteVirtualRouterOutput) SetVirtualRouter(v *VirtualRouterData) *DeleteVirtualRouterOutput { + s.VirtualRouter = v + return s +} + +type DeleteVirtualServiceInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh to delete the virtual service in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual service to delete. + // + // VirtualServiceName is a required field + VirtualServiceName *string `location:"uri" locationName:"virtualServiceName" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteVirtualServiceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVirtualServiceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteVirtualServiceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteVirtualServiceInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.VirtualServiceName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualServiceName")) + } + if s.VirtualServiceName != nil && len(*s.VirtualServiceName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualServiceName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DeleteVirtualServiceInput) SetMeshName(v string) *DeleteVirtualServiceInput { + s.MeshName = &v + return s +} + +// SetVirtualServiceName sets the VirtualServiceName field's value. +func (s *DeleteVirtualServiceInput) SetVirtualServiceName(v string) *DeleteVirtualServiceInput { + s.VirtualServiceName = &v + return s +} + +type DeleteVirtualServiceOutput struct { + _ struct{} `type:"structure" payload:"VirtualService"` + + // The virtual service that was deleted. + // + // VirtualService is a required field + VirtualService *VirtualServiceData `locationName:"virtualService" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DeleteVirtualServiceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteVirtualServiceOutput) GoString() string { + return s.String() +} + +// SetVirtualService sets the VirtualService field's value. +func (s *DeleteVirtualServiceOutput) SetVirtualService(v *VirtualServiceData) *DeleteVirtualServiceOutput { + s.VirtualService = v + return s +} + +type DescribeMeshInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh to describe. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeMeshInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeMeshInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeMeshInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeMeshInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DescribeMeshInput) SetMeshName(v string) *DescribeMeshInput { + s.MeshName = &v + return s +} + +type DescribeMeshOutput struct { + _ struct{} `type:"structure" payload:"Mesh"` + + // The full description of your service mesh. + // + // Mesh is a required field + Mesh *MeshData `locationName:"mesh" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DescribeMeshOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeMeshOutput) GoString() string { + return s.String() +} + +// SetMesh sets the Mesh field's value. +func (s *DescribeMeshOutput) SetMesh(v *MeshData) *DescribeMeshOutput { + s.Mesh = v + return s +} + +type DescribeRouteInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh that the route resides in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the route to describe. + // + // RouteName is a required field + RouteName *string `location:"uri" locationName:"routeName" min:"1" type:"string" required:"true"` + + // The name of the virtual router that the route is associated with. + // + // VirtualRouterName is a required field + VirtualRouterName *string `location:"uri" locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeRouteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeRouteInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeRouteInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.RouteName == nil { + invalidParams.Add(request.NewErrParamRequired("RouteName")) + } + if s.RouteName != nil && len(*s.RouteName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RouteName", 1)) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DescribeRouteInput) SetMeshName(v string) *DescribeRouteInput { + s.MeshName = &v + return s +} + +// SetRouteName sets the RouteName field's value. +func (s *DescribeRouteInput) SetRouteName(v string) *DescribeRouteInput { + s.RouteName = &v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *DescribeRouteInput) SetVirtualRouterName(v string) *DescribeRouteInput { + s.VirtualRouterName = &v + return s +} + +type DescribeRouteOutput struct { + _ struct{} `type:"structure" payload:"Route"` + + // The full description of your route. + // + // Route is a required field + Route *RouteData `locationName:"route" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DescribeRouteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeRouteOutput) GoString() string { + return s.String() +} + +// SetRoute sets the Route field's value. +func (s *DescribeRouteOutput) SetRoute(v *RouteData) *DescribeRouteOutput { + s.Route = v + return s +} + +type DescribeVirtualNodeInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh that the virtual node resides in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual node to describe. + // + // VirtualNodeName is a required field + VirtualNodeName *string `location:"uri" locationName:"virtualNodeName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeVirtualNodeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVirtualNodeInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeVirtualNodeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeVirtualNodeInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.VirtualNodeName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualNodeName")) + } + if s.VirtualNodeName != nil && len(*s.VirtualNodeName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualNodeName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DescribeVirtualNodeInput) SetMeshName(v string) *DescribeVirtualNodeInput { + s.MeshName = &v + return s +} + +// SetVirtualNodeName sets the VirtualNodeName field's value. +func (s *DescribeVirtualNodeInput) SetVirtualNodeName(v string) *DescribeVirtualNodeInput { + s.VirtualNodeName = &v + return s +} + +type DescribeVirtualNodeOutput struct { + _ struct{} `type:"structure" payload:"VirtualNode"` + + // The full description of your virtual node. + // + // VirtualNode is a required field + VirtualNode *VirtualNodeData `locationName:"virtualNode" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DescribeVirtualNodeOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVirtualNodeOutput) GoString() string { + return s.String() +} + +// SetVirtualNode sets the VirtualNode field's value. +func (s *DescribeVirtualNodeOutput) SetVirtualNode(v *VirtualNodeData) *DescribeVirtualNodeOutput { + s.VirtualNode = v + return s +} + +type DescribeVirtualRouterInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh that the virtual router resides in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual router to describe. + // + // VirtualRouterName is a required field + VirtualRouterName *string `location:"uri" locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeVirtualRouterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVirtualRouterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeVirtualRouterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeVirtualRouterInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DescribeVirtualRouterInput) SetMeshName(v string) *DescribeVirtualRouterInput { + s.MeshName = &v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *DescribeVirtualRouterInput) SetVirtualRouterName(v string) *DescribeVirtualRouterInput { + s.VirtualRouterName = &v + return s +} + +type DescribeVirtualRouterOutput struct { + _ struct{} `type:"structure" payload:"VirtualRouter"` + + // The full description of your virtual router. + // + // VirtualRouter is a required field + VirtualRouter *VirtualRouterData `locationName:"virtualRouter" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DescribeVirtualRouterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVirtualRouterOutput) GoString() string { + return s.String() +} + +// SetVirtualRouter sets the VirtualRouter field's value. +func (s *DescribeVirtualRouterOutput) SetVirtualRouter(v *VirtualRouterData) *DescribeVirtualRouterOutput { + s.VirtualRouter = v + return s +} + +type DescribeVirtualServiceInput struct { + _ struct{} `type:"structure"` + + // The name of the service mesh that the virtual service resides in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual service to describe. + // + // VirtualServiceName is a required field + VirtualServiceName *string `location:"uri" locationName:"virtualServiceName" type:"string" required:"true"` +} + +// String returns the string representation +func (s DescribeVirtualServiceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVirtualServiceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeVirtualServiceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeVirtualServiceInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.VirtualServiceName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualServiceName")) + } + if s.VirtualServiceName != nil && len(*s.VirtualServiceName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualServiceName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMeshName sets the MeshName field's value. +func (s *DescribeVirtualServiceInput) SetMeshName(v string) *DescribeVirtualServiceInput { + s.MeshName = &v + return s +} + +// SetVirtualServiceName sets the VirtualServiceName field's value. +func (s *DescribeVirtualServiceInput) SetVirtualServiceName(v string) *DescribeVirtualServiceInput { + s.VirtualServiceName = &v + return s +} + +type DescribeVirtualServiceOutput struct { + _ struct{} `type:"structure" payload:"VirtualService"` + + // The full description of your virtual service. + // + // VirtualService is a required field + VirtualService *VirtualServiceData `locationName:"virtualService" type:"structure" required:"true"` +} + +// String returns the string representation +func (s DescribeVirtualServiceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeVirtualServiceOutput) GoString() string { + return s.String() +} + +// SetVirtualService sets the VirtualService field's value. +func (s *DescribeVirtualServiceOutput) SetVirtualService(v *VirtualServiceData) *DescribeVirtualServiceOutput { + s.VirtualService = v + return s +} + +// An object representing the DNS service discovery information for your virtual +// node. +type DnsServiceDiscovery struct { + _ struct{} `type:"structure"` + + // Specifies the DNS service discovery hostname for the virtual node. + // + // Hostname is a required field + Hostname *string `locationName:"hostname" type:"string" required:"true"` +} + +// String returns the string representation +func (s DnsServiceDiscovery) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DnsServiceDiscovery) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DnsServiceDiscovery) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DnsServiceDiscovery"} + if s.Hostname == nil { + invalidParams.Add(request.NewErrParamRequired("Hostname")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetHostname sets the Hostname field's value. +func (s *DnsServiceDiscovery) SetHostname(v string) *DnsServiceDiscovery { + s.Hostname = &v + return s +} + +// An object representing the egress filter rules for a service mesh. +type EgressFilter struct { + _ struct{} `type:"structure"` + + // The egress filter type. By default, the type is DROP_ALL, which allows egress + // only from virtual nodes to other defined resources in the service mesh (and + // any traffic to *.amazonaws.com for AWS API calls). You can set the egress + // filter type to ALLOW_ALL to allow egress to any endpoint inside or outside + // of the service mesh. + // + // Type is a required field + Type *string `locationName:"type" type:"string" required:"true" enum:"EgressFilterType"` +} + +// String returns the string representation +func (s EgressFilter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EgressFilter) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *EgressFilter) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EgressFilter"} + if s.Type == nil { + invalidParams.Add(request.NewErrParamRequired("Type")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetType sets the Type field's value. +func (s *EgressFilter) SetType(v string) *EgressFilter { + s.Type = &v + return s +} + +// An object representing an access log file. +type FileAccessLog struct { + _ struct{} `type:"structure"` + + // The file path to write access logs to. You can use /dev/stdout to send access + // logs to standard out and configure your Envoy container to use a log driver, + // such as awslogs, to export the access logs to a log storage service such + // as Amazon CloudWatch Logs. You can also specify a path in the Envoy container's + // file system to write the files to disk. + // + // The Envoy process must have write permissions to the path that you specify + // here. Otherwise, Envoy fails to bootstrap properly. + // + // Path is a required field + Path *string `locationName:"path" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s FileAccessLog) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FileAccessLog) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *FileAccessLog) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "FileAccessLog"} + if s.Path == nil { + invalidParams.Add(request.NewErrParamRequired("Path")) + } + if s.Path != nil && len(*s.Path) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Path", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPath sets the Path field's value. +func (s *FileAccessLog) SetPath(v string) *FileAccessLog { + s.Path = &v + return s +} + +type HeaderMatchMethod struct { + _ struct{} `type:"structure"` + + Exact *string `locationName:"exact" min:"1" type:"string"` + + Prefix *string `locationName:"prefix" min:"1" type:"string"` + + Range *MatchRange `locationName:"range" type:"structure"` + + Regex *string `locationName:"regex" min:"1" type:"string"` + + Suffix *string `locationName:"suffix" min:"1" type:"string"` +} + +// String returns the string representation +func (s HeaderMatchMethod) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HeaderMatchMethod) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HeaderMatchMethod) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HeaderMatchMethod"} + if s.Exact != nil && len(*s.Exact) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Exact", 1)) + } + if s.Prefix != nil && len(*s.Prefix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Prefix", 1)) + } + if s.Regex != nil && len(*s.Regex) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Regex", 1)) + } + if s.Suffix != nil && len(*s.Suffix) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Suffix", 1)) + } + if s.Range != nil { + if err := s.Range.Validate(); err != nil { + invalidParams.AddNested("Range", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetExact sets the Exact field's value. +func (s *HeaderMatchMethod) SetExact(v string) *HeaderMatchMethod { + s.Exact = &v + return s +} + +// SetPrefix sets the Prefix field's value. +func (s *HeaderMatchMethod) SetPrefix(v string) *HeaderMatchMethod { + s.Prefix = &v + return s +} + +// SetRange sets the Range field's value. +func (s *HeaderMatchMethod) SetRange(v *MatchRange) *HeaderMatchMethod { + s.Range = v + return s +} + +// SetRegex sets the Regex field's value. +func (s *HeaderMatchMethod) SetRegex(v string) *HeaderMatchMethod { + s.Regex = &v + return s +} + +// SetSuffix sets the Suffix field's value. +func (s *HeaderMatchMethod) SetSuffix(v string) *HeaderMatchMethod { + s.Suffix = &v + return s +} + +// An object representing the health check policy for a virtual node's listener. +type HealthCheckPolicy struct { + _ struct{} `type:"structure"` + + // The number of consecutive successful health checks that must occur before + // declaring listener healthy. + // + // HealthyThreshold is a required field + HealthyThreshold *int64 `locationName:"healthyThreshold" min:"2" type:"integer" required:"true"` + + // The time period in milliseconds between each health check execution. + // + // IntervalMillis is a required field + IntervalMillis *int64 `locationName:"intervalMillis" min:"5000" type:"long" required:"true"` + + // The destination path for the health check request. This is required only + // if the specified protocol is HTTP. If the protocol is TCP, this parameter + // is ignored. + Path *string `locationName:"path" type:"string"` + + // The destination port for the health check request. This port must match the + // port defined in the PortMapping for the listener. + Port *int64 `locationName:"port" min:"1" type:"integer"` + + // The protocol for the health check request. + // + // Protocol is a required field + Protocol *string `locationName:"protocol" type:"string" required:"true" enum:"PortProtocol"` + + // The amount of time to wait when receiving a response from the health check, + // in milliseconds. + // + // TimeoutMillis is a required field + TimeoutMillis *int64 `locationName:"timeoutMillis" min:"2000" type:"long" required:"true"` + + // The number of consecutive failed health checks that must occur before declaring + // a virtual node unhealthy. + // + // UnhealthyThreshold is a required field + UnhealthyThreshold *int64 `locationName:"unhealthyThreshold" min:"2" type:"integer" required:"true"` +} + +// String returns the string representation +func (s HealthCheckPolicy) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HealthCheckPolicy) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HealthCheckPolicy) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HealthCheckPolicy"} + if s.HealthyThreshold == nil { + invalidParams.Add(request.NewErrParamRequired("HealthyThreshold")) + } + if s.HealthyThreshold != nil && *s.HealthyThreshold < 2 { + invalidParams.Add(request.NewErrParamMinValue("HealthyThreshold", 2)) + } + if s.IntervalMillis == nil { + invalidParams.Add(request.NewErrParamRequired("IntervalMillis")) + } + if s.IntervalMillis != nil && *s.IntervalMillis < 5000 { + invalidParams.Add(request.NewErrParamMinValue("IntervalMillis", 5000)) + } + if s.Port != nil && *s.Port < 1 { + invalidParams.Add(request.NewErrParamMinValue("Port", 1)) + } + if s.Protocol == nil { + invalidParams.Add(request.NewErrParamRequired("Protocol")) + } + if s.TimeoutMillis == nil { + invalidParams.Add(request.NewErrParamRequired("TimeoutMillis")) + } + if s.TimeoutMillis != nil && *s.TimeoutMillis < 2000 { + invalidParams.Add(request.NewErrParamMinValue("TimeoutMillis", 2000)) + } + if s.UnhealthyThreshold == nil { + invalidParams.Add(request.NewErrParamRequired("UnhealthyThreshold")) + } + if s.UnhealthyThreshold != nil && *s.UnhealthyThreshold < 2 { + invalidParams.Add(request.NewErrParamMinValue("UnhealthyThreshold", 2)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetHealthyThreshold sets the HealthyThreshold field's value. +func (s *HealthCheckPolicy) SetHealthyThreshold(v int64) *HealthCheckPolicy { + s.HealthyThreshold = &v + return s +} + +// SetIntervalMillis sets the IntervalMillis field's value. +func (s *HealthCheckPolicy) SetIntervalMillis(v int64) *HealthCheckPolicy { + s.IntervalMillis = &v + return s +} + +// SetPath sets the Path field's value. +func (s *HealthCheckPolicy) SetPath(v string) *HealthCheckPolicy { + s.Path = &v + return s +} + +// SetPort sets the Port field's value. +func (s *HealthCheckPolicy) SetPort(v int64) *HealthCheckPolicy { + s.Port = &v + return s +} + +// SetProtocol sets the Protocol field's value. +func (s *HealthCheckPolicy) SetProtocol(v string) *HealthCheckPolicy { + s.Protocol = &v + return s +} + +// SetTimeoutMillis sets the TimeoutMillis field's value. +func (s *HealthCheckPolicy) SetTimeoutMillis(v int64) *HealthCheckPolicy { + s.TimeoutMillis = &v + return s +} + +// SetUnhealthyThreshold sets the UnhealthyThreshold field's value. +func (s *HealthCheckPolicy) SetUnhealthyThreshold(v int64) *HealthCheckPolicy { + s.UnhealthyThreshold = &v + return s +} + +// An object representing the HTTP routing specification for a route. +type HttpRoute struct { + _ struct{} `type:"structure"` + + // The action to take if a match is determined. + // + // Action is a required field + Action *HttpRouteAction `locationName:"action" type:"structure" required:"true"` + + // The criteria for determining an HTTP request match. + // + // Match is a required field + Match *HttpRouteMatch `locationName:"match" type:"structure" required:"true"` +} + +// String returns the string representation +func (s HttpRoute) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HttpRoute) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HttpRoute) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HttpRoute"} + if s.Action == nil { + invalidParams.Add(request.NewErrParamRequired("Action")) + } + if s.Match == nil { + invalidParams.Add(request.NewErrParamRequired("Match")) + } + if s.Action != nil { + if err := s.Action.Validate(); err != nil { + invalidParams.AddNested("Action", err.(request.ErrInvalidParams)) + } + } + if s.Match != nil { + if err := s.Match.Validate(); err != nil { + invalidParams.AddNested("Match", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAction sets the Action field's value. +func (s *HttpRoute) SetAction(v *HttpRouteAction) *HttpRoute { + s.Action = v + return s +} + +// SetMatch sets the Match field's value. +func (s *HttpRoute) SetMatch(v *HttpRouteMatch) *HttpRoute { + s.Match = v + return s +} + +// An object representing the traffic distribution requirements for matched +// HTTP requests. +type HttpRouteAction struct { + _ struct{} `type:"structure"` + + // The targets that traffic is routed to when a request matches the route. You + // can specify one or more targets and their relative weights to distribute + // traffic with. + // + // WeightedTargets is a required field + WeightedTargets []*WeightedTarget `locationName:"weightedTargets" min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s HttpRouteAction) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HttpRouteAction) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HttpRouteAction) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HttpRouteAction"} + if s.WeightedTargets == nil { + invalidParams.Add(request.NewErrParamRequired("WeightedTargets")) + } + if s.WeightedTargets != nil && len(s.WeightedTargets) < 1 { + invalidParams.Add(request.NewErrParamMinLen("WeightedTargets", 1)) + } + if s.WeightedTargets != nil { + for i, v := range s.WeightedTargets { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "WeightedTargets", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetWeightedTargets sets the WeightedTargets field's value. +func (s *HttpRouteAction) SetWeightedTargets(v []*WeightedTarget) *HttpRouteAction { + s.WeightedTargets = v + return s +} + +type HttpRouteHeader struct { + _ struct{} `type:"structure"` + + Invert *bool `locationName:"invert" type:"boolean"` + + Match *HeaderMatchMethod `locationName:"match" type:"structure"` + + // Name is a required field + Name *string `locationName:"name" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s HttpRouteHeader) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HttpRouteHeader) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HttpRouteHeader) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HttpRouteHeader"} + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.Match != nil { + if err := s.Match.Validate(); err != nil { + invalidParams.AddNested("Match", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetInvert sets the Invert field's value. +func (s *HttpRouteHeader) SetInvert(v bool) *HttpRouteHeader { + s.Invert = &v + return s +} + +// SetMatch sets the Match field's value. +func (s *HttpRouteHeader) SetMatch(v *HeaderMatchMethod) *HttpRouteHeader { + s.Match = v + return s +} + +// SetName sets the Name field's value. +func (s *HttpRouteHeader) SetName(v string) *HttpRouteHeader { + s.Name = &v + return s +} + +// An object representing the requirements for a route to match HTTP requests +// for a virtual router. +type HttpRouteMatch struct { + _ struct{} `type:"structure"` + + Headers []*HttpRouteHeader `locationName:"headers" min:"1" type:"list"` + + Method *string `locationName:"method" type:"string" enum:"HttpMethod"` + + // Specifies the path to match requests with. This parameter must always start + // with /, which by itself matches all requests to the virtual service name. + // You can also match for path-based routing of requests. For example, if your + // virtual service name is my-service.local and you want the route to match + // requests to my-service.local/metrics, your prefix should be /metrics. + // + // Prefix is a required field + Prefix *string `locationName:"prefix" type:"string" required:"true"` + + Scheme *string `locationName:"scheme" type:"string" enum:"HttpScheme"` +} + +// String returns the string representation +func (s HttpRouteMatch) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HttpRouteMatch) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HttpRouteMatch) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HttpRouteMatch"} + if s.Headers != nil && len(s.Headers) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Headers", 1)) + } + if s.Prefix == nil { + invalidParams.Add(request.NewErrParamRequired("Prefix")) + } + if s.Headers != nil { + for i, v := range s.Headers { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Headers", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetHeaders sets the Headers field's value. +func (s *HttpRouteMatch) SetHeaders(v []*HttpRouteHeader) *HttpRouteMatch { + s.Headers = v + return s +} + +// SetMethod sets the Method field's value. +func (s *HttpRouteMatch) SetMethod(v string) *HttpRouteMatch { + s.Method = &v + return s +} + +// SetPrefix sets the Prefix field's value. +func (s *HttpRouteMatch) SetPrefix(v string) *HttpRouteMatch { + s.Prefix = &v + return s +} + +// SetScheme sets the Scheme field's value. +func (s *HttpRouteMatch) SetScheme(v string) *HttpRouteMatch { + s.Scheme = &v + return s +} + +type ListMeshesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results returned by ListMeshes in paginated output. + // When you use this parameter, ListMeshes returns only limit results in a single + // page along with a nextToken response element. You can see the remaining results + // of the initial request by sending another ListMeshes request with the returned + // nextToken value. This value can be between 1 and 100. If you don't use this + // parameter, ListMeshes returns up to 100 results and a nextToken value if + // applicable. + Limit *int64 `location:"querystring" locationName:"limit" min:"1" type:"integer"` + + // The nextToken value returned from a previous paginated ListMeshes request + // where limit was used and the results exceeded the value of that parameter. + // Pagination continues from the end of the previous results that returned the + // nextToken value. + // + // This token should be treated as an opaque identifier that is used only to + // retrieve the next items in a list and not for other programmatic purposes. + NextToken *string `location:"querystring" locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListMeshesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListMeshesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListMeshesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListMeshesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *ListMeshesInput) SetLimit(v int64) *ListMeshesInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListMeshesInput) SetNextToken(v string) *ListMeshesInput { + s.NextToken = &v + return s +} + +type ListMeshesOutput struct { + _ struct{} `type:"structure"` + + // The list of existing service meshes. + // + // Meshes is a required field + Meshes []*MeshRef `locationName:"meshes" type:"list" required:"true"` + + // The nextToken value to include in a future ListMeshes request. When the results + // of a ListMeshes request exceed limit, you can use this value to retrieve + // the next page of results. This value is null when there are no more results + // to return. + NextToken *string `locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListMeshesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListMeshesOutput) GoString() string { + return s.String() +} + +// SetMeshes sets the Meshes field's value. +func (s *ListMeshesOutput) SetMeshes(v []*MeshRef) *ListMeshesOutput { + s.Meshes = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListMeshesOutput) SetNextToken(v string) *ListMeshesOutput { + s.NextToken = &v + return s +} + +type ListRoutesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results returned by ListRoutes in paginated output. + // When you use this parameter, ListRoutes returns only limit results in a single + // page along with a nextToken response element. You can see the remaining results + // of the initial request by sending another ListRoutes request with the returned + // nextToken value. This value can be between 1 and 100. If you don't use this + // parameter, ListRoutes returns up to 100 results and a nextToken value if + // applicable. + Limit *int64 `location:"querystring" locationName:"limit" min:"1" type:"integer"` + + // The name of the service mesh to list routes in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The nextToken value returned from a previous paginated ListRoutes request + // where limit was used and the results exceeded the value of that parameter. + // Pagination continues from the end of the previous results that returned the + // nextToken value. + NextToken *string `location:"querystring" locationName:"nextToken" type:"string"` + + // The name of the virtual router to list routes in. + // + // VirtualRouterName is a required field + VirtualRouterName *string `location:"uri" locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListRoutesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListRoutesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListRoutesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListRoutesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *ListRoutesInput) SetLimit(v int64) *ListRoutesInput { + s.Limit = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *ListRoutesInput) SetMeshName(v string) *ListRoutesInput { + s.MeshName = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListRoutesInput) SetNextToken(v string) *ListRoutesInput { + s.NextToken = &v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *ListRoutesInput) SetVirtualRouterName(v string) *ListRoutesInput { + s.VirtualRouterName = &v + return s +} + +type ListRoutesOutput struct { + _ struct{} `type:"structure"` + + // The nextToken value to include in a future ListRoutes request. When the results + // of a ListRoutes request exceed limit, you can use this value to retrieve + // the next page of results. This value is null when there are no more results + // to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // The list of existing routes for the specified service mesh and virtual router. + // + // Routes is a required field + Routes []*RouteRef `locationName:"routes" type:"list" required:"true"` +} + +// String returns the string representation +func (s ListRoutesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListRoutesOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *ListRoutesOutput) SetNextToken(v string) *ListRoutesOutput { + s.NextToken = &v + return s +} + +// SetRoutes sets the Routes field's value. +func (s *ListRoutesOutput) SetRoutes(v []*RouteRef) *ListRoutesOutput { + s.Routes = v + return s +} + +type ListTagsForResourceInput struct { + _ struct{} `type:"structure"` + + // The maximum number of tag results returned by ListTagsForResource in paginated + // output. When this parameter is used, ListTagsForResource returns only limit + // results in a single page along with a nextToken response element. You can + // see the remaining results of the initial request by sending another ListTagsForResource + // request with the returned nextToken value. This value can be between 1 and + // 100. If you don't use this parameter, ListTagsForResource returns up to 100 + // results and a nextToken value if applicable. + Limit *int64 `location:"querystring" locationName:"limit" min:"1" type:"integer"` + + // The nextToken value returned from a previous paginated ListTagsForResource + // request where limit was used and the results exceeded the value of that parameter. + // Pagination continues from the end of the previous results that returned the + // nextToken value. + NextToken *string `location:"querystring" locationName:"nextToken" type:"string"` + + // The Amazon Resource Name (ARN) that identifies the resource to list the tags + // for. + // + // ResourceArn is a required field + ResourceArn *string `location:"querystring" locationName:"resourceArn" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListTagsForResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsForResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListTagsForResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListTagsForResourceInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.ResourceArn == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *ListTagsForResourceInput) SetLimit(v int64) *ListTagsForResourceInput { + s.Limit = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListTagsForResourceInput) SetNextToken(v string) *ListTagsForResourceInput { + s.NextToken = &v + return s +} + +// SetResourceArn sets the ResourceArn field's value. +func (s *ListTagsForResourceInput) SetResourceArn(v string) *ListTagsForResourceInput { + s.ResourceArn = &v + return s +} + +type ListTagsForResourceOutput struct { + _ struct{} `type:"structure"` + + // The nextToken value to include in a future ListTagsForResource request. When + // the results of a ListTagsForResource request exceed limit, you can use this + // value to retrieve the next page of results. This value is null when there + // are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // The tags for the resource. + // + // Tags is a required field + Tags []*TagRef `locationName:"tags" type:"list" required:"true"` +} + +// String returns the string representation +func (s ListTagsForResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListTagsForResourceOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *ListTagsForResourceOutput) SetNextToken(v string) *ListTagsForResourceOutput { + s.NextToken = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *ListTagsForResourceOutput) SetTags(v []*TagRef) *ListTagsForResourceOutput { + s.Tags = v + return s +} + +type ListVirtualNodesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results returned by ListVirtualNodes in paginated output. + // When you use this parameter, ListVirtualNodes returns only limit results + // in a single page along with a nextToken response element. You can see the + // remaining results of the initial request by sending another ListVirtualNodes + // request with the returned nextToken value. This value can be between 1 and + // 100. If you don't use this parameter, ListVirtualNodes returns up to 100 + // results and a nextToken value if applicable. + Limit *int64 `location:"querystring" locationName:"limit" min:"1" type:"integer"` + + // The name of the service mesh to list virtual nodes in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The nextToken value returned from a previous paginated ListVirtualNodes request + // where limit was used and the results exceeded the value of that parameter. + // Pagination continues from the end of the previous results that returned the + // nextToken value. + NextToken *string `location:"querystring" locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListVirtualNodesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListVirtualNodesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListVirtualNodesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListVirtualNodesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *ListVirtualNodesInput) SetLimit(v int64) *ListVirtualNodesInput { + s.Limit = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *ListVirtualNodesInput) SetMeshName(v string) *ListVirtualNodesInput { + s.MeshName = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListVirtualNodesInput) SetNextToken(v string) *ListVirtualNodesInput { + s.NextToken = &v + return s +} + +type ListVirtualNodesOutput struct { + _ struct{} `type:"structure"` + + // The nextToken value to include in a future ListVirtualNodes request. When + // the results of a ListVirtualNodes request exceed limit, you can use this + // value to retrieve the next page of results. This value is null when there + // are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // The list of existing virtual nodes for the specified service mesh. + // + // VirtualNodes is a required field + VirtualNodes []*VirtualNodeRef `locationName:"virtualNodes" type:"list" required:"true"` +} + +// String returns the string representation +func (s ListVirtualNodesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListVirtualNodesOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *ListVirtualNodesOutput) SetNextToken(v string) *ListVirtualNodesOutput { + s.NextToken = &v + return s +} + +// SetVirtualNodes sets the VirtualNodes field's value. +func (s *ListVirtualNodesOutput) SetVirtualNodes(v []*VirtualNodeRef) *ListVirtualNodesOutput { + s.VirtualNodes = v + return s +} + +type ListVirtualRoutersInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results returned by ListVirtualRouters in paginated + // output. When you use this parameter, ListVirtualRouters returns only limit + // results in a single page along with a nextToken response element. You can + // see the remaining results of the initial request by sending another ListVirtualRouters + // request with the returned nextToken value. This value can be between 1 and + // 100. If you don't use this parameter, ListVirtualRouters returns up to 100 + // results and a nextToken value if applicable. + Limit *int64 `location:"querystring" locationName:"limit" min:"1" type:"integer"` + + // The name of the service mesh to list virtual routers in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The nextToken value returned from a previous paginated ListVirtualRouters + // request where limit was used and the results exceeded the value of that parameter. + // Pagination continues from the end of the previous results that returned the + // nextToken value. + NextToken *string `location:"querystring" locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListVirtualRoutersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListVirtualRoutersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListVirtualRoutersInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListVirtualRoutersInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *ListVirtualRoutersInput) SetLimit(v int64) *ListVirtualRoutersInput { + s.Limit = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *ListVirtualRoutersInput) SetMeshName(v string) *ListVirtualRoutersInput { + s.MeshName = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListVirtualRoutersInput) SetNextToken(v string) *ListVirtualRoutersInput { + s.NextToken = &v + return s +} + +type ListVirtualRoutersOutput struct { + _ struct{} `type:"structure"` + + // The nextToken value to include in a future ListVirtualRouters request. When + // the results of a ListVirtualRouters request exceed limit, you can use this + // value to retrieve the next page of results. This value is null when there + // are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // The list of existing virtual routers for the specified service mesh. + // + // VirtualRouters is a required field + VirtualRouters []*VirtualRouterRef `locationName:"virtualRouters" type:"list" required:"true"` +} + +// String returns the string representation +func (s ListVirtualRoutersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListVirtualRoutersOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *ListVirtualRoutersOutput) SetNextToken(v string) *ListVirtualRoutersOutput { + s.NextToken = &v + return s +} + +// SetVirtualRouters sets the VirtualRouters field's value. +func (s *ListVirtualRoutersOutput) SetVirtualRouters(v []*VirtualRouterRef) *ListVirtualRoutersOutput { + s.VirtualRouters = v + return s +} + +type ListVirtualServicesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results returned by ListVirtualServices in paginated + // output. When you use this parameter, ListVirtualServices returns only limit + // results in a single page along with a nextToken response element. You can + // see the remaining results of the initial request by sending another ListVirtualServices + // request with the returned nextToken value. This value can be between 1 and + // 100. If you don't use this parameter, ListVirtualServices returns up to 100 + // results and a nextToken value if applicable. + Limit *int64 `location:"querystring" locationName:"limit" min:"1" type:"integer"` + + // The name of the service mesh to list virtual services in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The nextToken value returned from a previous paginated ListVirtualServices + // request where limit was used and the results exceeded the value of that parameter. + // Pagination continues from the end of the previous results that returned the + // nextToken value. + NextToken *string `location:"querystring" locationName:"nextToken" type:"string"` +} + +// String returns the string representation +func (s ListVirtualServicesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListVirtualServicesInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListVirtualServicesInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListVirtualServicesInput"} + if s.Limit != nil && *s.Limit < 1 { + invalidParams.Add(request.NewErrParamMinValue("Limit", 1)) + } + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetLimit sets the Limit field's value. +func (s *ListVirtualServicesInput) SetLimit(v int64) *ListVirtualServicesInput { + s.Limit = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *ListVirtualServicesInput) SetMeshName(v string) *ListVirtualServicesInput { + s.MeshName = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListVirtualServicesInput) SetNextToken(v string) *ListVirtualServicesInput { + s.NextToken = &v + return s +} + +type ListVirtualServicesOutput struct { + _ struct{} `type:"structure"` + + // The nextToken value to include in a future ListVirtualServices request. When + // the results of a ListVirtualServices request exceed limit, you can use this + // value to retrieve the next page of results. This value is null when there + // are no more results to return. + NextToken *string `locationName:"nextToken" type:"string"` + + // The list of existing virtual services for the specified service mesh. + // + // VirtualServices is a required field + VirtualServices []*VirtualServiceRef `locationName:"virtualServices" type:"list" required:"true"` +} + +// String returns the string representation +func (s ListVirtualServicesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListVirtualServicesOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *ListVirtualServicesOutput) SetNextToken(v string) *ListVirtualServicesOutput { + s.NextToken = &v + return s +} + +// SetVirtualServices sets the VirtualServices field's value. +func (s *ListVirtualServicesOutput) SetVirtualServices(v []*VirtualServiceRef) *ListVirtualServicesOutput { + s.VirtualServices = v + return s +} + +// An object representing a listener for a virtual node. +type Listener struct { + _ struct{} `type:"structure"` + + // The health check information for the listener. + HealthCheck *HealthCheckPolicy `locationName:"healthCheck" type:"structure"` + + // The port mapping information for the listener. + // + // PortMapping is a required field + PortMapping *PortMapping `locationName:"portMapping" type:"structure" required:"true"` +} + +// String returns the string representation +func (s Listener) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Listener) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Listener) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Listener"} + if s.PortMapping == nil { + invalidParams.Add(request.NewErrParamRequired("PortMapping")) + } + if s.HealthCheck != nil { + if err := s.HealthCheck.Validate(); err != nil { + invalidParams.AddNested("HealthCheck", err.(request.ErrInvalidParams)) + } + } + if s.PortMapping != nil { + if err := s.PortMapping.Validate(); err != nil { + invalidParams.AddNested("PortMapping", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetHealthCheck sets the HealthCheck field's value. +func (s *Listener) SetHealthCheck(v *HealthCheckPolicy) *Listener { + s.HealthCheck = v + return s +} + +// SetPortMapping sets the PortMapping field's value. +func (s *Listener) SetPortMapping(v *PortMapping) *Listener { + s.PortMapping = v + return s +} + +// An object representing the logging information for a virtual node. +type Logging struct { + _ struct{} `type:"structure"` + + // The access log configuration for a virtual node. + AccessLog *AccessLog `locationName:"accessLog" type:"structure"` +} + +// String returns the string representation +func (s Logging) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Logging) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *Logging) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "Logging"} + if s.AccessLog != nil { + if err := s.AccessLog.Validate(); err != nil { + invalidParams.AddNested("AccessLog", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAccessLog sets the AccessLog field's value. +func (s *Logging) SetAccessLog(v *AccessLog) *Logging { + s.AccessLog = v + return s +} + +type MatchRange struct { + _ struct{} `type:"structure"` + + // End is a required field + End *int64 `locationName:"end" type:"long" required:"true"` + + // Start is a required field + Start *int64 `locationName:"start" type:"long" required:"true"` +} + +// String returns the string representation +func (s MatchRange) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MatchRange) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MatchRange) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MatchRange"} + if s.End == nil { + invalidParams.Add(request.NewErrParamRequired("End")) + } + if s.Start == nil { + invalidParams.Add(request.NewErrParamRequired("Start")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEnd sets the End field's value. +func (s *MatchRange) SetEnd(v int64) *MatchRange { + s.End = &v + return s +} + +// SetStart sets the Start field's value. +func (s *MatchRange) SetStart(v int64) *MatchRange { + s.Start = &v + return s +} + +// An object representing a service mesh returned by a describe operation. +type MeshData struct { + _ struct{} `type:"structure"` + + // The name of the service mesh. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The associated metadata for the service mesh. + // + // Metadata is a required field + Metadata *ResourceMetadata `locationName:"metadata" type:"structure" required:"true"` + + // The associated specification for the service mesh. + // + // Spec is a required field + Spec *MeshSpec `locationName:"spec" type:"structure" required:"true"` + + // The status of the service mesh. + // + // Status is a required field + Status *MeshStatus `locationName:"status" type:"structure" required:"true"` +} + +// String returns the string representation +func (s MeshData) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MeshData) GoString() string { + return s.String() +} + +// SetMeshName sets the MeshName field's value. +func (s *MeshData) SetMeshName(v string) *MeshData { + s.MeshName = &v + return s +} + +// SetMetadata sets the Metadata field's value. +func (s *MeshData) SetMetadata(v *ResourceMetadata) *MeshData { + s.Metadata = v + return s +} + +// SetSpec sets the Spec field's value. +func (s *MeshData) SetSpec(v *MeshSpec) *MeshData { + s.Spec = v + return s +} + +// SetStatus sets the Status field's value. +func (s *MeshData) SetStatus(v *MeshStatus) *MeshData { + s.Status = v + return s +} + +// An object representing a service mesh returned by a list operation. +type MeshRef struct { + _ struct{} `type:"structure"` + + // The full Amazon Resource Name (ARN) of the service mesh. + // + // Arn is a required field + Arn *string `locationName:"arn" type:"string" required:"true"` + + // The name of the service mesh. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s MeshRef) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MeshRef) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *MeshRef) SetArn(v string) *MeshRef { + s.Arn = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *MeshRef) SetMeshName(v string) *MeshRef { + s.MeshName = &v + return s +} + +// An object representing the specification of a service mesh. +type MeshSpec struct { + _ struct{} `type:"structure"` + + // The egress filter rules for the service mesh. + EgressFilter *EgressFilter `locationName:"egressFilter" type:"structure"` +} + +// String returns the string representation +func (s MeshSpec) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MeshSpec) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *MeshSpec) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "MeshSpec"} + if s.EgressFilter != nil { + if err := s.EgressFilter.Validate(); err != nil { + invalidParams.AddNested("EgressFilter", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEgressFilter sets the EgressFilter field's value. +func (s *MeshSpec) SetEgressFilter(v *EgressFilter) *MeshSpec { + s.EgressFilter = v + return s +} + +// An object representing the status of a service mesh. +type MeshStatus struct { + _ struct{} `type:"structure"` + + // The current mesh status. + Status *string `locationName:"status" type:"string" enum:"MeshStatusCode"` +} + +// String returns the string representation +func (s MeshStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s MeshStatus) GoString() string { + return s.String() +} + +// SetStatus sets the Status field's value. +func (s *MeshStatus) SetStatus(v string) *MeshStatus { + s.Status = &v + return s +} + +// An object representing a virtual node or virtual router listener port mapping. +type PortMapping struct { + _ struct{} `type:"structure"` + + // The port used for the port mapping. + // + // Port is a required field + Port *int64 `locationName:"port" min:"1" type:"integer" required:"true"` + + // The protocol used for the port mapping. + // + // Protocol is a required field + Protocol *string `locationName:"protocol" type:"string" required:"true" enum:"PortProtocol"` +} + +// String returns the string representation +func (s PortMapping) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PortMapping) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PortMapping) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PortMapping"} + if s.Port == nil { + invalidParams.Add(request.NewErrParamRequired("Port")) + } + if s.Port != nil && *s.Port < 1 { + invalidParams.Add(request.NewErrParamMinValue("Port", 1)) + } + if s.Protocol == nil { + invalidParams.Add(request.NewErrParamRequired("Protocol")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPort sets the Port field's value. +func (s *PortMapping) SetPort(v int64) *PortMapping { + s.Port = &v + return s +} + +// SetProtocol sets the Protocol field's value. +func (s *PortMapping) SetProtocol(v string) *PortMapping { + s.Protocol = &v + return s +} + +// An object representing metadata for a resource. +type ResourceMetadata struct { + _ struct{} `type:"structure"` + + // The full Amazon Resource Name (ARN) for the resource. + // + // Arn is a required field + Arn *string `locationName:"arn" type:"string" required:"true"` + + // The Unix epoch timestamp in seconds for when the resource was created. + // + // CreatedAt is a required field + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" required:"true"` + + // The Unix epoch timestamp in seconds for when the resource was last updated. + // + // LastUpdatedAt is a required field + LastUpdatedAt *time.Time `locationName:"lastUpdatedAt" type:"timestamp" required:"true"` + + // The unique identifier for the resource. + // + // Uid is a required field + Uid *string `locationName:"uid" type:"string" required:"true"` + + // The version of the resource. Resources are created at version 1, and this + // version is incremented each time that they're updated. + // + // Version is a required field + Version *int64 `locationName:"version" type:"long" required:"true"` +} + +// String returns the string representation +func (s ResourceMetadata) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResourceMetadata) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *ResourceMetadata) SetArn(v string) *ResourceMetadata { + s.Arn = &v + return s +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *ResourceMetadata) SetCreatedAt(v time.Time) *ResourceMetadata { + s.CreatedAt = &v + return s +} + +// SetLastUpdatedAt sets the LastUpdatedAt field's value. +func (s *ResourceMetadata) SetLastUpdatedAt(v time.Time) *ResourceMetadata { + s.LastUpdatedAt = &v + return s +} + +// SetUid sets the Uid field's value. +func (s *ResourceMetadata) SetUid(v string) *ResourceMetadata { + s.Uid = &v + return s +} + +// SetVersion sets the Version field's value. +func (s *ResourceMetadata) SetVersion(v int64) *ResourceMetadata { + s.Version = &v + return s +} + +// An object representing a route returned by a describe operation. +type RouteData struct { + _ struct{} `type:"structure"` + + // The name of the service mesh that the route resides in. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The associated metadata for the route. + // + // Metadata is a required field + Metadata *ResourceMetadata `locationName:"metadata" type:"structure" required:"true"` + + // The name of the route. + // + // RouteName is a required field + RouteName *string `locationName:"routeName" min:"1" type:"string" required:"true"` + + // The specifications of the route. + // + // Spec is a required field + Spec *RouteSpec `locationName:"spec" type:"structure" required:"true"` + + // The status of the route. + // + // Status is a required field + Status *RouteStatus `locationName:"status" type:"structure" required:"true"` + + // The virtual router that the route is associated with. + // + // VirtualRouterName is a required field + VirtualRouterName *string `locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s RouteData) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RouteData) GoString() string { + return s.String() +} + +// SetMeshName sets the MeshName field's value. +func (s *RouteData) SetMeshName(v string) *RouteData { + s.MeshName = &v + return s +} + +// SetMetadata sets the Metadata field's value. +func (s *RouteData) SetMetadata(v *ResourceMetadata) *RouteData { + s.Metadata = v + return s +} + +// SetRouteName sets the RouteName field's value. +func (s *RouteData) SetRouteName(v string) *RouteData { + s.RouteName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *RouteData) SetSpec(v *RouteSpec) *RouteData { + s.Spec = v + return s +} + +// SetStatus sets the Status field's value. +func (s *RouteData) SetStatus(v *RouteStatus) *RouteData { + s.Status = v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *RouteData) SetVirtualRouterName(v string) *RouteData { + s.VirtualRouterName = &v + return s +} + +// An object representing a route returned by a list operation. +type RouteRef struct { + _ struct{} `type:"structure"` + + // The full Amazon Resource Name (ARN) for the route. + // + // Arn is a required field + Arn *string `locationName:"arn" type:"string" required:"true"` + + // The name of the service mesh that the route resides in. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the route. + // + // RouteName is a required field + RouteName *string `locationName:"routeName" min:"1" type:"string" required:"true"` + + // The virtual router that the route is associated with. + // + // VirtualRouterName is a required field + VirtualRouterName *string `locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s RouteRef) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RouteRef) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *RouteRef) SetArn(v string) *RouteRef { + s.Arn = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *RouteRef) SetMeshName(v string) *RouteRef { + s.MeshName = &v + return s +} + +// SetRouteName sets the RouteName field's value. +func (s *RouteRef) SetRouteName(v string) *RouteRef { + s.RouteName = &v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *RouteRef) SetVirtualRouterName(v string) *RouteRef { + s.VirtualRouterName = &v + return s +} + +// An object representing the specification of a route. +type RouteSpec struct { + _ struct{} `type:"structure"` + + // The HTTP routing information for the route. + HttpRoute *HttpRoute `locationName:"httpRoute" type:"structure"` + + Priority *int64 `locationName:"priority" type:"integer"` + + // The TCP routing information for the route. + TcpRoute *TcpRoute `locationName:"tcpRoute" type:"structure"` +} + +// String returns the string representation +func (s RouteSpec) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RouteSpec) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RouteSpec) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RouteSpec"} + if s.HttpRoute != nil { + if err := s.HttpRoute.Validate(); err != nil { + invalidParams.AddNested("HttpRoute", err.(request.ErrInvalidParams)) + } + } + if s.TcpRoute != nil { + if err := s.TcpRoute.Validate(); err != nil { + invalidParams.AddNested("TcpRoute", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetHttpRoute sets the HttpRoute field's value. +func (s *RouteSpec) SetHttpRoute(v *HttpRoute) *RouteSpec { + s.HttpRoute = v + return s +} + +// SetPriority sets the Priority field's value. +func (s *RouteSpec) SetPriority(v int64) *RouteSpec { + s.Priority = &v + return s +} + +// SetTcpRoute sets the TcpRoute field's value. +func (s *RouteSpec) SetTcpRoute(v *TcpRoute) *RouteSpec { + s.TcpRoute = v + return s +} + +// An object representing the current status of a route. +type RouteStatus struct { + _ struct{} `type:"structure"` + + // The current status for the route. + // + // Status is a required field + Status *string `locationName:"status" type:"string" required:"true" enum:"RouteStatusCode"` +} + +// String returns the string representation +func (s RouteStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RouteStatus) GoString() string { + return s.String() +} + +// SetStatus sets the Status field's value. +func (s *RouteStatus) SetStatus(v string) *RouteStatus { + s.Status = &v + return s +} + +// An object representing the service discovery information for a virtual node. +type ServiceDiscovery struct { + _ struct{} `type:"structure"` + + // Specifies any AWS Cloud Map information for the virtual node. + AwsCloudMap *AwsCloudMapServiceDiscovery `locationName:"awsCloudMap" type:"structure"` + + // Specifies the DNS information for the virtual node. + Dns *DnsServiceDiscovery `locationName:"dns" type:"structure"` +} + +// String returns the string representation +func (s ServiceDiscovery) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ServiceDiscovery) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ServiceDiscovery) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ServiceDiscovery"} + if s.AwsCloudMap != nil { + if err := s.AwsCloudMap.Validate(); err != nil { + invalidParams.AddNested("AwsCloudMap", err.(request.ErrInvalidParams)) + } + } + if s.Dns != nil { + if err := s.Dns.Validate(); err != nil { + invalidParams.AddNested("Dns", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAwsCloudMap sets the AwsCloudMap field's value. +func (s *ServiceDiscovery) SetAwsCloudMap(v *AwsCloudMapServiceDiscovery) *ServiceDiscovery { + s.AwsCloudMap = v + return s +} + +// SetDns sets the Dns field's value. +func (s *ServiceDiscovery) SetDns(v *DnsServiceDiscovery) *ServiceDiscovery { + s.Dns = v + return s +} + +// Optional metadata that you apply to a resource to assist with categorization +// and organization. Each tag consists of a key and an optional value, both +// of which you define. Tag keys can have a maximum character length of 128 +// characters, and tag values can have a maximum length of 256 characters. +type TagRef struct { + _ struct{} `type:"structure"` + + // One part of a key-value pair that make up a tag. A key is a general label + // that acts like a category for more specific tag values. + // + // Key is a required field + Key *string `locationName:"key" min:"1" type:"string" required:"true"` + + // The optional part of a key-value pair that make up a tag. A value acts as + // a descriptor within a tag category (key). + Value *string `locationName:"value" type:"string"` +} + +// String returns the string representation +func (s TagRef) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagRef) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagRef) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TagRef"} + if s.Key == nil { + invalidParams.Add(request.NewErrParamRequired("Key")) + } + if s.Key != nil && len(*s.Key) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Key", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetKey sets the Key field's value. +func (s *TagRef) SetKey(v string) *TagRef { + s.Key = &v + return s +} + +// SetValue sets the Value field's value. +func (s *TagRef) SetValue(v string) *TagRef { + s.Value = &v + return s +} + +type TagResourceInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the resource to add tags to. + // + // ResourceArn is a required field + ResourceArn *string `location:"querystring" locationName:"resourceArn" type:"string" required:"true"` + + // The tags to add to the resource. A tag is an array of key-value pairs. Tag + // keys can have a maximum character length of 128 characters, and tag values + // can have a maximum length of 256 characters. + // + // Tags is a required field + Tags []*TagRef `locationName:"tags" type:"list" required:"true"` +} + +// String returns the string representation +func (s TagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TagResourceInput"} + if s.ResourceArn == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceArn")) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + if s.Tags != nil { + for i, v := range s.Tags { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceArn sets the ResourceArn field's value. +func (s *TagResourceInput) SetResourceArn(v string) *TagResourceInput { + s.ResourceArn = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TagResourceInput) SetTags(v []*TagRef) *TagResourceInput { + s.Tags = v + return s +} + +type TagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s TagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceOutput) GoString() string { + return s.String() +} + +// An object representing the TCP routing specification for a route. +type TcpRoute struct { + _ struct{} `type:"structure"` + + // The action to take if a match is determined. + // + // Action is a required field + Action *TcpRouteAction `locationName:"action" type:"structure" required:"true"` +} + +// String returns the string representation +func (s TcpRoute) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TcpRoute) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TcpRoute) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TcpRoute"} + if s.Action == nil { + invalidParams.Add(request.NewErrParamRequired("Action")) + } + if s.Action != nil { + if err := s.Action.Validate(); err != nil { + invalidParams.AddNested("Action", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAction sets the Action field's value. +func (s *TcpRoute) SetAction(v *TcpRouteAction) *TcpRoute { + s.Action = v + return s +} + +// An object representing the traffic distribution requirements for matched +// TCP requests. +type TcpRouteAction struct { + _ struct{} `type:"structure"` + + // The targets that traffic is routed to when a request matches the route. You + // can specify one or more targets and their relative weights to distribute + // traffic with. + // + // WeightedTargets is a required field + WeightedTargets []*WeightedTarget `locationName:"weightedTargets" min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s TcpRouteAction) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TcpRouteAction) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TcpRouteAction) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TcpRouteAction"} + if s.WeightedTargets == nil { + invalidParams.Add(request.NewErrParamRequired("WeightedTargets")) + } + if s.WeightedTargets != nil && len(s.WeightedTargets) < 1 { + invalidParams.Add(request.NewErrParamMinLen("WeightedTargets", 1)) + } + if s.WeightedTargets != nil { + for i, v := range s.WeightedTargets { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "WeightedTargets", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetWeightedTargets sets the WeightedTargets field's value. +func (s *TcpRouteAction) SetWeightedTargets(v []*WeightedTarget) *TcpRouteAction { + s.WeightedTargets = v + return s +} + +type UntagResourceInput struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the resource to delete tags from. + // + // ResourceArn is a required field + ResourceArn *string `location:"querystring" locationName:"resourceArn" type:"string" required:"true"` + + // The keys of the tags to be removed. + // + // TagKeys is a required field + TagKeys []*string `locationName:"tagKeys" type:"list" required:"true"` +} + +// String returns the string representation +func (s UntagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UntagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UntagResourceInput"} + if s.ResourceArn == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceArn")) + } + if s.TagKeys == nil { + invalidParams.Add(request.NewErrParamRequired("TagKeys")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceArn sets the ResourceArn field's value. +func (s *UntagResourceInput) SetResourceArn(v string) *UntagResourceInput { + s.ResourceArn = &v + return s +} + +// SetTagKeys sets the TagKeys field's value. +func (s *UntagResourceInput) SetTagKeys(v []*string) *UntagResourceInput { + s.TagKeys = v + return s +} + +type UntagResourceOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s UntagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceOutput) GoString() string { + return s.String() +} + +type UpdateMeshInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh to update. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The service mesh specification to apply. + Spec *MeshSpec `locationName:"spec" type:"structure"` +} + +// String returns the string representation +func (s UpdateMeshInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateMeshInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateMeshInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateMeshInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *UpdateMeshInput) SetClientToken(v string) *UpdateMeshInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *UpdateMeshInput) SetMeshName(v string) *UpdateMeshInput { + s.MeshName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *UpdateMeshInput) SetSpec(v *MeshSpec) *UpdateMeshInput { + s.Spec = v + return s +} + +type UpdateMeshOutput struct { + _ struct{} `type:"structure" payload:"Mesh"` + + // An object representing a service mesh returned by a describe operation. + // + // Mesh is a required field + Mesh *MeshData `locationName:"mesh" type:"structure" required:"true"` +} + +// String returns the string representation +func (s UpdateMeshOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateMeshOutput) GoString() string { + return s.String() +} + +// SetMesh sets the Mesh field's value. +func (s *UpdateMeshOutput) SetMesh(v *MeshData) *UpdateMeshOutput { + s.Mesh = v + return s +} + +type UpdateRouteInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh that the route resides in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the route to update. + // + // RouteName is a required field + RouteName *string `location:"uri" locationName:"routeName" min:"1" type:"string" required:"true"` + + // The new route specification to apply. This overwrites the existing data. + // + // Spec is a required field + Spec *RouteSpec `locationName:"spec" type:"structure" required:"true"` + + // The name of the virtual router that the route is associated with. + // + // VirtualRouterName is a required field + VirtualRouterName *string `location:"uri" locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateRouteInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateRouteInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateRouteInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateRouteInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.RouteName == nil { + invalidParams.Add(request.NewErrParamRequired("RouteName")) + } + if s.RouteName != nil && len(*s.RouteName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RouteName", 1)) + } + if s.Spec == nil { + invalidParams.Add(request.NewErrParamRequired("Spec")) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *UpdateRouteInput) SetClientToken(v string) *UpdateRouteInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *UpdateRouteInput) SetMeshName(v string) *UpdateRouteInput { + s.MeshName = &v + return s +} + +// SetRouteName sets the RouteName field's value. +func (s *UpdateRouteInput) SetRouteName(v string) *UpdateRouteInput { + s.RouteName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *UpdateRouteInput) SetSpec(v *RouteSpec) *UpdateRouteInput { + s.Spec = v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *UpdateRouteInput) SetVirtualRouterName(v string) *UpdateRouteInput { + s.VirtualRouterName = &v + return s +} + +type UpdateRouteOutput struct { + _ struct{} `type:"structure" payload:"Route"` + + // A full description of the route that was updated. + // + // Route is a required field + Route *RouteData `locationName:"route" type:"structure" required:"true"` +} + +// String returns the string representation +func (s UpdateRouteOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateRouteOutput) GoString() string { + return s.String() +} + +// SetRoute sets the Route field's value. +func (s *UpdateRouteOutput) SetRoute(v *RouteData) *UpdateRouteOutput { + s.Route = v + return s +} + +type UpdateVirtualNodeInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh that the virtual node resides in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The new virtual node specification to apply. This overwrites the existing + // data. + // + // Spec is a required field + Spec *VirtualNodeSpec `locationName:"spec" type:"structure" required:"true"` + + // The name of the virtual node to update. + // + // VirtualNodeName is a required field + VirtualNodeName *string `location:"uri" locationName:"virtualNodeName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateVirtualNodeInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateVirtualNodeInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateVirtualNodeInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateVirtualNodeInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.Spec == nil { + invalidParams.Add(request.NewErrParamRequired("Spec")) + } + if s.VirtualNodeName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualNodeName")) + } + if s.VirtualNodeName != nil && len(*s.VirtualNodeName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualNodeName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *UpdateVirtualNodeInput) SetClientToken(v string) *UpdateVirtualNodeInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *UpdateVirtualNodeInput) SetMeshName(v string) *UpdateVirtualNodeInput { + s.MeshName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *UpdateVirtualNodeInput) SetSpec(v *VirtualNodeSpec) *UpdateVirtualNodeInput { + s.Spec = v + return s +} + +// SetVirtualNodeName sets the VirtualNodeName field's value. +func (s *UpdateVirtualNodeInput) SetVirtualNodeName(v string) *UpdateVirtualNodeInput { + s.VirtualNodeName = &v + return s +} + +type UpdateVirtualNodeOutput struct { + _ struct{} `type:"structure" payload:"VirtualNode"` + + // A full description of the virtual node that was updated. + // + // VirtualNode is a required field + VirtualNode *VirtualNodeData `locationName:"virtualNode" type:"structure" required:"true"` +} + +// String returns the string representation +func (s UpdateVirtualNodeOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateVirtualNodeOutput) GoString() string { + return s.String() +} + +// SetVirtualNode sets the VirtualNode field's value. +func (s *UpdateVirtualNodeOutput) SetVirtualNode(v *VirtualNodeData) *UpdateVirtualNodeOutput { + s.VirtualNode = v + return s +} + +type UpdateVirtualRouterInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh that the virtual router resides in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The new virtual router specification to apply. This overwrites the existing + // data. + // + // Spec is a required field + Spec *VirtualRouterSpec `locationName:"spec" type:"structure" required:"true"` + + // The name of the virtual router to update. + // + // VirtualRouterName is a required field + VirtualRouterName *string `location:"uri" locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateVirtualRouterInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateVirtualRouterInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateVirtualRouterInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateVirtualRouterInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.Spec == nil { + invalidParams.Add(request.NewErrParamRequired("Spec")) + } + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *UpdateVirtualRouterInput) SetClientToken(v string) *UpdateVirtualRouterInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *UpdateVirtualRouterInput) SetMeshName(v string) *UpdateVirtualRouterInput { + s.MeshName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *UpdateVirtualRouterInput) SetSpec(v *VirtualRouterSpec) *UpdateVirtualRouterInput { + s.Spec = v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *UpdateVirtualRouterInput) SetVirtualRouterName(v string) *UpdateVirtualRouterInput { + s.VirtualRouterName = &v + return s +} + +type UpdateVirtualRouterOutput struct { + _ struct{} `type:"structure" payload:"VirtualRouter"` + + // A full description of the virtual router that was updated. + // + // VirtualRouter is a required field + VirtualRouter *VirtualRouterData `locationName:"virtualRouter" type:"structure" required:"true"` +} + +// String returns the string representation +func (s UpdateVirtualRouterOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateVirtualRouterOutput) GoString() string { + return s.String() +} + +// SetVirtualRouter sets the VirtualRouter field's value. +func (s *UpdateVirtualRouterOutput) SetVirtualRouter(v *VirtualRouterData) *UpdateVirtualRouterOutput { + s.VirtualRouter = v + return s +} + +type UpdateVirtualServiceInput struct { + _ struct{} `type:"structure"` + + // Unique, case-sensitive identifier that you provide to ensure the idempotency + // of therequest. Up to 36 letters, numbers, hyphens, and underscores are allowed. + ClientToken *string `locationName:"clientToken" type:"string" idempotencyToken:"true"` + + // The name of the service mesh that the virtual service resides in. + // + // MeshName is a required field + MeshName *string `location:"uri" locationName:"meshName" min:"1" type:"string" required:"true"` + + // The new virtual service specification to apply. This overwrites the existing + // data. + // + // Spec is a required field + Spec *VirtualServiceSpec `locationName:"spec" type:"structure" required:"true"` + + // The name of the virtual service to update. + // + // VirtualServiceName is a required field + VirtualServiceName *string `location:"uri" locationName:"virtualServiceName" type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateVirtualServiceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateVirtualServiceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateVirtualServiceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateVirtualServiceInput"} + if s.MeshName == nil { + invalidParams.Add(request.NewErrParamRequired("MeshName")) + } + if s.MeshName != nil && len(*s.MeshName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("MeshName", 1)) + } + if s.Spec == nil { + invalidParams.Add(request.NewErrParamRequired("Spec")) + } + if s.VirtualServiceName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualServiceName")) + } + if s.VirtualServiceName != nil && len(*s.VirtualServiceName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualServiceName", 1)) + } + if s.Spec != nil { + if err := s.Spec.Validate(); err != nil { + invalidParams.AddNested("Spec", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientToken sets the ClientToken field's value. +func (s *UpdateVirtualServiceInput) SetClientToken(v string) *UpdateVirtualServiceInput { + s.ClientToken = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *UpdateVirtualServiceInput) SetMeshName(v string) *UpdateVirtualServiceInput { + s.MeshName = &v + return s +} + +// SetSpec sets the Spec field's value. +func (s *UpdateVirtualServiceInput) SetSpec(v *VirtualServiceSpec) *UpdateVirtualServiceInput { + s.Spec = v + return s +} + +// SetVirtualServiceName sets the VirtualServiceName field's value. +func (s *UpdateVirtualServiceInput) SetVirtualServiceName(v string) *UpdateVirtualServiceInput { + s.VirtualServiceName = &v + return s +} + +type UpdateVirtualServiceOutput struct { + _ struct{} `type:"structure" payload:"VirtualService"` + + // A full description of the virtual service that was updated. + // + // VirtualService is a required field + VirtualService *VirtualServiceData `locationName:"virtualService" type:"structure" required:"true"` +} + +// String returns the string representation +func (s UpdateVirtualServiceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateVirtualServiceOutput) GoString() string { + return s.String() +} + +// SetVirtualService sets the VirtualService field's value. +func (s *UpdateVirtualServiceOutput) SetVirtualService(v *VirtualServiceData) *UpdateVirtualServiceOutput { + s.VirtualService = v + return s +} + +// An object representing a virtual node returned by a describe operation. +type VirtualNodeData struct { + _ struct{} `type:"structure"` + + // The name of the service mesh that the virtual node resides in. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The associated metadata for the virtual node. + // + // Metadata is a required field + Metadata *ResourceMetadata `locationName:"metadata" type:"structure" required:"true"` + + // The specifications of the virtual node. + // + // Spec is a required field + Spec *VirtualNodeSpec `locationName:"spec" type:"structure" required:"true"` + + // The current status for the virtual node. + // + // Status is a required field + Status *VirtualNodeStatus `locationName:"status" type:"structure" required:"true"` + + // The name of the virtual node. + // + // VirtualNodeName is a required field + VirtualNodeName *string `locationName:"virtualNodeName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualNodeData) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualNodeData) GoString() string { + return s.String() +} + +// SetMeshName sets the MeshName field's value. +func (s *VirtualNodeData) SetMeshName(v string) *VirtualNodeData { + s.MeshName = &v + return s +} + +// SetMetadata sets the Metadata field's value. +func (s *VirtualNodeData) SetMetadata(v *ResourceMetadata) *VirtualNodeData { + s.Metadata = v + return s +} + +// SetSpec sets the Spec field's value. +func (s *VirtualNodeData) SetSpec(v *VirtualNodeSpec) *VirtualNodeData { + s.Spec = v + return s +} + +// SetStatus sets the Status field's value. +func (s *VirtualNodeData) SetStatus(v *VirtualNodeStatus) *VirtualNodeData { + s.Status = v + return s +} + +// SetVirtualNodeName sets the VirtualNodeName field's value. +func (s *VirtualNodeData) SetVirtualNodeName(v string) *VirtualNodeData { + s.VirtualNodeName = &v + return s +} + +// An object representing a virtual node returned by a list operation. +type VirtualNodeRef struct { + _ struct{} `type:"structure"` + + // The full Amazon Resource Name (ARN) for the virtual node. + // + // Arn is a required field + Arn *string `locationName:"arn" type:"string" required:"true"` + + // The name of the service mesh that the virtual node resides in. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual node. + // + // VirtualNodeName is a required field + VirtualNodeName *string `locationName:"virtualNodeName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualNodeRef) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualNodeRef) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *VirtualNodeRef) SetArn(v string) *VirtualNodeRef { + s.Arn = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *VirtualNodeRef) SetMeshName(v string) *VirtualNodeRef { + s.MeshName = &v + return s +} + +// SetVirtualNodeName sets the VirtualNodeName field's value. +func (s *VirtualNodeRef) SetVirtualNodeName(v string) *VirtualNodeRef { + s.VirtualNodeName = &v + return s +} + +// An object representing a virtual node service provider. +type VirtualNodeServiceProvider struct { + _ struct{} `type:"structure"` + + // The name of the virtual node that is acting as a service provider. + // + // VirtualNodeName is a required field + VirtualNodeName *string `locationName:"virtualNodeName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualNodeServiceProvider) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualNodeServiceProvider) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *VirtualNodeServiceProvider) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VirtualNodeServiceProvider"} + if s.VirtualNodeName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualNodeName")) + } + if s.VirtualNodeName != nil && len(*s.VirtualNodeName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualNodeName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetVirtualNodeName sets the VirtualNodeName field's value. +func (s *VirtualNodeServiceProvider) SetVirtualNodeName(v string) *VirtualNodeServiceProvider { + s.VirtualNodeName = &v + return s +} + +// An object representing the specification of a virtual node. +type VirtualNodeSpec struct { + _ struct{} `type:"structure"` + + // The backends that the virtual node is expected to send outbound traffic to. + Backends []*Backend `locationName:"backends" type:"list"` + + // The listeners that the virtual node is expected to receive inbound traffic + // from. Currently only one listener is supported per virtual node. + Listeners []*Listener `locationName:"listeners" type:"list"` + + // The inbound and outbound access logging information for the virtual node. + Logging *Logging `locationName:"logging" type:"structure"` + + // The service discovery information for the virtual node. If your virtual node + // does not expect ingress traffic, you can omit this parameter. + ServiceDiscovery *ServiceDiscovery `locationName:"serviceDiscovery" type:"structure"` +} + +// String returns the string representation +func (s VirtualNodeSpec) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualNodeSpec) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *VirtualNodeSpec) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VirtualNodeSpec"} + if s.Backends != nil { + for i, v := range s.Backends { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Backends", i), err.(request.ErrInvalidParams)) + } + } + } + if s.Listeners != nil { + for i, v := range s.Listeners { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Listeners", i), err.(request.ErrInvalidParams)) + } + } + } + if s.Logging != nil { + if err := s.Logging.Validate(); err != nil { + invalidParams.AddNested("Logging", err.(request.ErrInvalidParams)) + } + } + if s.ServiceDiscovery != nil { + if err := s.ServiceDiscovery.Validate(); err != nil { + invalidParams.AddNested("ServiceDiscovery", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetBackends sets the Backends field's value. +func (s *VirtualNodeSpec) SetBackends(v []*Backend) *VirtualNodeSpec { + s.Backends = v + return s +} + +// SetListeners sets the Listeners field's value. +func (s *VirtualNodeSpec) SetListeners(v []*Listener) *VirtualNodeSpec { + s.Listeners = v + return s +} + +// SetLogging sets the Logging field's value. +func (s *VirtualNodeSpec) SetLogging(v *Logging) *VirtualNodeSpec { + s.Logging = v + return s +} + +// SetServiceDiscovery sets the ServiceDiscovery field's value. +func (s *VirtualNodeSpec) SetServiceDiscovery(v *ServiceDiscovery) *VirtualNodeSpec { + s.ServiceDiscovery = v + return s +} + +// An object representing the current status of the virtual node. +type VirtualNodeStatus struct { + _ struct{} `type:"structure"` + + // The current status of the virtual node. + // + // Status is a required field + Status *string `locationName:"status" type:"string" required:"true" enum:"VirtualNodeStatusCode"` +} + +// String returns the string representation +func (s VirtualNodeStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualNodeStatus) GoString() string { + return s.String() +} + +// SetStatus sets the Status field's value. +func (s *VirtualNodeStatus) SetStatus(v string) *VirtualNodeStatus { + s.Status = &v + return s +} + +// An object representing a virtual router returned by a describe operation. +type VirtualRouterData struct { + _ struct{} `type:"structure"` + + // The name of the service mesh that the virtual router resides in. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The associated metadata for the virtual router. + // + // Metadata is a required field + Metadata *ResourceMetadata `locationName:"metadata" type:"structure" required:"true"` + + // The specifications of the virtual router. + // + // Spec is a required field + Spec *VirtualRouterSpec `locationName:"spec" type:"structure" required:"true"` + + // The current status of the virtual router. + // + // Status is a required field + Status *VirtualRouterStatus `locationName:"status" type:"structure" required:"true"` + + // The name of the virtual router. + // + // VirtualRouterName is a required field + VirtualRouterName *string `locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualRouterData) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualRouterData) GoString() string { + return s.String() +} + +// SetMeshName sets the MeshName field's value. +func (s *VirtualRouterData) SetMeshName(v string) *VirtualRouterData { + s.MeshName = &v + return s +} + +// SetMetadata sets the Metadata field's value. +func (s *VirtualRouterData) SetMetadata(v *ResourceMetadata) *VirtualRouterData { + s.Metadata = v + return s +} + +// SetSpec sets the Spec field's value. +func (s *VirtualRouterData) SetSpec(v *VirtualRouterSpec) *VirtualRouterData { + s.Spec = v + return s +} + +// SetStatus sets the Status field's value. +func (s *VirtualRouterData) SetStatus(v *VirtualRouterStatus) *VirtualRouterData { + s.Status = v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *VirtualRouterData) SetVirtualRouterName(v string) *VirtualRouterData { + s.VirtualRouterName = &v + return s +} + +// An object representing a virtual router listener. +type VirtualRouterListener struct { + _ struct{} `type:"structure"` + + // An object representing a virtual node or virtual router listener port mapping. + // + // PortMapping is a required field + PortMapping *PortMapping `locationName:"portMapping" type:"structure" required:"true"` +} + +// String returns the string representation +func (s VirtualRouterListener) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualRouterListener) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *VirtualRouterListener) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VirtualRouterListener"} + if s.PortMapping == nil { + invalidParams.Add(request.NewErrParamRequired("PortMapping")) + } + if s.PortMapping != nil { + if err := s.PortMapping.Validate(); err != nil { + invalidParams.AddNested("PortMapping", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPortMapping sets the PortMapping field's value. +func (s *VirtualRouterListener) SetPortMapping(v *PortMapping) *VirtualRouterListener { + s.PortMapping = v + return s +} + +// An object representing a virtual router returned by a list operation. +type VirtualRouterRef struct { + _ struct{} `type:"structure"` + + // The full Amazon Resource Name (ARN) for the virtual router. + // + // Arn is a required field + Arn *string `locationName:"arn" type:"string" required:"true"` + + // The name of the service mesh that the virtual router resides in. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual router. + // + // VirtualRouterName is a required field + VirtualRouterName *string `locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualRouterRef) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualRouterRef) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *VirtualRouterRef) SetArn(v string) *VirtualRouterRef { + s.Arn = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *VirtualRouterRef) SetMeshName(v string) *VirtualRouterRef { + s.MeshName = &v + return s +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *VirtualRouterRef) SetVirtualRouterName(v string) *VirtualRouterRef { + s.VirtualRouterName = &v + return s +} + +// An object representing a virtual node service provider. +type VirtualRouterServiceProvider struct { + _ struct{} `type:"structure"` + + // The name of the virtual router that is acting as a service provider. + // + // VirtualRouterName is a required field + VirtualRouterName *string `locationName:"virtualRouterName" min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualRouterServiceProvider) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualRouterServiceProvider) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *VirtualRouterServiceProvider) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VirtualRouterServiceProvider"} + if s.VirtualRouterName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualRouterName")) + } + if s.VirtualRouterName != nil && len(*s.VirtualRouterName) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualRouterName", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetVirtualRouterName sets the VirtualRouterName field's value. +func (s *VirtualRouterServiceProvider) SetVirtualRouterName(v string) *VirtualRouterServiceProvider { + s.VirtualRouterName = &v + return s +} + +// An object representing the specification of a virtual router. +type VirtualRouterSpec struct { + _ struct{} `type:"structure"` + + // The listeners that the virtual router is expected to receive inbound traffic + // from. Currently only one listener is supported per virtual router. + Listeners []*VirtualRouterListener `locationName:"listeners" min:"1" type:"list"` +} + +// String returns the string representation +func (s VirtualRouterSpec) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualRouterSpec) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *VirtualRouterSpec) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VirtualRouterSpec"} + if s.Listeners != nil && len(s.Listeners) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Listeners", 1)) + } + if s.Listeners != nil { + for i, v := range s.Listeners { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Listeners", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetListeners sets the Listeners field's value. +func (s *VirtualRouterSpec) SetListeners(v []*VirtualRouterListener) *VirtualRouterSpec { + s.Listeners = v + return s +} + +// An object representing the status of a virtual router. +type VirtualRouterStatus struct { + _ struct{} `type:"structure"` + + // The current status of the virtual router. + // + // Status is a required field + Status *string `locationName:"status" type:"string" required:"true" enum:"VirtualRouterStatusCode"` +} + +// String returns the string representation +func (s VirtualRouterStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualRouterStatus) GoString() string { + return s.String() +} + +// SetStatus sets the Status field's value. +func (s *VirtualRouterStatus) SetStatus(v string) *VirtualRouterStatus { + s.Status = &v + return s +} + +// An object representing a virtual service backend for a virtual node. +type VirtualServiceBackend struct { + _ struct{} `type:"structure"` + + // The name of the virtual service that is acting as a virtual node backend. + // + // VirtualServiceName is a required field + VirtualServiceName *string `locationName:"virtualServiceName" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualServiceBackend) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualServiceBackend) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *VirtualServiceBackend) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VirtualServiceBackend"} + if s.VirtualServiceName == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualServiceName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetVirtualServiceName sets the VirtualServiceName field's value. +func (s *VirtualServiceBackend) SetVirtualServiceName(v string) *VirtualServiceBackend { + s.VirtualServiceName = &v + return s +} + +// An object representing a virtual service returned by a describe operation. +type VirtualServiceData struct { + _ struct{} `type:"structure"` + + // The name of the service mesh that the virtual service resides in. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // An object representing metadata for a resource. + // + // Metadata is a required field + Metadata *ResourceMetadata `locationName:"metadata" type:"structure" required:"true"` + + // The specifications of the virtual service. + // + // Spec is a required field + Spec *VirtualServiceSpec `locationName:"spec" type:"structure" required:"true"` + + // The current status of the virtual service. + // + // Status is a required field + Status *VirtualServiceStatus `locationName:"status" type:"structure" required:"true"` + + // The name of the virtual service. + // + // VirtualServiceName is a required field + VirtualServiceName *string `locationName:"virtualServiceName" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualServiceData) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualServiceData) GoString() string { + return s.String() +} + +// SetMeshName sets the MeshName field's value. +func (s *VirtualServiceData) SetMeshName(v string) *VirtualServiceData { + s.MeshName = &v + return s +} + +// SetMetadata sets the Metadata field's value. +func (s *VirtualServiceData) SetMetadata(v *ResourceMetadata) *VirtualServiceData { + s.Metadata = v + return s +} + +// SetSpec sets the Spec field's value. +func (s *VirtualServiceData) SetSpec(v *VirtualServiceSpec) *VirtualServiceData { + s.Spec = v + return s +} + +// SetStatus sets the Status field's value. +func (s *VirtualServiceData) SetStatus(v *VirtualServiceStatus) *VirtualServiceData { + s.Status = v + return s +} + +// SetVirtualServiceName sets the VirtualServiceName field's value. +func (s *VirtualServiceData) SetVirtualServiceName(v string) *VirtualServiceData { + s.VirtualServiceName = &v + return s +} + +// An object representing the provider for a virtual service. +type VirtualServiceProvider struct { + _ struct{} `type:"structure"` + + // The virtual node associated with a virtual service. + VirtualNode *VirtualNodeServiceProvider `locationName:"virtualNode" type:"structure"` + + // The virtual router associated with a virtual service. + VirtualRouter *VirtualRouterServiceProvider `locationName:"virtualRouter" type:"structure"` +} + +// String returns the string representation +func (s VirtualServiceProvider) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualServiceProvider) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *VirtualServiceProvider) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VirtualServiceProvider"} + if s.VirtualNode != nil { + if err := s.VirtualNode.Validate(); err != nil { + invalidParams.AddNested("VirtualNode", err.(request.ErrInvalidParams)) + } + } + if s.VirtualRouter != nil { + if err := s.VirtualRouter.Validate(); err != nil { + invalidParams.AddNested("VirtualRouter", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetVirtualNode sets the VirtualNode field's value. +func (s *VirtualServiceProvider) SetVirtualNode(v *VirtualNodeServiceProvider) *VirtualServiceProvider { + s.VirtualNode = v + return s +} + +// SetVirtualRouter sets the VirtualRouter field's value. +func (s *VirtualServiceProvider) SetVirtualRouter(v *VirtualRouterServiceProvider) *VirtualServiceProvider { + s.VirtualRouter = v + return s +} + +// An object representing a virtual service returned by a list operation. +type VirtualServiceRef struct { + _ struct{} `type:"structure"` + + // The full Amazon Resource Name (ARN) for the virtual service. + // + // Arn is a required field + Arn *string `locationName:"arn" type:"string" required:"true"` + + // The name of the service mesh that the virtual service resides in. + // + // MeshName is a required field + MeshName *string `locationName:"meshName" min:"1" type:"string" required:"true"` + + // The name of the virtual service. + // + // VirtualServiceName is a required field + VirtualServiceName *string `locationName:"virtualServiceName" type:"string" required:"true"` +} + +// String returns the string representation +func (s VirtualServiceRef) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualServiceRef) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *VirtualServiceRef) SetArn(v string) *VirtualServiceRef { + s.Arn = &v + return s +} + +// SetMeshName sets the MeshName field's value. +func (s *VirtualServiceRef) SetMeshName(v string) *VirtualServiceRef { + s.MeshName = &v + return s +} + +// SetVirtualServiceName sets the VirtualServiceName field's value. +func (s *VirtualServiceRef) SetVirtualServiceName(v string) *VirtualServiceRef { + s.VirtualServiceName = &v + return s +} + +// An object representing the specification of a virtual service. +type VirtualServiceSpec struct { + _ struct{} `type:"structure"` + + // The App Mesh object that is acting as the provider for a virtual service. + // You can specify a single virtual node or virtual router. + Provider *VirtualServiceProvider `locationName:"provider" type:"structure"` +} + +// String returns the string representation +func (s VirtualServiceSpec) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualServiceSpec) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *VirtualServiceSpec) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "VirtualServiceSpec"} + if s.Provider != nil { + if err := s.Provider.Validate(); err != nil { + invalidParams.AddNested("Provider", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetProvider sets the Provider field's value. +func (s *VirtualServiceSpec) SetProvider(v *VirtualServiceProvider) *VirtualServiceSpec { + s.Provider = v + return s +} + +// An object representing the status of a virtual service. +type VirtualServiceStatus struct { + _ struct{} `type:"structure"` + + // The current status of the virtual service. + // + // Status is a required field + Status *string `locationName:"status" type:"string" required:"true" enum:"VirtualServiceStatusCode"` +} + +// String returns the string representation +func (s VirtualServiceStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s VirtualServiceStatus) GoString() string { + return s.String() +} + +// SetStatus sets the Status field's value. +func (s *VirtualServiceStatus) SetStatus(v string) *VirtualServiceStatus { + s.Status = &v + return s +} + +// An object representing a target and its relative weight. Traffic is distributed +// across targets according to their relative weight. For example, a weighted +// target with a relative weight of 50 receives five times as much traffic as +// one with a relative weight of 10. +type WeightedTarget struct { + _ struct{} `type:"structure"` + + // The virtual node to associate with the weighted target. + // + // VirtualNode is a required field + VirtualNode *string `locationName:"virtualNode" min:"1" type:"string" required:"true"` + + // The relative weight of the weighted target. + // + // Weight is a required field + Weight *int64 `locationName:"weight" type:"integer" required:"true"` +} + +// String returns the string representation +func (s WeightedTarget) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s WeightedTarget) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *WeightedTarget) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "WeightedTarget"} + if s.VirtualNode == nil { + invalidParams.Add(request.NewErrParamRequired("VirtualNode")) + } + if s.VirtualNode != nil && len(*s.VirtualNode) < 1 { + invalidParams.Add(request.NewErrParamMinLen("VirtualNode", 1)) + } + if s.Weight == nil { + invalidParams.Add(request.NewErrParamRequired("Weight")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetVirtualNode sets the VirtualNode field's value. +func (s *WeightedTarget) SetVirtualNode(v string) *WeightedTarget { + s.VirtualNode = &v + return s +} + +// SetWeight sets the Weight field's value. +func (s *WeightedTarget) SetWeight(v int64) *WeightedTarget { + s.Weight = &v + return s +} + +const ( + // EgressFilterTypeAllowAll is a EgressFilterType enum value + EgressFilterTypeAllowAll = "ALLOW_ALL" + + // EgressFilterTypeDropAll is a EgressFilterType enum value + EgressFilterTypeDropAll = "DROP_ALL" +) + +const ( + // HttpMethodConnect is a HttpMethod enum value + HttpMethodConnect = "connect" + + // HttpMethodDelete is a HttpMethod enum value + HttpMethodDelete = "delete" + + // HttpMethodGet is a HttpMethod enum value + HttpMethodGet = "get" + + // HttpMethodHead is a HttpMethod enum value + HttpMethodHead = "head" + + // HttpMethodOptions is a HttpMethod enum value + HttpMethodOptions = "options" + + // HttpMethodPatch is a HttpMethod enum value + HttpMethodPatch = "patch" + + // HttpMethodPost is a HttpMethod enum value + HttpMethodPost = "post" + + // HttpMethodPut is a HttpMethod enum value + HttpMethodPut = "put" + + // HttpMethodTrace is a HttpMethod enum value + HttpMethodTrace = "trace" +) + +const ( + // HttpSchemeHttp is a HttpScheme enum value + HttpSchemeHttp = "http" + + // HttpSchemeHttps is a HttpScheme enum value + HttpSchemeHttps = "https" +) + +const ( + // MeshStatusCodeActive is a MeshStatusCode enum value + MeshStatusCodeActive = "ACTIVE" + + // MeshStatusCodeDeleted is a MeshStatusCode enum value + MeshStatusCodeDeleted = "DELETED" + + // MeshStatusCodeInactive is a MeshStatusCode enum value + MeshStatusCodeInactive = "INACTIVE" +) + +const ( + // PortProtocolHttp is a PortProtocol enum value + PortProtocolHttp = "http" + + // PortProtocolTcp is a PortProtocol enum value + PortProtocolTcp = "tcp" +) + +const ( + // RouteStatusCodeActive is a RouteStatusCode enum value + RouteStatusCodeActive = "ACTIVE" + + // RouteStatusCodeDeleted is a RouteStatusCode enum value + RouteStatusCodeDeleted = "DELETED" + + // RouteStatusCodeInactive is a RouteStatusCode enum value + RouteStatusCodeInactive = "INACTIVE" +) + +const ( + // VirtualNodeStatusCodeActive is a VirtualNodeStatusCode enum value + VirtualNodeStatusCodeActive = "ACTIVE" + + // VirtualNodeStatusCodeDeleted is a VirtualNodeStatusCode enum value + VirtualNodeStatusCodeDeleted = "DELETED" + + // VirtualNodeStatusCodeInactive is a VirtualNodeStatusCode enum value + VirtualNodeStatusCodeInactive = "INACTIVE" +) + +const ( + // VirtualRouterStatusCodeActive is a VirtualRouterStatusCode enum value + VirtualRouterStatusCodeActive = "ACTIVE" + + // VirtualRouterStatusCodeDeleted is a VirtualRouterStatusCode enum value + VirtualRouterStatusCodeDeleted = "DELETED" + + // VirtualRouterStatusCodeInactive is a VirtualRouterStatusCode enum value + VirtualRouterStatusCodeInactive = "INACTIVE" +) + +const ( + // VirtualServiceStatusCodeActive is a VirtualServiceStatusCode enum value + VirtualServiceStatusCodeActive = "ACTIVE" + + // VirtualServiceStatusCodeDeleted is a VirtualServiceStatusCode enum value + VirtualServiceStatusCodeDeleted = "DELETED" + + // VirtualServiceStatusCodeInactive is a VirtualServiceStatusCode enum value + VirtualServiceStatusCodeInactive = "INACTIVE" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/appmeshpreviewiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/appmeshpreviewiface/interface.go new file mode 100644 index 00000000000..4db0f390d2d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/appmeshpreviewiface/interface.go @@ -0,0 +1,194 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package appmeshpreviewiface provides an interface to enable mocking the AWS App Mesh Preview service client +// for testing your code. +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. +package appmeshpreviewiface + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/service/appmeshpreview" +) + +// AppMeshPreviewAPI provides an interface to enable mocking the +// appmeshpreview.AppMeshPreview service client's API operation, +// paginators, and waiters. This make unit testing your code that calls out +// to the SDK's service client's calls easier. +// +// The best way to use this interface is so the SDK's service client's calls +// can be stubbed out for unit testing your code with the SDK without needing +// to inject custom request handlers into the SDK's request pipeline. +// +// // myFunc uses an SDK service client to make a request to +// // AWS App Mesh Preview. +// func myFunc(svc appmeshpreviewiface.AppMeshPreviewAPI) bool { +// // Make svc.CreateMesh request +// } +// +// func main() { +// sess := session.New() +// svc := appmeshpreview.New(sess) +// +// myFunc(svc) +// } +// +// In your _test.go file: +// +// // Define a mock struct to be used in your unit tests of myFunc. +// type mockAppMeshPreviewClient struct { +// appmeshpreviewiface.AppMeshPreviewAPI +// } +// func (m *mockAppMeshPreviewClient) CreateMesh(input *appmeshpreview.CreateMeshInput) (*appmeshpreview.CreateMeshOutput, error) { +// // mock response/functionality +// } +// +// func TestMyFunc(t *testing.T) { +// // Setup Test +// mockSvc := &mockAppMeshPreviewClient{} +// +// myfunc(mockSvc) +// +// // Verify myFunc's functionality +// } +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. Its suggested to use the pattern above for testing, or using +// tooling to generate mocks to satisfy the interfaces. +type AppMeshPreviewAPI interface { + CreateMesh(*appmeshpreview.CreateMeshInput) (*appmeshpreview.CreateMeshOutput, error) + CreateMeshWithContext(aws.Context, *appmeshpreview.CreateMeshInput, ...request.Option) (*appmeshpreview.CreateMeshOutput, error) + CreateMeshRequest(*appmeshpreview.CreateMeshInput) (*request.Request, *appmeshpreview.CreateMeshOutput) + + CreateRoute(*appmeshpreview.CreateRouteInput) (*appmeshpreview.CreateRouteOutput, error) + CreateRouteWithContext(aws.Context, *appmeshpreview.CreateRouteInput, ...request.Option) (*appmeshpreview.CreateRouteOutput, error) + CreateRouteRequest(*appmeshpreview.CreateRouteInput) (*request.Request, *appmeshpreview.CreateRouteOutput) + + CreateVirtualNode(*appmeshpreview.CreateVirtualNodeInput) (*appmeshpreview.CreateVirtualNodeOutput, error) + CreateVirtualNodeWithContext(aws.Context, *appmeshpreview.CreateVirtualNodeInput, ...request.Option) (*appmeshpreview.CreateVirtualNodeOutput, error) + CreateVirtualNodeRequest(*appmeshpreview.CreateVirtualNodeInput) (*request.Request, *appmeshpreview.CreateVirtualNodeOutput) + + CreateVirtualRouter(*appmeshpreview.CreateVirtualRouterInput) (*appmeshpreview.CreateVirtualRouterOutput, error) + CreateVirtualRouterWithContext(aws.Context, *appmeshpreview.CreateVirtualRouterInput, ...request.Option) (*appmeshpreview.CreateVirtualRouterOutput, error) + CreateVirtualRouterRequest(*appmeshpreview.CreateVirtualRouterInput) (*request.Request, *appmeshpreview.CreateVirtualRouterOutput) + + CreateVirtualService(*appmeshpreview.CreateVirtualServiceInput) (*appmeshpreview.CreateVirtualServiceOutput, error) + CreateVirtualServiceWithContext(aws.Context, *appmeshpreview.CreateVirtualServiceInput, ...request.Option) (*appmeshpreview.CreateVirtualServiceOutput, error) + CreateVirtualServiceRequest(*appmeshpreview.CreateVirtualServiceInput) (*request.Request, *appmeshpreview.CreateVirtualServiceOutput) + + DeleteMesh(*appmeshpreview.DeleteMeshInput) (*appmeshpreview.DeleteMeshOutput, error) + DeleteMeshWithContext(aws.Context, *appmeshpreview.DeleteMeshInput, ...request.Option) (*appmeshpreview.DeleteMeshOutput, error) + DeleteMeshRequest(*appmeshpreview.DeleteMeshInput) (*request.Request, *appmeshpreview.DeleteMeshOutput) + + DeleteRoute(*appmeshpreview.DeleteRouteInput) (*appmeshpreview.DeleteRouteOutput, error) + DeleteRouteWithContext(aws.Context, *appmeshpreview.DeleteRouteInput, ...request.Option) (*appmeshpreview.DeleteRouteOutput, error) + DeleteRouteRequest(*appmeshpreview.DeleteRouteInput) (*request.Request, *appmeshpreview.DeleteRouteOutput) + + DeleteVirtualNode(*appmeshpreview.DeleteVirtualNodeInput) (*appmeshpreview.DeleteVirtualNodeOutput, error) + DeleteVirtualNodeWithContext(aws.Context, *appmeshpreview.DeleteVirtualNodeInput, ...request.Option) (*appmeshpreview.DeleteVirtualNodeOutput, error) + DeleteVirtualNodeRequest(*appmeshpreview.DeleteVirtualNodeInput) (*request.Request, *appmeshpreview.DeleteVirtualNodeOutput) + + DeleteVirtualRouter(*appmeshpreview.DeleteVirtualRouterInput) (*appmeshpreview.DeleteVirtualRouterOutput, error) + DeleteVirtualRouterWithContext(aws.Context, *appmeshpreview.DeleteVirtualRouterInput, ...request.Option) (*appmeshpreview.DeleteVirtualRouterOutput, error) + DeleteVirtualRouterRequest(*appmeshpreview.DeleteVirtualRouterInput) (*request.Request, *appmeshpreview.DeleteVirtualRouterOutput) + + DeleteVirtualService(*appmeshpreview.DeleteVirtualServiceInput) (*appmeshpreview.DeleteVirtualServiceOutput, error) + DeleteVirtualServiceWithContext(aws.Context, *appmeshpreview.DeleteVirtualServiceInput, ...request.Option) (*appmeshpreview.DeleteVirtualServiceOutput, error) + DeleteVirtualServiceRequest(*appmeshpreview.DeleteVirtualServiceInput) (*request.Request, *appmeshpreview.DeleteVirtualServiceOutput) + + DescribeMesh(*appmeshpreview.DescribeMeshInput) (*appmeshpreview.DescribeMeshOutput, error) + DescribeMeshWithContext(aws.Context, *appmeshpreview.DescribeMeshInput, ...request.Option) (*appmeshpreview.DescribeMeshOutput, error) + DescribeMeshRequest(*appmeshpreview.DescribeMeshInput) (*request.Request, *appmeshpreview.DescribeMeshOutput) + + DescribeRoute(*appmeshpreview.DescribeRouteInput) (*appmeshpreview.DescribeRouteOutput, error) + DescribeRouteWithContext(aws.Context, *appmeshpreview.DescribeRouteInput, ...request.Option) (*appmeshpreview.DescribeRouteOutput, error) + DescribeRouteRequest(*appmeshpreview.DescribeRouteInput) (*request.Request, *appmeshpreview.DescribeRouteOutput) + + DescribeVirtualNode(*appmeshpreview.DescribeVirtualNodeInput) (*appmeshpreview.DescribeVirtualNodeOutput, error) + DescribeVirtualNodeWithContext(aws.Context, *appmeshpreview.DescribeVirtualNodeInput, ...request.Option) (*appmeshpreview.DescribeVirtualNodeOutput, error) + DescribeVirtualNodeRequest(*appmeshpreview.DescribeVirtualNodeInput) (*request.Request, *appmeshpreview.DescribeVirtualNodeOutput) + + DescribeVirtualRouter(*appmeshpreview.DescribeVirtualRouterInput) (*appmeshpreview.DescribeVirtualRouterOutput, error) + DescribeVirtualRouterWithContext(aws.Context, *appmeshpreview.DescribeVirtualRouterInput, ...request.Option) (*appmeshpreview.DescribeVirtualRouterOutput, error) + DescribeVirtualRouterRequest(*appmeshpreview.DescribeVirtualRouterInput) (*request.Request, *appmeshpreview.DescribeVirtualRouterOutput) + + DescribeVirtualService(*appmeshpreview.DescribeVirtualServiceInput) (*appmeshpreview.DescribeVirtualServiceOutput, error) + DescribeVirtualServiceWithContext(aws.Context, *appmeshpreview.DescribeVirtualServiceInput, ...request.Option) (*appmeshpreview.DescribeVirtualServiceOutput, error) + DescribeVirtualServiceRequest(*appmeshpreview.DescribeVirtualServiceInput) (*request.Request, *appmeshpreview.DescribeVirtualServiceOutput) + + ListMeshes(*appmeshpreview.ListMeshesInput) (*appmeshpreview.ListMeshesOutput, error) + ListMeshesWithContext(aws.Context, *appmeshpreview.ListMeshesInput, ...request.Option) (*appmeshpreview.ListMeshesOutput, error) + ListMeshesRequest(*appmeshpreview.ListMeshesInput) (*request.Request, *appmeshpreview.ListMeshesOutput) + + ListMeshesPages(*appmeshpreview.ListMeshesInput, func(*appmeshpreview.ListMeshesOutput, bool) bool) error + ListMeshesPagesWithContext(aws.Context, *appmeshpreview.ListMeshesInput, func(*appmeshpreview.ListMeshesOutput, bool) bool, ...request.Option) error + + ListRoutes(*appmeshpreview.ListRoutesInput) (*appmeshpreview.ListRoutesOutput, error) + ListRoutesWithContext(aws.Context, *appmeshpreview.ListRoutesInput, ...request.Option) (*appmeshpreview.ListRoutesOutput, error) + ListRoutesRequest(*appmeshpreview.ListRoutesInput) (*request.Request, *appmeshpreview.ListRoutesOutput) + + ListRoutesPages(*appmeshpreview.ListRoutesInput, func(*appmeshpreview.ListRoutesOutput, bool) bool) error + ListRoutesPagesWithContext(aws.Context, *appmeshpreview.ListRoutesInput, func(*appmeshpreview.ListRoutesOutput, bool) bool, ...request.Option) error + + ListTagsForResource(*appmeshpreview.ListTagsForResourceInput) (*appmeshpreview.ListTagsForResourceOutput, error) + ListTagsForResourceWithContext(aws.Context, *appmeshpreview.ListTagsForResourceInput, ...request.Option) (*appmeshpreview.ListTagsForResourceOutput, error) + ListTagsForResourceRequest(*appmeshpreview.ListTagsForResourceInput) (*request.Request, *appmeshpreview.ListTagsForResourceOutput) + + ListTagsForResourcePages(*appmeshpreview.ListTagsForResourceInput, func(*appmeshpreview.ListTagsForResourceOutput, bool) bool) error + ListTagsForResourcePagesWithContext(aws.Context, *appmeshpreview.ListTagsForResourceInput, func(*appmeshpreview.ListTagsForResourceOutput, bool) bool, ...request.Option) error + + ListVirtualNodes(*appmeshpreview.ListVirtualNodesInput) (*appmeshpreview.ListVirtualNodesOutput, error) + ListVirtualNodesWithContext(aws.Context, *appmeshpreview.ListVirtualNodesInput, ...request.Option) (*appmeshpreview.ListVirtualNodesOutput, error) + ListVirtualNodesRequest(*appmeshpreview.ListVirtualNodesInput) (*request.Request, *appmeshpreview.ListVirtualNodesOutput) + + ListVirtualNodesPages(*appmeshpreview.ListVirtualNodesInput, func(*appmeshpreview.ListVirtualNodesOutput, bool) bool) error + ListVirtualNodesPagesWithContext(aws.Context, *appmeshpreview.ListVirtualNodesInput, func(*appmeshpreview.ListVirtualNodesOutput, bool) bool, ...request.Option) error + + ListVirtualRouters(*appmeshpreview.ListVirtualRoutersInput) (*appmeshpreview.ListVirtualRoutersOutput, error) + ListVirtualRoutersWithContext(aws.Context, *appmeshpreview.ListVirtualRoutersInput, ...request.Option) (*appmeshpreview.ListVirtualRoutersOutput, error) + ListVirtualRoutersRequest(*appmeshpreview.ListVirtualRoutersInput) (*request.Request, *appmeshpreview.ListVirtualRoutersOutput) + + ListVirtualRoutersPages(*appmeshpreview.ListVirtualRoutersInput, func(*appmeshpreview.ListVirtualRoutersOutput, bool) bool) error + ListVirtualRoutersPagesWithContext(aws.Context, *appmeshpreview.ListVirtualRoutersInput, func(*appmeshpreview.ListVirtualRoutersOutput, bool) bool, ...request.Option) error + + ListVirtualServices(*appmeshpreview.ListVirtualServicesInput) (*appmeshpreview.ListVirtualServicesOutput, error) + ListVirtualServicesWithContext(aws.Context, *appmeshpreview.ListVirtualServicesInput, ...request.Option) (*appmeshpreview.ListVirtualServicesOutput, error) + ListVirtualServicesRequest(*appmeshpreview.ListVirtualServicesInput) (*request.Request, *appmeshpreview.ListVirtualServicesOutput) + + ListVirtualServicesPages(*appmeshpreview.ListVirtualServicesInput, func(*appmeshpreview.ListVirtualServicesOutput, bool) bool) error + ListVirtualServicesPagesWithContext(aws.Context, *appmeshpreview.ListVirtualServicesInput, func(*appmeshpreview.ListVirtualServicesOutput, bool) bool, ...request.Option) error + + TagResource(*appmeshpreview.TagResourceInput) (*appmeshpreview.TagResourceOutput, error) + TagResourceWithContext(aws.Context, *appmeshpreview.TagResourceInput, ...request.Option) (*appmeshpreview.TagResourceOutput, error) + TagResourceRequest(*appmeshpreview.TagResourceInput) (*request.Request, *appmeshpreview.TagResourceOutput) + + UntagResource(*appmeshpreview.UntagResourceInput) (*appmeshpreview.UntagResourceOutput, error) + UntagResourceWithContext(aws.Context, *appmeshpreview.UntagResourceInput, ...request.Option) (*appmeshpreview.UntagResourceOutput, error) + UntagResourceRequest(*appmeshpreview.UntagResourceInput) (*request.Request, *appmeshpreview.UntagResourceOutput) + + UpdateMesh(*appmeshpreview.UpdateMeshInput) (*appmeshpreview.UpdateMeshOutput, error) + UpdateMeshWithContext(aws.Context, *appmeshpreview.UpdateMeshInput, ...request.Option) (*appmeshpreview.UpdateMeshOutput, error) + UpdateMeshRequest(*appmeshpreview.UpdateMeshInput) (*request.Request, *appmeshpreview.UpdateMeshOutput) + + UpdateRoute(*appmeshpreview.UpdateRouteInput) (*appmeshpreview.UpdateRouteOutput, error) + UpdateRouteWithContext(aws.Context, *appmeshpreview.UpdateRouteInput, ...request.Option) (*appmeshpreview.UpdateRouteOutput, error) + UpdateRouteRequest(*appmeshpreview.UpdateRouteInput) (*request.Request, *appmeshpreview.UpdateRouteOutput) + + UpdateVirtualNode(*appmeshpreview.UpdateVirtualNodeInput) (*appmeshpreview.UpdateVirtualNodeOutput, error) + UpdateVirtualNodeWithContext(aws.Context, *appmeshpreview.UpdateVirtualNodeInput, ...request.Option) (*appmeshpreview.UpdateVirtualNodeOutput, error) + UpdateVirtualNodeRequest(*appmeshpreview.UpdateVirtualNodeInput) (*request.Request, *appmeshpreview.UpdateVirtualNodeOutput) + + UpdateVirtualRouter(*appmeshpreview.UpdateVirtualRouterInput) (*appmeshpreview.UpdateVirtualRouterOutput, error) + UpdateVirtualRouterWithContext(aws.Context, *appmeshpreview.UpdateVirtualRouterInput, ...request.Option) (*appmeshpreview.UpdateVirtualRouterOutput, error) + UpdateVirtualRouterRequest(*appmeshpreview.UpdateVirtualRouterInput) (*request.Request, *appmeshpreview.UpdateVirtualRouterOutput) + + UpdateVirtualService(*appmeshpreview.UpdateVirtualServiceInput) (*appmeshpreview.UpdateVirtualServiceOutput, error) + UpdateVirtualServiceWithContext(aws.Context, *appmeshpreview.UpdateVirtualServiceInput, ...request.Option) (*appmeshpreview.UpdateVirtualServiceOutput, error) + UpdateVirtualServiceRequest(*appmeshpreview.UpdateVirtualServiceInput) (*request.Request, *appmeshpreview.UpdateVirtualServiceOutput) +} + +var _ AppMeshPreviewAPI = (*appmeshpreview.AppMeshPreview)(nil) diff --git a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/doc.go b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/doc.go new file mode 100644 index 00000000000..a5f7e0a9110 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/doc.go @@ -0,0 +1,43 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package appmeshpreview provides the client and types for making API +// requests to AWS App Mesh Preview. +// +// AWS App Mesh is a service mesh based on the Envoy proxy that makes it easy +// to monitor and control microservices. App Mesh standardizes how your microservices +// communicate, giving you end-to-end visibility and helping to ensure high +// availability for your applications. +// +// App Mesh gives you consistent visibility and network traffic controls for +// every microservice in an application. You can use App Mesh with AWS Fargate, +// Amazon ECS, Amazon EKS, Kubernetes on AWS, and Amazon EC2. +// +// App Mesh supports microservice applications that use service discovery naming +// for their components. For more information about service discovery on Amazon +// ECS, see Service Discovery (http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html) +// in the Amazon Elastic Container Service Developer Guide. Kubernetes kube-dns +// and coredns are supported. For more information, see DNS for Services and +// Pods (https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/) +// in the Kubernetes documentation. +// +// See https://docs.aws.amazon.com/goto/WebAPI/appmesh-preview-2019-01-25 for more information on this service. +// +// See appmeshpreview package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/appmeshpreview/ +// +// Using the Client +// +// To contact AWS App Mesh Preview with the SDK use the New function to create +// a new service client. With that client you can make API requests to the service. +// These clients are safe to use concurrently. +// +// See the SDK's documentation for more information on how to use the SDK. +// https://docs.aws.amazon.com/sdk-for-go/api/ +// +// See aws.Config documentation for more information on configuring SDK clients. +// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +// +// See the AWS App Mesh Preview client AppMeshPreview for more +// information on creating client for this service. +// https://docs.aws.amazon.com/sdk-for-go/api/service/appmeshpreview/#New +package appmeshpreview diff --git a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/errors.go b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/errors.go new file mode 100644 index 00000000000..f89b37ae06f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/errors.go @@ -0,0 +1,76 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package appmeshpreview + +const ( + + // ErrCodeBadRequestException for service response error code + // "BadRequestException". + // + // The request syntax was malformed. Check your request syntax and try again. + ErrCodeBadRequestException = "BadRequestException" + + // ErrCodeConflictException for service response error code + // "ConflictException". + // + // The request contains a client token that was used for a previous update resource + // call with different specifications. Try the request again with a new client + // token. + ErrCodeConflictException = "ConflictException" + + // ErrCodeForbiddenException for service response error code + // "ForbiddenException". + // + // You don't have permissions to perform this action. + ErrCodeForbiddenException = "ForbiddenException" + + // ErrCodeInternalServerErrorException for service response error code + // "InternalServerErrorException". + // + // The request processing has failed because of an unknown error, exception, + // or failure. + ErrCodeInternalServerErrorException = "InternalServerErrorException" + + // ErrCodeLimitExceededException for service response error code + // "LimitExceededException". + // + // You have exceeded a service limit for your account. For more information, + // see Service Limits (https://docs.aws.amazon.com/app-mesh/latest/userguide/service_limits.html) + // in the AWS App Mesh User Guide. + ErrCodeLimitExceededException = "LimitExceededException" + + // ErrCodeNotFoundException for service response error code + // "NotFoundException". + // + // The specified resource doesn't exist. Check your request syntax and try again. + ErrCodeNotFoundException = "NotFoundException" + + // ErrCodeResourceInUseException for service response error code + // "ResourceInUseException". + // + // You can't delete the specified resource because it's in use or required by + // another resource. + ErrCodeResourceInUseException = "ResourceInUseException" + + // ErrCodeServiceUnavailableException for service response error code + // "ServiceUnavailableException". + // + // The request has failed due to a temporary failure of the service. + ErrCodeServiceUnavailableException = "ServiceUnavailableException" + + // ErrCodeTooManyRequestsException for service response error code + // "TooManyRequestsException". + // + // The maximum request rate permitted by the App Mesh APIs has been exceeded + // for your account. For best results, use an increasing or variable sleep interval + // between requests. + ErrCodeTooManyRequestsException = "TooManyRequestsException" + + // ErrCodeTooManyTagsException for service response error code + // "TooManyTagsException". + // + // The request exceeds the maximum allowed number of tags allowed per resource. + // The current limit is 50 user tags per resource. You must reduce the number + // of tags in the request. None of the tags in this request were applied. + ErrCodeTooManyTagsException = "TooManyTagsException" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/service.go b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/service.go new file mode 100644 index 00000000000..8647ccf6212 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/service.go @@ -0,0 +1,98 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package appmeshpreview + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol/restjson" +) + +// AppMeshPreview provides the API operation methods for making requests to +// AWS App Mesh Preview. See this package's package overview docs +// for details on the service. +// +// AppMeshPreview methods are safe to use concurrently. It is not safe to +// modify mutate any of the struct's properties though. +type AppMeshPreview struct { + *client.Client +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// Service information constants +const ( + ServiceName = "App Mesh Preview" // Name of service. + EndpointsID = "appmesh-preview" // ID to lookup a service endpoint with. + ServiceID = "App Mesh Preview" // ServiceID is a unique identifer of a specific service. +) + +// New creates a new instance of the AppMeshPreview client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a AppMeshPreview client from just a session. +// svc := appmeshpreview.New(mySession) +// +// // Create a AppMeshPreview client with additional configuration +// svc := appmeshpreview.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *AppMeshPreview { + c := p.ClientConfig(EndpointsID, cfgs...) + if c.SigningNameDerived || len(c.SigningName) == 0 { + c.SigningName = "appmesh-preview" + } + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *AppMeshPreview { + svc := &AppMeshPreview{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + ServiceID: ServiceID, + SigningName: signingName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2019-01-25", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a AppMeshPreview operation and runs any +// custom request initialization. +func (c *AppMeshPreview) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} From 174b9abff0b5029050eb9ef13fd1e595e2aa2d2a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Jul 2019 15:25:00 -0400 Subject: [PATCH 02/23] Add 'appmeshpreview' service. --- aws/config.go | 3 +++ aws/provider.go | 1 + 2 files changed, 4 insertions(+) diff --git a/aws/config.go b/aws/config.go index a90297c3626..36490c89318 100644 --- a/aws/config.go +++ b/aws/config.go @@ -16,6 +16,7 @@ import ( "github.com/aws/aws-sdk-go/service/applicationautoscaling" "github.com/aws/aws-sdk-go/service/applicationinsights" "github.com/aws/aws-sdk-go/service/appmesh" + "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/aws/aws-sdk-go/service/appsync" "github.com/aws/aws-sdk-go/service/athena" "github.com/aws/aws-sdk-go/service/autoscaling" @@ -171,6 +172,7 @@ type AWSClient struct { appautoscalingconn *applicationautoscaling.ApplicationAutoScaling applicationinsightsconn *applicationinsights.ApplicationInsights appmeshconn *appmesh.AppMesh + appmeshpreviewconn *appmeshpreview.AppMeshPreview appsyncconn *appsync.AppSync athenaconn *athena.Athena autoscalingconn *autoscaling.AutoScaling @@ -348,6 +350,7 @@ func (c *Config) Client() (interface{}, error) { appautoscalingconn: applicationautoscaling.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["applicationautoscaling"])})), applicationinsightsconn: applicationinsights.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["applicationinsights"])})), appmeshconn: appmesh.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appmesh"])})), + appmeshpreviewconn: appmeshpreview.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appmeshpreview"])})), appsyncconn: appsync.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appsync"])})), athenaconn: athena.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["athena"])})), autoscalingconn: autoscaling.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["autoscaling"])})), diff --git a/aws/provider.go b/aws/provider.go index ab25fd228cb..a8125e34477 100644 --- a/aws/provider.go +++ b/aws/provider.go @@ -887,6 +887,7 @@ func init() { "applicationautoscaling", "applicationinsights", "appmesh", + "appmeshpreview", "appsync", "athena", "autoscaling", From 5313920c522c4b8a012982ef9a825ae4a0f84dad Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Jul 2019 16:00:05 -0400 Subject: [PATCH 03/23] Move AppmeshRoute structure functions to resource file. --- aws/resource_aws_appmesh_route.go | 162 +++++++++++++++++++++++++++++- aws/structure.go | 156 ---------------------------- 2 files changed, 159 insertions(+), 159 deletions(-) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index 128f1c10040..c5f7e3eae7c 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -89,7 +89,7 @@ func resourceAwsAppmeshRoute() *schema.Resource { }, }, }, - Set: appmeshRouteWeightedTargetHash, + Set: appmeshWeightedTargetHash, }, }, }, @@ -149,7 +149,7 @@ func resourceAwsAppmeshRoute() *schema.Resource { }, }, }, - Set: appmeshRouteWeightedTargetHash, + Set: appmeshWeightedTargetHash, }, }, }, @@ -330,7 +330,163 @@ func resourceAwsAppmeshRouteImport(d *schema.ResourceData, meta interface{}) ([] return []*schema.ResourceData{d}, nil } -func appmeshRouteWeightedTargetHash(v interface{}) int { +func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { + spec := &appmesh.RouteSpec{} + + if len(vSpec) == 0 || vSpec[0] == nil { + // Empty Spec is allowed. + return spec + } + mSpec := vSpec[0].(map[string]interface{}) + + if vHttpRoute, ok := mSpec["http_route"].([]interface{}); ok && len(vHttpRoute) > 0 && vHttpRoute[0] != nil { + mHttpRoute := vHttpRoute[0].(map[string]interface{}) + + spec.HttpRoute = &appmesh.HttpRoute{} + + if vHttpRouteAction, ok := mHttpRoute["action"].([]interface{}); ok && len(vHttpRouteAction) > 0 && vHttpRouteAction[0] != nil { + mHttpRouteAction := vHttpRouteAction[0].(map[string]interface{}) + + if vWeightedTargets, ok := mHttpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { + weightedTargets := []*appmesh.WeightedTarget{} + + for _, vWeightedTarget := range vWeightedTargets.List() { + weightedTarget := &appmesh.WeightedTarget{} + + mWeightedTarget := vWeightedTarget.(map[string]interface{}) + + if vVirtualNode, ok := mWeightedTarget["virtual_node"].(string); ok && vVirtualNode != "" { + weightedTarget.VirtualNode = aws.String(vVirtualNode) + } + if vWeight, ok := mWeightedTarget["weight"].(int); ok { + weightedTarget.Weight = aws.Int64(int64(vWeight)) + } + + weightedTargets = append(weightedTargets, weightedTarget) + } + + spec.HttpRoute.Action = &appmesh.HttpRouteAction{ + WeightedTargets: weightedTargets, + } + } + } + + if vHttpRouteMatch, ok := mHttpRoute["match"].([]interface{}); ok && len(vHttpRouteMatch) > 0 && vHttpRouteMatch[0] != nil { + mHttpRouteMatch := vHttpRouteMatch[0].(map[string]interface{}) + + if vPrefix, ok := mHttpRouteMatch["prefix"].(string); ok && vPrefix != "" { + spec.HttpRoute.Match = &appmesh.HttpRouteMatch{ + Prefix: aws.String(vPrefix), + } + } + } + } + + if vTcpRoute, ok := mSpec["tcp_route"].([]interface{}); ok && len(vTcpRoute) > 0 && vTcpRoute[0] != nil { + mTcpRoute := vTcpRoute[0].(map[string]interface{}) + + spec.TcpRoute = &appmesh.TcpRoute{} + + if vTcpRouteAction, ok := mTcpRoute["action"].([]interface{}); ok && len(vTcpRouteAction) > 0 && vTcpRouteAction[0] != nil { + mTcpRouteAction := vTcpRouteAction[0].(map[string]interface{}) + + if vWeightedTargets, ok := mTcpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { + weightedTargets := []*appmesh.WeightedTarget{} + + for _, vWeightedTarget := range vWeightedTargets.List() { + weightedTarget := &appmesh.WeightedTarget{} + + mWeightedTarget := vWeightedTarget.(map[string]interface{}) + + if vVirtualNode, ok := mWeightedTarget["virtual_node"].(string); ok && vVirtualNode != "" { + weightedTarget.VirtualNode = aws.String(vVirtualNode) + } + if vWeight, ok := mWeightedTarget["weight"].(int); ok { + weightedTarget.Weight = aws.Int64(int64(vWeight)) + } + + weightedTargets = append(weightedTargets, weightedTarget) + } + + spec.TcpRoute.Action = &appmesh.TcpRouteAction{ + WeightedTargets: weightedTargets, + } + } + } + } + + return spec +} + +func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { + if spec == nil { + return []interface{}{} + } + + mSpec := map[string]interface{}{} + + if spec.HttpRoute != nil { + mHttpRoute := map[string]interface{}{} + + if spec.HttpRoute.Action != nil && spec.HttpRoute.Action.WeightedTargets != nil { + vWeightedTargets := []interface{}{} + + for _, weightedTarget := range spec.HttpRoute.Action.WeightedTargets { + mWeightedTarget := map[string]interface{}{ + "virtual_node": aws.StringValue(weightedTarget.VirtualNode), + "weight": int(aws.Int64Value(weightedTarget.Weight)), + } + + vWeightedTargets = append(vWeightedTargets, mWeightedTarget) + } + + mHttpRoute["action"] = []interface{}{ + map[string]interface{}{ + "weighted_target": schema.NewSet(appmeshWeightedTargetHash, vWeightedTargets), + }, + } + } + + if spec.HttpRoute.Match != nil { + mHttpRoute["match"] = []interface{}{ + map[string]interface{}{ + "prefix": aws.StringValue(spec.HttpRoute.Match.Prefix), + }, + } + } + + mSpec["http_route"] = []interface{}{mHttpRoute} + } + + if spec.TcpRoute != nil { + mTcpRoute := map[string]interface{}{} + + if spec.TcpRoute.Action != nil && spec.TcpRoute.Action.WeightedTargets != nil { + vWeightedTargets := []interface{}{} + + for _, weightedTarget := range spec.TcpRoute.Action.WeightedTargets { + mWeightedTarget := map[string]interface{}{ + "virtual_node": aws.StringValue(weightedTarget.VirtualNode), + "weight": int(aws.Int64Value(weightedTarget.Weight)), + } + + vWeightedTargets = append(vWeightedTargets, mWeightedTarget) + } + + mTcpRoute["action"] = []interface{}{ + map[string]interface{}{ + "weighted_target": schema.NewSet(appmeshWeightedTargetHash, vWeightedTargets), + }, + } + } + + mSpec["tcp_route"] = []interface{}{mTcpRoute} + } + + return []interface{}{mSpec} +} + +func appmeshWeightedTargetHash(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) if v, ok := m["virtual_node"].(string); ok { diff --git a/aws/structure.go b/aws/structure.go index db19625ed74..9922f6dbc42 100644 --- a/aws/structure.go +++ b/aws/structure.go @@ -5268,162 +5268,6 @@ func flattenAppmeshVirtualServiceSpec(spec *appmesh.VirtualServiceSpec) []interf return []interface{}{mSpec} } -func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { - spec := &appmesh.RouteSpec{} - - if len(vSpec) == 0 || vSpec[0] == nil { - // Empty Spec is allowed. - return spec - } - mSpec := vSpec[0].(map[string]interface{}) - - if vHttpRoute, ok := mSpec["http_route"].([]interface{}); ok && len(vHttpRoute) > 0 && vHttpRoute[0] != nil { - mHttpRoute := vHttpRoute[0].(map[string]interface{}) - - spec.HttpRoute = &appmesh.HttpRoute{} - - if vHttpRouteAction, ok := mHttpRoute["action"].([]interface{}); ok && len(vHttpRouteAction) > 0 && vHttpRouteAction[0] != nil { - mHttpRouteAction := vHttpRouteAction[0].(map[string]interface{}) - - if vWeightedTargets, ok := mHttpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { - weightedTargets := []*appmesh.WeightedTarget{} - - for _, vWeightedTarget := range vWeightedTargets.List() { - weightedTarget := &appmesh.WeightedTarget{} - - mWeightedTarget := vWeightedTarget.(map[string]interface{}) - - if vVirtualNode, ok := mWeightedTarget["virtual_node"].(string); ok && vVirtualNode != "" { - weightedTarget.VirtualNode = aws.String(vVirtualNode) - } - if vWeight, ok := mWeightedTarget["weight"].(int); ok { - weightedTarget.Weight = aws.Int64(int64(vWeight)) - } - - weightedTargets = append(weightedTargets, weightedTarget) - } - - spec.HttpRoute.Action = &appmesh.HttpRouteAction{ - WeightedTargets: weightedTargets, - } - } - } - - if vHttpRouteMatch, ok := mHttpRoute["match"].([]interface{}); ok && len(vHttpRouteMatch) > 0 && vHttpRouteMatch[0] != nil { - mHttpRouteMatch := vHttpRouteMatch[0].(map[string]interface{}) - - if vPrefix, ok := mHttpRouteMatch["prefix"].(string); ok && vPrefix != "" { - spec.HttpRoute.Match = &appmesh.HttpRouteMatch{ - Prefix: aws.String(vPrefix), - } - } - } - } - - if vTcpRoute, ok := mSpec["tcp_route"].([]interface{}); ok && len(vTcpRoute) > 0 && vTcpRoute[0] != nil { - mTcpRoute := vTcpRoute[0].(map[string]interface{}) - - spec.TcpRoute = &appmesh.TcpRoute{} - - if vTcpRouteAction, ok := mTcpRoute["action"].([]interface{}); ok && len(vTcpRouteAction) > 0 && vTcpRouteAction[0] != nil { - mTcpRouteAction := vTcpRouteAction[0].(map[string]interface{}) - - if vWeightedTargets, ok := mTcpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { - weightedTargets := []*appmesh.WeightedTarget{} - - for _, vWeightedTarget := range vWeightedTargets.List() { - weightedTarget := &appmesh.WeightedTarget{} - - mWeightedTarget := vWeightedTarget.(map[string]interface{}) - - if vVirtualNode, ok := mWeightedTarget["virtual_node"].(string); ok && vVirtualNode != "" { - weightedTarget.VirtualNode = aws.String(vVirtualNode) - } - if vWeight, ok := mWeightedTarget["weight"].(int); ok { - weightedTarget.Weight = aws.Int64(int64(vWeight)) - } - - weightedTargets = append(weightedTargets, weightedTarget) - } - - spec.TcpRoute.Action = &appmesh.TcpRouteAction{ - WeightedTargets: weightedTargets, - } - } - } - } - - return spec -} - -func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { - if spec == nil { - return []interface{}{} - } - - mSpec := map[string]interface{}{} - - if spec.HttpRoute != nil { - mHttpRoute := map[string]interface{}{} - - if spec.HttpRoute.Action != nil && spec.HttpRoute.Action.WeightedTargets != nil { - vWeightedTargets := []interface{}{} - - for _, weightedTarget := range spec.HttpRoute.Action.WeightedTargets { - mWeightedTarget := map[string]interface{}{ - "virtual_node": aws.StringValue(weightedTarget.VirtualNode), - "weight": int(aws.Int64Value(weightedTarget.Weight)), - } - - vWeightedTargets = append(vWeightedTargets, mWeightedTarget) - } - - mHttpRoute["action"] = []interface{}{ - map[string]interface{}{ - "weighted_target": schema.NewSet(appmeshRouteWeightedTargetHash, vWeightedTargets), - }, - } - } - - if spec.HttpRoute.Match != nil { - mHttpRoute["match"] = []interface{}{ - map[string]interface{}{ - "prefix": aws.StringValue(spec.HttpRoute.Match.Prefix), - }, - } - } - - mSpec["http_route"] = []interface{}{mHttpRoute} - } - - if spec.TcpRoute != nil { - mTcpRoute := map[string]interface{}{} - - if spec.TcpRoute.Action != nil && spec.TcpRoute.Action.WeightedTargets != nil { - vWeightedTargets := []interface{}{} - - for _, weightedTarget := range spec.TcpRoute.Action.WeightedTargets { - mWeightedTarget := map[string]interface{}{ - "virtual_node": aws.StringValue(weightedTarget.VirtualNode), - "weight": int(aws.Int64Value(weightedTarget.Weight)), - } - - vWeightedTargets = append(vWeightedTargets, mWeightedTarget) - } - - mTcpRoute["action"] = []interface{}{ - map[string]interface{}{ - "weighted_target": schema.NewSet(appmeshRouteWeightedTargetHash, vWeightedTargets), - }, - } - } - - mSpec["tcp_route"] = []interface{}{mTcpRoute} - } - - return []interface{}{mSpec} -} - func flattenAppsyncPipelineConfig(c *appsync.PipelineConfig) []interface{} { if c == nil { return nil From 5cffd043de9673a8592f22cea93abd6a97685ab2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Jul 2019 16:19:51 -0400 Subject: [PATCH 04/23] r/aws_appmesh_route: New attributes for HTTP header routing. --- website/docs/r/appmesh_route.html.markdown | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/website/docs/r/appmesh_route.html.markdown b/website/docs/r/appmesh_route.html.markdown index f011866f53b..73794e262f7 100644 --- a/website/docs/r/appmesh_route.html.markdown +++ b/website/docs/r/appmesh_route.html.markdown @@ -96,12 +96,34 @@ The `match` object supports the following: * `prefix` - (Required) Specifies the path with which to match requests. This parameter must always start with /, which by itself matches all requests to the virtual router service name. +* `header` - (Optional) The HTTP headers with which to match requests. +* `method` - (Optional) The HTTP method with which to match requests. Valid values: `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `CONNECT`, `OPTIONS`, `TRACE`, `PATCH`. +* `scheme` - (Optional) The URL scheme with which to match requests. Valid values: `HTTP`, `HTTPS`. The `weighted_target` object supports the following: * `virtual_node` - (Required) The virtual node to associate with the weighted target. * `weight` - (Required) The relative weight of the weighted target. An integer between 0 and 100. +The `header` object supports the following: + +* `name` - (Required) HTTP header name +* `invert` - (Optional) If `true`, the match is on the opposite of the match type and value. +* `match` - (Optional) The match type and value. + +The `match` object supports the following: + +* `exact` - (Optional) Exact match +* `prefix` - (Optional) Prefix match +* `range`- (Optional) Range match +* `regex` - (Optional) Regex match +* `suffix` - (Optional) Suffix match + +The `range` object supports the following: + +* `end` - (Required) End of the range +* `start` - (Requited) Start of the range + ## Attributes Reference In addition to all arguments above, the following attributes are exported: From 69f78ad0e2d3cc93dec6bf9adb6787fb4f40a0a0 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 23 Jul 2019 16:20:22 -0400 Subject: [PATCH 05/23] r/aws_appmesh_route: 'appmesh' -> 'appmeshpreview'. --- aws/resource_aws_appmesh_route.go | 90 +++++++++++++------------- aws/resource_aws_appmesh_route_test.go | 34 +++++----- aws/resource_aws_appmesh_test.go | 2 +- 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index c5f7e3eae7c..b2d799bea52 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -9,7 +9,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -182,14 +182,14 @@ func resourceAwsAppmeshRoute() *schema.Resource { } func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn - req := &appmesh.CreateRouteInput{ + req := &appmeshpreview.CreateRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), Spec: expandAppmeshRouteSpec(d.Get("spec").([]interface{})), - Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh route: %#v", req) @@ -204,14 +204,14 @@ func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) err } func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn - resp, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ + resp, err := conn.DescribeRoute(&appmeshpreview.DescribeRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), }) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) d.SetId("") return nil @@ -219,7 +219,7 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error if err != nil { return fmt.Errorf("error reading App Mesh route: %s", err) } - if aws.StringValue(resp.Route.Status.Status) == appmesh.RouteStatusCodeDeleted { + if aws.StringValue(resp.Route.Status.Status) == appmeshpreview.RouteStatusCodeDeleted { log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) d.SetId("") return nil @@ -236,25 +236,25 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error setting spec: %s", err) } - err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error saving tags: %s", err) - } + // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) + // if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error saving tags: %s", err) + // } return nil } func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn if d.HasChange("spec") { _, v := d.GetChange("spec") - req := &appmesh.UpdateRouteInput{ + req := &appmeshpreview.UpdateRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), @@ -268,29 +268,29 @@ func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) err } } - err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + // if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error setting tags: %s", err) + // } return resourceAwsAppmeshRouteRead(d, meta) } func resourceAwsAppmeshRouteDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn log.Printf("[DEBUG] Deleting App Mesh route: %s", d.Id()) - _, err := conn.DeleteRoute(&appmesh.DeleteRouteInput{ + _, err := conn.DeleteRoute(&appmeshpreview.DeleteRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), }) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { return nil } if err != nil { @@ -311,9 +311,9 @@ func resourceAwsAppmeshRouteImport(d *schema.ResourceData, meta interface{}) ([] name := parts[2] log.Printf("[DEBUG] Importing App Mesh route %s from mesh %s/virtual router %s ", name, mesh, vrName) - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn - resp, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ + resp, err := conn.DescribeRoute(&appmeshpreview.DescribeRouteInput{ MeshName: aws.String(mesh), RouteName: aws.String(name), VirtualRouterName: aws.String(vrName), @@ -330,8 +330,8 @@ func resourceAwsAppmeshRouteImport(d *schema.ResourceData, meta interface{}) ([] return []*schema.ResourceData{d}, nil } -func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { - spec := &appmesh.RouteSpec{} +func expandAppmeshRouteSpec(vSpec []interface{}) *appmeshpreview.RouteSpec { + spec := &appmeshpreview.RouteSpec{} if len(vSpec) == 0 || vSpec[0] == nil { // Empty Spec is allowed. @@ -342,16 +342,16 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { if vHttpRoute, ok := mSpec["http_route"].([]interface{}); ok && len(vHttpRoute) > 0 && vHttpRoute[0] != nil { mHttpRoute := vHttpRoute[0].(map[string]interface{}) - spec.HttpRoute = &appmesh.HttpRoute{} + spec.HttpRoute = &appmeshpreview.HttpRoute{} if vHttpRouteAction, ok := mHttpRoute["action"].([]interface{}); ok && len(vHttpRouteAction) > 0 && vHttpRouteAction[0] != nil { mHttpRouteAction := vHttpRouteAction[0].(map[string]interface{}) if vWeightedTargets, ok := mHttpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { - weightedTargets := []*appmesh.WeightedTarget{} + weightedTargets := []*appmeshpreview.WeightedTarget{} for _, vWeightedTarget := range vWeightedTargets.List() { - weightedTarget := &appmesh.WeightedTarget{} + weightedTarget := &appmeshpreview.WeightedTarget{} mWeightedTarget := vWeightedTarget.(map[string]interface{}) @@ -365,7 +365,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { weightedTargets = append(weightedTargets, weightedTarget) } - spec.HttpRoute.Action = &appmesh.HttpRouteAction{ + spec.HttpRoute.Action = &appmeshpreview.HttpRouteAction{ WeightedTargets: weightedTargets, } } @@ -375,7 +375,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { mHttpRouteMatch := vHttpRouteMatch[0].(map[string]interface{}) if vPrefix, ok := mHttpRouteMatch["prefix"].(string); ok && vPrefix != "" { - spec.HttpRoute.Match = &appmesh.HttpRouteMatch{ + spec.HttpRoute.Match = &appmeshpreview.HttpRouteMatch{ Prefix: aws.String(vPrefix), } } @@ -385,16 +385,16 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { if vTcpRoute, ok := mSpec["tcp_route"].([]interface{}); ok && len(vTcpRoute) > 0 && vTcpRoute[0] != nil { mTcpRoute := vTcpRoute[0].(map[string]interface{}) - spec.TcpRoute = &appmesh.TcpRoute{} + spec.TcpRoute = &appmeshpreview.TcpRoute{} if vTcpRouteAction, ok := mTcpRoute["action"].([]interface{}); ok && len(vTcpRouteAction) > 0 && vTcpRouteAction[0] != nil { mTcpRouteAction := vTcpRouteAction[0].(map[string]interface{}) if vWeightedTargets, ok := mTcpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { - weightedTargets := []*appmesh.WeightedTarget{} + weightedTargets := []*appmeshpreview.WeightedTarget{} for _, vWeightedTarget := range vWeightedTargets.List() { - weightedTarget := &appmesh.WeightedTarget{} + weightedTarget := &appmeshpreview.WeightedTarget{} mWeightedTarget := vWeightedTarget.(map[string]interface{}) @@ -408,7 +408,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { weightedTargets = append(weightedTargets, weightedTarget) } - spec.TcpRoute.Action = &appmesh.TcpRouteAction{ + spec.TcpRoute.Action = &appmeshpreview.TcpRouteAction{ WeightedTargets: weightedTargets, } } @@ -418,7 +418,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { return spec } -func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { +func flattenAppmeshRouteSpec(spec *appmeshpreview.RouteSpec) []interface{} { if spec == nil { return []interface{}{} } diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index d0019d29f6c..14519ce48df 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -25,38 +25,38 @@ func testSweepAppmeshRoutes(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.(*AWSClient).appmeshconn + conn := client.(*AWSClient).appmeshpreviewconn - err = conn.ListMeshesPages(&appmesh.ListMeshesInput{}, func(page *appmesh.ListMeshesOutput, isLast bool) bool { + err = conn.ListMeshesPages(&appmeshpreview.ListMeshesInput{}, func(page *appmeshpreview.ListMeshesOutput, isLast bool) bool { if page == nil { return !isLast } for _, mesh := range page.Meshes { - listVirtualRoutersInput := &appmesh.ListVirtualRoutersInput{ + listVirtualRoutersInput := &appmeshpreview.ListVirtualRoutersInput{ MeshName: mesh.MeshName, } meshName := aws.StringValue(mesh.MeshName) - err := conn.ListVirtualRoutersPages(listVirtualRoutersInput, func(page *appmesh.ListVirtualRoutersOutput, isLast bool) bool { + err := conn.ListVirtualRoutersPages(listVirtualRoutersInput, func(page *appmeshpreview.ListVirtualRoutersOutput, isLast bool) bool { if page == nil { return !isLast } for _, virtualRouter := range page.VirtualRouters { - listRoutesInput := &appmesh.ListRoutesInput{ + listRoutesInput := &appmeshpreview.ListRoutesInput{ MeshName: mesh.MeshName, VirtualRouterName: virtualRouter.VirtualRouterName, } virtualRouterName := aws.StringValue(virtualRouter.VirtualRouterName) - err := conn.ListRoutesPages(listRoutesInput, func(page *appmesh.ListRoutesOutput, isLast bool) bool { + err := conn.ListRoutesPages(listRoutesInput, func(page *appmeshpreview.ListRoutesOutput, isLast bool) bool { if page == nil { return !isLast } for _, route := range page.Routes { - input := &appmesh.DeleteRouteInput{ + input := &appmeshpreview.DeleteRouteInput{ MeshName: mesh.MeshName, RouteName: route.RouteName, VirtualRouterName: virtualRouter.VirtualRouterName, @@ -101,7 +101,7 @@ func testSweepAppmeshRoutes(region string) error { } func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { - var r appmesh.RouteData + var r appmeshpreview.RouteData resourceName := "aws_appmesh_route.foo" meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) @@ -161,7 +161,7 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { } func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { - var r appmesh.RouteData + var r appmeshpreview.RouteData resourceName := "aws_appmesh_route.foo" meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) @@ -217,7 +217,7 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { } func testAccAwsAppmeshRoute_tags(t *testing.T) { - var r appmesh.RouteData + var r appmeshpreview.RouteData resourceName := "aws_appmesh_route.foo" meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) @@ -273,19 +273,19 @@ func testAccAwsAppmeshRoute_tags(t *testing.T) { } func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appmesh_route" { continue } - _, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ + _, err := conn.DescribeRoute(&appmeshpreview.DescribeRouteInput{ MeshName: aws.String(rs.Primary.Attributes["mesh_name"]), RouteName: aws.String(rs.Primary.Attributes["name"]), VirtualRouterName: aws.String(rs.Primary.Attributes["virtual_router_name"]), }) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { continue } if err != nil { @@ -297,9 +297,9 @@ func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { return nil } -func testAccCheckAppmeshRouteExists(name string, v *appmesh.RouteData) resource.TestCheckFunc { +func testAccCheckAppmeshRouteExists(name string, v *appmeshpreview.RouteData) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn rs, ok := s.RootModule().Resources[name] if !ok { @@ -309,7 +309,7 @@ func testAccCheckAppmeshRouteExists(name string, v *appmesh.RouteData) resource. return fmt.Errorf("No ID is set") } - resp, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ + resp, err := conn.DescribeRoute(&appmeshpreview.DescribeRouteInput{ MeshName: aws.String(rs.Primary.Attributes["mesh_name"]), RouteName: aws.String(rs.Primary.Attributes["name"]), VirtualRouterName: aws.String(rs.Primary.Attributes["virtual_router_name"]), diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index bc26eadbc17..67683664674 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -14,7 +14,7 @@ func TestAccAWSAppmesh(t *testing.T) { "Route": { "httpRoute": testAccAwsAppmeshRoute_httpRoute, "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, - "tags": testAccAwsAppmeshRoute_tags, + // "tags": testAccAwsAppmeshRoute_tags, }, "VirtualNode": { "basic": testAccAwsAppmeshVirtualNode_basic, From 0a7dddcffc9145a6b11f8c958323fd344ee55e73 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Jul 2019 09:43:32 -0400 Subject: [PATCH 06/23] Revert "r/aws_appmesh_route: 'appmesh' -> 'appmeshpreview'." This reverts commit 69f78ad0e2d3cc93dec6bf9adb6787fb4f40a0a0. --- aws/resource_aws_appmesh_route.go | 90 +++++++++++++------------- aws/resource_aws_appmesh_route_test.go | 34 +++++----- aws/resource_aws_appmesh_test.go | 2 +- 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index b2d799bea52..c5f7e3eae7c 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -9,7 +9,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmeshpreview" + "github.com/aws/aws-sdk-go/service/appmesh" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -182,14 +182,14 @@ func resourceAwsAppmeshRoute() *schema.Resource { } func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshpreviewconn + conn := meta.(*AWSClient).appmeshconn - req := &appmeshpreview.CreateRouteInput{ + req := &appmesh.CreateRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), Spec: expandAppmeshRouteSpec(d.Get("spec").([]interface{})), - // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh route: %#v", req) @@ -204,14 +204,14 @@ func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) err } func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshpreviewconn + conn := meta.(*AWSClient).appmeshconn - resp, err := conn.DescribeRoute(&appmeshpreview.DescribeRouteInput{ + resp, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), }) - if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { + if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) d.SetId("") return nil @@ -219,7 +219,7 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error if err != nil { return fmt.Errorf("error reading App Mesh route: %s", err) } - if aws.StringValue(resp.Route.Status.Status) == appmeshpreview.RouteStatusCodeDeleted { + if aws.StringValue(resp.Route.Status.Status) == appmesh.RouteStatusCodeDeleted { log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) d.SetId("") return nil @@ -236,25 +236,25 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error setting spec: %s", err) } - // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) - // if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { - // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - // d.SetId("") - // return nil - // } - // if err != nil { - // return fmt.Errorf("error saving tags: %s", err) - // } + err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) + if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { + return fmt.Errorf("error saving tags: %s", err) + } return nil } func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshpreviewconn + conn := meta.(*AWSClient).appmeshconn if d.HasChange("spec") { _, v := d.GetChange("spec") - req := &appmeshpreview.UpdateRouteInput{ + req := &appmesh.UpdateRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), @@ -268,29 +268,29 @@ func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) err } } - // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - // if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { - // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - // d.SetId("") - // return nil - // } - // if err != nil { - // return fmt.Errorf("error setting tags: %s", err) - // } + err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { + return fmt.Errorf("error setting tags: %s", err) + } return resourceAwsAppmeshRouteRead(d, meta) } func resourceAwsAppmeshRouteDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshpreviewconn + conn := meta.(*AWSClient).appmeshconn log.Printf("[DEBUG] Deleting App Mesh route: %s", d.Id()) - _, err := conn.DeleteRoute(&appmeshpreview.DeleteRouteInput{ + _, err := conn.DeleteRoute(&appmesh.DeleteRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), }) - if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { + if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { return nil } if err != nil { @@ -311,9 +311,9 @@ func resourceAwsAppmeshRouteImport(d *schema.ResourceData, meta interface{}) ([] name := parts[2] log.Printf("[DEBUG] Importing App Mesh route %s from mesh %s/virtual router %s ", name, mesh, vrName) - conn := meta.(*AWSClient).appmeshpreviewconn + conn := meta.(*AWSClient).appmeshconn - resp, err := conn.DescribeRoute(&appmeshpreview.DescribeRouteInput{ + resp, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ MeshName: aws.String(mesh), RouteName: aws.String(name), VirtualRouterName: aws.String(vrName), @@ -330,8 +330,8 @@ func resourceAwsAppmeshRouteImport(d *schema.ResourceData, meta interface{}) ([] return []*schema.ResourceData{d}, nil } -func expandAppmeshRouteSpec(vSpec []interface{}) *appmeshpreview.RouteSpec { - spec := &appmeshpreview.RouteSpec{} +func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { + spec := &appmesh.RouteSpec{} if len(vSpec) == 0 || vSpec[0] == nil { // Empty Spec is allowed. @@ -342,16 +342,16 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmeshpreview.RouteSpec { if vHttpRoute, ok := mSpec["http_route"].([]interface{}); ok && len(vHttpRoute) > 0 && vHttpRoute[0] != nil { mHttpRoute := vHttpRoute[0].(map[string]interface{}) - spec.HttpRoute = &appmeshpreview.HttpRoute{} + spec.HttpRoute = &appmesh.HttpRoute{} if vHttpRouteAction, ok := mHttpRoute["action"].([]interface{}); ok && len(vHttpRouteAction) > 0 && vHttpRouteAction[0] != nil { mHttpRouteAction := vHttpRouteAction[0].(map[string]interface{}) if vWeightedTargets, ok := mHttpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { - weightedTargets := []*appmeshpreview.WeightedTarget{} + weightedTargets := []*appmesh.WeightedTarget{} for _, vWeightedTarget := range vWeightedTargets.List() { - weightedTarget := &appmeshpreview.WeightedTarget{} + weightedTarget := &appmesh.WeightedTarget{} mWeightedTarget := vWeightedTarget.(map[string]interface{}) @@ -365,7 +365,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmeshpreview.RouteSpec { weightedTargets = append(weightedTargets, weightedTarget) } - spec.HttpRoute.Action = &appmeshpreview.HttpRouteAction{ + spec.HttpRoute.Action = &appmesh.HttpRouteAction{ WeightedTargets: weightedTargets, } } @@ -375,7 +375,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmeshpreview.RouteSpec { mHttpRouteMatch := vHttpRouteMatch[0].(map[string]interface{}) if vPrefix, ok := mHttpRouteMatch["prefix"].(string); ok && vPrefix != "" { - spec.HttpRoute.Match = &appmeshpreview.HttpRouteMatch{ + spec.HttpRoute.Match = &appmesh.HttpRouteMatch{ Prefix: aws.String(vPrefix), } } @@ -385,16 +385,16 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmeshpreview.RouteSpec { if vTcpRoute, ok := mSpec["tcp_route"].([]interface{}); ok && len(vTcpRoute) > 0 && vTcpRoute[0] != nil { mTcpRoute := vTcpRoute[0].(map[string]interface{}) - spec.TcpRoute = &appmeshpreview.TcpRoute{} + spec.TcpRoute = &appmesh.TcpRoute{} if vTcpRouteAction, ok := mTcpRoute["action"].([]interface{}); ok && len(vTcpRouteAction) > 0 && vTcpRouteAction[0] != nil { mTcpRouteAction := vTcpRouteAction[0].(map[string]interface{}) if vWeightedTargets, ok := mTcpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { - weightedTargets := []*appmeshpreview.WeightedTarget{} + weightedTargets := []*appmesh.WeightedTarget{} for _, vWeightedTarget := range vWeightedTargets.List() { - weightedTarget := &appmeshpreview.WeightedTarget{} + weightedTarget := &appmesh.WeightedTarget{} mWeightedTarget := vWeightedTarget.(map[string]interface{}) @@ -408,7 +408,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmeshpreview.RouteSpec { weightedTargets = append(weightedTargets, weightedTarget) } - spec.TcpRoute.Action = &appmeshpreview.TcpRouteAction{ + spec.TcpRoute.Action = &appmesh.TcpRouteAction{ WeightedTargets: weightedTargets, } } @@ -418,7 +418,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmeshpreview.RouteSpec { return spec } -func flattenAppmeshRouteSpec(spec *appmeshpreview.RouteSpec) []interface{} { +func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { if spec == nil { return []interface{}{} } diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index 14519ce48df..d0019d29f6c 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmeshpreview" + "github.com/aws/aws-sdk-go/service/appmesh" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -25,38 +25,38 @@ func testSweepAppmeshRoutes(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.(*AWSClient).appmeshpreviewconn + conn := client.(*AWSClient).appmeshconn - err = conn.ListMeshesPages(&appmeshpreview.ListMeshesInput{}, func(page *appmeshpreview.ListMeshesOutput, isLast bool) bool { + err = conn.ListMeshesPages(&appmesh.ListMeshesInput{}, func(page *appmesh.ListMeshesOutput, isLast bool) bool { if page == nil { return !isLast } for _, mesh := range page.Meshes { - listVirtualRoutersInput := &appmeshpreview.ListVirtualRoutersInput{ + listVirtualRoutersInput := &appmesh.ListVirtualRoutersInput{ MeshName: mesh.MeshName, } meshName := aws.StringValue(mesh.MeshName) - err := conn.ListVirtualRoutersPages(listVirtualRoutersInput, func(page *appmeshpreview.ListVirtualRoutersOutput, isLast bool) bool { + err := conn.ListVirtualRoutersPages(listVirtualRoutersInput, func(page *appmesh.ListVirtualRoutersOutput, isLast bool) bool { if page == nil { return !isLast } for _, virtualRouter := range page.VirtualRouters { - listRoutesInput := &appmeshpreview.ListRoutesInput{ + listRoutesInput := &appmesh.ListRoutesInput{ MeshName: mesh.MeshName, VirtualRouterName: virtualRouter.VirtualRouterName, } virtualRouterName := aws.StringValue(virtualRouter.VirtualRouterName) - err := conn.ListRoutesPages(listRoutesInput, func(page *appmeshpreview.ListRoutesOutput, isLast bool) bool { + err := conn.ListRoutesPages(listRoutesInput, func(page *appmesh.ListRoutesOutput, isLast bool) bool { if page == nil { return !isLast } for _, route := range page.Routes { - input := &appmeshpreview.DeleteRouteInput{ + input := &appmesh.DeleteRouteInput{ MeshName: mesh.MeshName, RouteName: route.RouteName, VirtualRouterName: virtualRouter.VirtualRouterName, @@ -101,7 +101,7 @@ func testSweepAppmeshRoutes(region string) error { } func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { - var r appmeshpreview.RouteData + var r appmesh.RouteData resourceName := "aws_appmesh_route.foo" meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) @@ -161,7 +161,7 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { } func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { - var r appmeshpreview.RouteData + var r appmesh.RouteData resourceName := "aws_appmesh_route.foo" meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) @@ -217,7 +217,7 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { } func testAccAwsAppmeshRoute_tags(t *testing.T) { - var r appmeshpreview.RouteData + var r appmesh.RouteData resourceName := "aws_appmesh_route.foo" meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) @@ -273,19 +273,19 @@ func testAccAwsAppmeshRoute_tags(t *testing.T) { } func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn + conn := testAccProvider.Meta().(*AWSClient).appmeshconn for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appmesh_route" { continue } - _, err := conn.DescribeRoute(&appmeshpreview.DescribeRouteInput{ + _, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ MeshName: aws.String(rs.Primary.Attributes["mesh_name"]), RouteName: aws.String(rs.Primary.Attributes["name"]), VirtualRouterName: aws.String(rs.Primary.Attributes["virtual_router_name"]), }) - if isAWSErr(err, appmeshpreview.ErrCodeNotFoundException, "") { + if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { continue } if err != nil { @@ -297,9 +297,9 @@ func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { return nil } -func testAccCheckAppmeshRouteExists(name string, v *appmeshpreview.RouteData) resource.TestCheckFunc { +func testAccCheckAppmeshRouteExists(name string, v *appmesh.RouteData) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn + conn := testAccProvider.Meta().(*AWSClient).appmeshconn rs, ok := s.RootModule().Resources[name] if !ok { @@ -309,7 +309,7 @@ func testAccCheckAppmeshRouteExists(name string, v *appmeshpreview.RouteData) re return fmt.Errorf("No ID is set") } - resp, err := conn.DescribeRoute(&appmeshpreview.DescribeRouteInput{ + resp, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ MeshName: aws.String(rs.Primary.Attributes["mesh_name"]), RouteName: aws.String(rs.Primary.Attributes["name"]), VirtualRouterName: aws.String(rs.Primary.Attributes["virtual_router_name"]), diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index 67683664674..bc26eadbc17 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -14,7 +14,7 @@ func TestAccAWSAppmesh(t *testing.T) { "Route": { "httpRoute": testAccAwsAppmeshRoute_httpRoute, "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, - // "tags": testAccAwsAppmeshRoute_tags, + "tags": testAccAwsAppmeshRoute_tags, }, "VirtualNode": { "basic": testAccAwsAppmeshVirtualNode_basic, From a9d71250e54d9883441e39b9b1a424cf1010f044 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Jul 2019 09:51:33 -0400 Subject: [PATCH 07/23] r/aws_appmesh_route: Comment out tagging support temporarily. --- aws/resource_aws_appmesh_route.go | 41 +++--- aws/resource_aws_appmesh_route_test.go | 172 +++++++++++++------------ aws/resource_aws_appmesh_test.go | 3 +- 3 files changed, 111 insertions(+), 105 deletions(-) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index c5f7e3eae7c..dbc501e50b3 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -189,7 +189,8 @@ func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) err RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), Spec: expandAppmeshRouteSpec(d.Get("spec").([]interface{})), - Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + // TODO Reinstate AppMesh tagging support. + // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh route: %#v", req) @@ -236,15 +237,16 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error setting spec: %s", err) } - err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error saving tags: %s", err) - } + // TODO Reinstate AppMesh tagging support. + // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error saving tags: %s", err) + // } return nil } @@ -268,15 +270,16 @@ func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) err } } - err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + // TODO Reinstate AppMesh tagging support. + // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error setting tags: %s", err) + // } return resourceAwsAppmeshRouteRead(d, meta) } diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index d0019d29f6c..e6eb576b956 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -216,61 +216,62 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { }) } -func testAccAwsAppmeshRoute_tags(t *testing.T) { - var r appmesh.RouteData - resourceName := "aws_appmesh_route.foo" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) - vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshRouteDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo", "bar", "good", "bad"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad"), - ), - }, - { - Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo2", "bar", "good", "bad2"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo2", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad2"), - ), - }, - { - Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "0"), - ), - }, - { - ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +// TODO Reinstate AppMesh tagging support. +// func testAccAwsAppmeshRoute_tags(t *testing.T) { +// var r appmesh.RouteData +// resourceName := "aws_appmesh_route.foo" +// meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) +// vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) +// vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) +// vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) +// rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) + +// resource.Test(t, resource.TestCase{ +// PreCheck: func() { testAccPreCheck(t) }, +// Providers: testAccProviders, +// CheckDestroy: testAccCheckAppmeshRouteDestroy, +// Steps: []resource.TestStep{ +// { +// Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo", "bar", "good", "bad"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad"), +// ), +// }, +// { +// Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo2", "bar", "good", "bad2"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo2", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad2"), +// ), +// }, +// { +// Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "0"), +// ), +// }, +// { +// ResourceName: resourceName, +// ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), +// ImportState: true, +// ImportStateVerify: true, +// }, +// }, +// }) +// } func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshconn @@ -466,33 +467,34 @@ resource "aws_appmesh_route" "foo" { `, rName) } -func testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { - return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` - -resource "aws_appmesh_route" "foo" { - name = %[1]q - mesh_name = "${aws_appmesh_mesh.foo.id}" - virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" - - spec { - http_route { - match { - prefix = "/" - } - - action { - weighted_target { - virtual_node = "${aws_appmesh_virtual_node.foo.name}" - weight = 100 - } - } - } - } - - tags = { - %[2]s = %[3]q - %[4]s = %[5]q - } -} -`, rName, tagKey1, tagValue1, tagKey2, tagValue2) -} +// TODO Reinstate AppMesh tagging support. +// func testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { +// return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` + +// resource "aws_appmesh_route" "foo" { +// name = %[1]q +// mesh_name = "${aws_appmesh_mesh.foo.id}" +// virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" + +// spec { +// http_route { +// match { +// prefix = "/" +// } + +// action { +// weighted_target { +// virtual_node = "${aws_appmesh_virtual_node.foo.name}" +// weight = 100 +// } +// } +// } +// } + +// tags = { +// %[2]s = %[3]q +// %[4]s = %[5]q +// } +// } +// `, rName, tagKey1, tagValue1, tagKey2, tagValue2) +// } diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index bc26eadbc17..fd305636253 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -14,7 +14,8 @@ func TestAccAWSAppmesh(t *testing.T) { "Route": { "httpRoute": testAccAwsAppmeshRoute_httpRoute, "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, - "tags": testAccAwsAppmeshRoute_tags, + // TODO Reinstate AppMesh tagging support. + // "tags": testAccAwsAppmeshRoute_tags, }, "VirtualNode": { "basic": testAccAwsAppmeshVirtualNode_basic, From dbbba1bdfdf8fe059cc244cbf4e46e06d4af2663 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Jul 2019 10:17:48 -0400 Subject: [PATCH 08/23] Revert "r/aws_appmesh_route: Comment out tagging support temporarily." This reverts commit a9d71250e54d9883441e39b9b1a424cf1010f044. --- aws/resource_aws_appmesh_route.go | 41 +++--- aws/resource_aws_appmesh_route_test.go | 172 ++++++++++++------------- aws/resource_aws_appmesh_test.go | 3 +- 3 files changed, 105 insertions(+), 111 deletions(-) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index dbc501e50b3..c5f7e3eae7c 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -189,8 +189,7 @@ func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) err RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), Spec: expandAppmeshRouteSpec(d.Get("spec").([]interface{})), - // TODO Reinstate AppMesh tagging support. - // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh route: %#v", req) @@ -237,16 +236,15 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error setting spec: %s", err) } - // TODO Reinstate AppMesh tagging support. - // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) - // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - // d.SetId("") - // return nil - // } - // if err != nil { - // return fmt.Errorf("error saving tags: %s", err) - // } + err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) + if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { + return fmt.Errorf("error saving tags: %s", err) + } return nil } @@ -270,16 +268,15 @@ func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) err } } - // TODO Reinstate AppMesh tagging support. - // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - // d.SetId("") - // return nil - // } - // if err != nil { - // return fmt.Errorf("error setting tags: %s", err) - // } + err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { + return fmt.Errorf("error setting tags: %s", err) + } return resourceAwsAppmeshRouteRead(d, meta) } diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index e6eb576b956..d0019d29f6c 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -216,62 +216,61 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { }) } -// TODO Reinstate AppMesh tagging support. -// func testAccAwsAppmeshRoute_tags(t *testing.T) { -// var r appmesh.RouteData -// resourceName := "aws_appmesh_route.foo" -// meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) -// vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) -// vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) -// vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) -// rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) - -// resource.Test(t, resource.TestCase{ -// PreCheck: func() { testAccPreCheck(t) }, -// Providers: testAccProviders, -// CheckDestroy: testAccCheckAppmeshRouteDestroy, -// Steps: []resource.TestStep{ -// { -// Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo", "bar", "good", "bad"), -// Check: resource.ComposeTestCheckFunc( -// testAccCheckAppmeshRouteExists(resourceName, &r), -// resource.TestCheckResourceAttr( -// resourceName, "tags.%", "2"), -// resource.TestCheckResourceAttr( -// resourceName, "tags.foo", "bar"), -// resource.TestCheckResourceAttr( -// resourceName, "tags.good", "bad"), -// ), -// }, -// { -// Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo2", "bar", "good", "bad2"), -// Check: resource.ComposeTestCheckFunc( -// testAccCheckAppmeshRouteExists(resourceName, &r), -// resource.TestCheckResourceAttr( -// resourceName, "tags.%", "2"), -// resource.TestCheckResourceAttr( -// resourceName, "tags.foo2", "bar"), -// resource.TestCheckResourceAttr( -// resourceName, "tags.good", "bad2"), -// ), -// }, -// { -// Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), -// Check: resource.ComposeTestCheckFunc( -// testAccCheckAppmeshRouteExists(resourceName, &r), -// resource.TestCheckResourceAttr( -// resourceName, "tags.%", "0"), -// ), -// }, -// { -// ResourceName: resourceName, -// ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), -// ImportState: true, -// ImportStateVerify: true, -// }, -// }, -// }) -// } +func testAccAwsAppmeshRoute_tags(t *testing.T) { + var r appmesh.RouteData + resourceName := "aws_appmesh_route.foo" + meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) + vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) + vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) + vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) + rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAppmeshRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo", "bar", "good", "bad"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAppmeshRouteExists(resourceName, &r), + resource.TestCheckResourceAttr( + resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr( + resourceName, "tags.foo", "bar"), + resource.TestCheckResourceAttr( + resourceName, "tags.good", "bad"), + ), + }, + { + Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo2", "bar", "good", "bad2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAppmeshRouteExists(resourceName, &r), + resource.TestCheckResourceAttr( + resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr( + resourceName, "tags.foo2", "bar"), + resource.TestCheckResourceAttr( + resourceName, "tags.good", "bad2"), + ), + }, + { + Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAppmeshRouteExists(resourceName, &r), + resource.TestCheckResourceAttr( + resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshconn @@ -467,34 +466,33 @@ resource "aws_appmesh_route" "foo" { `, rName) } -// TODO Reinstate AppMesh tagging support. -// func testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { -// return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` - -// resource "aws_appmesh_route" "foo" { -// name = %[1]q -// mesh_name = "${aws_appmesh_mesh.foo.id}" -// virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" - -// spec { -// http_route { -// match { -// prefix = "/" -// } - -// action { -// weighted_target { -// virtual_node = "${aws_appmesh_virtual_node.foo.name}" -// weight = 100 -// } -// } -// } -// } - -// tags = { -// %[2]s = %[3]q -// %[4]s = %[5]q -// } -// } -// `, rName, tagKey1, tagValue1, tagKey2, tagValue2) -// } +func testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { + return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` + +resource "aws_appmesh_route" "foo" { + name = %[1]q + mesh_name = "${aws_appmesh_mesh.foo.id}" + virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" + + spec { + http_route { + match { + prefix = "/" + } + + action { + weighted_target { + virtual_node = "${aws_appmesh_virtual_node.foo.name}" + weight = 100 + } + } + } + } + + tags = { + %[2]s = %[3]q + %[4]s = %[5]q + } +} +`, rName, tagKey1, tagValue1, tagKey2, tagValue2) +} diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index fd305636253..bc26eadbc17 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -14,8 +14,7 @@ func TestAccAWSAppmesh(t *testing.T) { "Route": { "httpRoute": testAccAwsAppmeshRoute_httpRoute, "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, - // TODO Reinstate AppMesh tagging support. - // "tags": testAccAwsAppmeshRoute_tags, + "tags": testAccAwsAppmeshRoute_tags, }, "VirtualNode": { "basic": testAccAwsAppmeshVirtualNode_basic, From 3b1a4320041d13113c6fa3b70d578a9bcc22b47c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Jul 2019 10:35:44 -0400 Subject: [PATCH 09/23] Move other Appmesh structure functions to resource files. --- aws/resource_aws_appmesh_mesh.go | 40 ++ aws/resource_aws_appmesh_virtual_node.go | 269 ++++++++++- ...source_aws_appmesh_virtual_node_migrate.go | 2 +- aws/resource_aws_appmesh_virtual_router.go | 69 +++ aws/resource_aws_appmesh_virtual_service.go | 70 +++ aws/structure.go | 441 ------------------ 6 files changed, 445 insertions(+), 446 deletions(-) diff --git a/aws/resource_aws_appmesh_mesh.go b/aws/resource_aws_appmesh_mesh.go index 7ab40e45c40..2fe5c7e497e 100644 --- a/aws/resource_aws_appmesh_mesh.go +++ b/aws/resource_aws_appmesh_mesh.go @@ -189,3 +189,43 @@ func resourceAwsAppmeshMeshDelete(d *schema.ResourceData, meta interface{}) erro return nil } + +func expandAppmeshMeshSpec(vSpec []interface{}) *appmesh.MeshSpec { + spec := &appmesh.MeshSpec{} + + if len(vSpec) == 0 || vSpec[0] == nil { + // Empty Spec is allowed. + return spec + } + mSpec := vSpec[0].(map[string]interface{}) + + if vEgressFilter, ok := mSpec["egress_filter"].([]interface{}); ok && len(vEgressFilter) > 0 && vEgressFilter[0] != nil { + mEgressFilter := vEgressFilter[0].(map[string]interface{}) + + if vType, ok := mEgressFilter["type"].(string); ok && vType != "" { + spec.EgressFilter = &appmesh.EgressFilter{ + Type: aws.String(vType), + } + } + } + + return spec +} + +func flattenAppmeshMeshSpec(spec *appmesh.MeshSpec) []interface{} { + if spec == nil { + return []interface{}{} + } + + mSpec := map[string]interface{}{} + + if spec.EgressFilter != nil { + mSpec["egress_filter"] = []interface{}{ + map[string]interface{}{ + "type": aws.StringValue(spec.EgressFilter.Type), + }, + } + } + + return []interface{}{mSpec} +} diff --git a/aws/resource_aws_appmesh_virtual_node.go b/aws/resource_aws_appmesh_virtual_node.go index 6ff75998551..5149d9486a1 100644 --- a/aws/resource_aws_appmesh_virtual_node.go +++ b/aws/resource_aws_appmesh_virtual_node.go @@ -81,7 +81,7 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { }, }, }, - Set: appmeshVirtualNodeBackendHash, + Set: appmeshBackendHash, }, "listener": { @@ -172,7 +172,7 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { }, }, }, - Set: appmeshVirtualNodeListenerHash, + Set: appmeshListenerHash, }, "logging": { @@ -437,7 +437,268 @@ func resourceAwsAppmeshVirtualNodeImport(d *schema.ResourceData, meta interface{ return []*schema.ResourceData{d}, nil } -func appmeshVirtualNodeBackendHash(vBackend interface{}) int { +func expandAppmeshVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { + spec := &appmesh.VirtualNodeSpec{} + + if len(vSpec) == 0 || vSpec[0] == nil { + // Empty Spec is allowed. + return spec + } + mSpec := vSpec[0].(map[string]interface{}) + + if vBackends, ok := mSpec["backend"].(*schema.Set); ok && vBackends.Len() > 0 { + backends := []*appmesh.Backend{} + + for _, vBackend := range vBackends.List() { + backend := &appmesh.Backend{} + + mBackend := vBackend.(map[string]interface{}) + + if vVirtualService, ok := mBackend["virtual_service"].([]interface{}); ok && len(vVirtualService) > 0 && vVirtualService[0] != nil { + mVirtualService := vVirtualService[0].(map[string]interface{}) + + backend.VirtualService = &appmesh.VirtualServiceBackend{} + + if vVirtualServiceName, ok := mVirtualService["virtual_service_name"].(string); ok { + backend.VirtualService.VirtualServiceName = aws.String(vVirtualServiceName) + } + } + backends = append(backends, backend) + } + + spec.Backends = backends + } + + if vListeners, ok := mSpec["listener"].(*schema.Set); ok && vListeners.Len() > 0 { + listeners := []*appmesh.Listener{} + + for _, vListener := range vListeners.List() { + listener := &appmesh.Listener{} + + mListener := vListener.(map[string]interface{}) + + if vHealthCheck, ok := mListener["health_check"].([]interface{}); ok && len(vHealthCheck) > 0 && vHealthCheck[0] != nil { + mHealthCheck := vHealthCheck[0].(map[string]interface{}) + + listener.HealthCheck = &appmesh.HealthCheckPolicy{} + + if vHealthyThreshold, ok := mHealthCheck["healthy_threshold"].(int); ok && vHealthyThreshold > 0 { + listener.HealthCheck.HealthyThreshold = aws.Int64(int64(vHealthyThreshold)) + } + if vIntervalMillis, ok := mHealthCheck["interval_millis"].(int); ok && vIntervalMillis > 0 { + listener.HealthCheck.IntervalMillis = aws.Int64(int64(vIntervalMillis)) + } + if vPath, ok := mHealthCheck["path"].(string); ok && vPath != "" { + listener.HealthCheck.Path = aws.String(vPath) + } + if vPort, ok := mHealthCheck["port"].(int); ok && vPort > 0 { + listener.HealthCheck.Port = aws.Int64(int64(vPort)) + } + if vProtocol, ok := mHealthCheck["protocol"].(string); ok && vProtocol != "" { + listener.HealthCheck.Protocol = aws.String(vProtocol) + } + if vTimeoutMillis, ok := mHealthCheck["timeout_millis"].(int); ok && vTimeoutMillis > 0 { + listener.HealthCheck.TimeoutMillis = aws.Int64(int64(vTimeoutMillis)) + } + if vUnhealthyThreshold, ok := mHealthCheck["unhealthy_threshold"].(int); ok && vUnhealthyThreshold > 0 { + listener.HealthCheck.UnhealthyThreshold = aws.Int64(int64(vUnhealthyThreshold)) + } + } + + if vPortMapping, ok := mListener["port_mapping"].([]interface{}); ok && len(vPortMapping) > 0 && vPortMapping[0] != nil { + mPortMapping := vPortMapping[0].(map[string]interface{}) + + listener.PortMapping = &appmesh.PortMapping{} + + if vPort, ok := mPortMapping["port"].(int); ok && vPort > 0 { + listener.PortMapping.Port = aws.Int64(int64(vPort)) + } + if vProtocol, ok := mPortMapping["protocol"].(string); ok && vProtocol != "" { + listener.PortMapping.Protocol = aws.String(vProtocol) + } + } + + listeners = append(listeners, listener) + } + + spec.Listeners = listeners + } + + if vLogging, ok := mSpec["logging"].([]interface{}); ok && len(vLogging) > 0 && vLogging[0] != nil { + mLogging := vLogging[0].(map[string]interface{}) + + if vAccessLog, ok := mLogging["access_log"].([]interface{}); ok && len(vAccessLog) > 0 && vAccessLog[0] != nil { + mAccessLog := vAccessLog[0].(map[string]interface{}) + + if vFile, ok := mAccessLog["file"].([]interface{}); ok && len(vFile) > 0 && vFile[0] != nil { + mFile := vFile[0].(map[string]interface{}) + + if vPath, ok := mFile["path"].(string); ok && vPath != "" { + spec.Logging = &appmesh.Logging{ + AccessLog: &appmesh.AccessLog{ + File: &appmesh.FileAccessLog{ + Path: aws.String(vPath), + }, + }, + } + } + } + } + } + + if vServiceDiscovery, ok := mSpec["service_discovery"].([]interface{}); ok && len(vServiceDiscovery) > 0 && vServiceDiscovery[0] != nil { + spec.ServiceDiscovery = &appmesh.ServiceDiscovery{} + + mServiceDiscovery := vServiceDiscovery[0].(map[string]interface{}) + + if vAwsCloudMap, ok := mServiceDiscovery["aws_cloud_map"].([]interface{}); ok && len(vAwsCloudMap) > 0 && vAwsCloudMap[0] != nil { + spec.ServiceDiscovery.AwsCloudMap = &appmesh.AwsCloudMapServiceDiscovery{} + + mAwsCloudMap := vAwsCloudMap[0].(map[string]interface{}) + + if vAttributes, ok := mAwsCloudMap["attributes"].(map[string]interface{}); ok && len(vAttributes) > 0 { + attributes := []*appmesh.AwsCloudMapInstanceAttribute{} + + for k, v := range vAttributes { + attributes = append(attributes, &appmesh.AwsCloudMapInstanceAttribute{ + Key: aws.String(k), + Value: aws.String(v.(string)), + }) + } + + spec.ServiceDiscovery.AwsCloudMap.Attributes = attributes + } + if vNamespaceName, ok := mAwsCloudMap["namespace_name"].(string); ok && vNamespaceName != "" { + spec.ServiceDiscovery.AwsCloudMap.NamespaceName = aws.String(vNamespaceName) + } + if vServiceName, ok := mAwsCloudMap["service_name"].(string); ok && vServiceName != "" { + spec.ServiceDiscovery.AwsCloudMap.ServiceName = aws.String(vServiceName) + } + } + + if vDns, ok := mServiceDiscovery["dns"].([]interface{}); ok && len(vDns) > 0 && vDns[0] != nil { + mDns := vDns[0].(map[string]interface{}) + + if vHostname, ok := mDns["hostname"].(string); ok && vHostname != "" { + spec.ServiceDiscovery.Dns = &appmesh.DnsServiceDiscovery{ + Hostname: aws.String(vHostname), + } + } + } + } + + return spec +} + +func flattenAppmeshVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { + if spec == nil { + return []interface{}{} + } + + mSpec := map[string]interface{}{} + + if spec.Backends != nil { + vBackends := []interface{}{} + + for _, backend := range spec.Backends { + mBackend := map[string]interface{}{} + + if backend.VirtualService != nil { + mVirtualService := map[string]interface{}{ + "virtual_service_name": aws.StringValue(backend.VirtualService.VirtualServiceName), + } + mBackend["virtual_service"] = []interface{}{mVirtualService} + } + + vBackends = append(vBackends, mBackend) + } + + mSpec["backend"] = schema.NewSet(appmeshBackendHash, vBackends) + } + + if spec.Listeners != nil { + vListeners := []interface{}{} + + for _, listener := range spec.Listeners { + mListener := map[string]interface{}{} + + if listener.HealthCheck != nil { + mHealthCheck := map[string]interface{}{ + "healthy_threshold": int(aws.Int64Value(listener.HealthCheck.HealthyThreshold)), + "interval_millis": int(aws.Int64Value(listener.HealthCheck.IntervalMillis)), + "path": aws.StringValue(listener.HealthCheck.Path), + "port": int(aws.Int64Value(listener.HealthCheck.Port)), + "protocol": aws.StringValue(listener.HealthCheck.Protocol), + "timeout_millis": int(aws.Int64Value(listener.HealthCheck.TimeoutMillis)), + "unhealthy_threshold": int(aws.Int64Value(listener.HealthCheck.UnhealthyThreshold)), + } + mListener["health_check"] = []interface{}{mHealthCheck} + } + + if listener.PortMapping != nil { + mPortMapping := map[string]interface{}{ + "port": int(aws.Int64Value(listener.PortMapping.Port)), + "protocol": aws.StringValue(listener.PortMapping.Protocol), + } + mListener["port_mapping"] = []interface{}{mPortMapping} + } + + vListeners = append(vListeners, mListener) + } + + mSpec["listener"] = schema.NewSet(appmeshListenerHash, vListeners) + } + + if spec.Logging != nil && spec.Logging.AccessLog != nil && spec.Logging.AccessLog.File != nil { + mSpec["logging"] = []interface{}{ + map[string]interface{}{ + "access_log": []interface{}{ + map[string]interface{}{ + "file": []interface{}{ + map[string]interface{}{ + "path": aws.StringValue(spec.Logging.AccessLog.File.Path), + }, + }, + }, + }, + }, + } + } + + if spec.ServiceDiscovery != nil { + mServiceDiscovery := map[string]interface{}{} + + if spec.ServiceDiscovery.AwsCloudMap != nil { + vAttributes := map[string]interface{}{} + + for _, attribute := range spec.ServiceDiscovery.AwsCloudMap.Attributes { + vAttributes[aws.StringValue(attribute.Key)] = aws.StringValue(attribute.Value) + } + + mServiceDiscovery["aws_cloud_map"] = []interface{}{ + map[string]interface{}{ + "attributes": vAttributes, + "namespace_name": aws.StringValue(spec.ServiceDiscovery.AwsCloudMap.NamespaceName), + "service_name": aws.StringValue(spec.ServiceDiscovery.AwsCloudMap.ServiceName), + }, + } + } + + if spec.ServiceDiscovery.Dns != nil { + mServiceDiscovery["dns"] = []interface{}{ + map[string]interface{}{ + "hostname": aws.StringValue(spec.ServiceDiscovery.Dns.Hostname), + }, + } + } + + mSpec["service_discovery"] = []interface{}{mServiceDiscovery} + } + + return []interface{}{mSpec} +} + +func appmeshBackendHash(vBackend interface{}) int { var buf bytes.Buffer mBackend := vBackend.(map[string]interface{}) if vVirtualService, ok := mBackend["virtual_service"].([]interface{}); ok && len(vVirtualService) > 0 && vVirtualService[0] != nil { @@ -449,7 +710,7 @@ func appmeshVirtualNodeBackendHash(vBackend interface{}) int { return hashcode.String(buf.String()) } -func appmeshVirtualNodeListenerHash(vListener interface{}) int { +func appmeshListenerHash(vListener interface{}) int { var buf bytes.Buffer mListener := vListener.(map[string]interface{}) if vHealthCheck, ok := mListener["health_check"].([]interface{}); ok && len(vHealthCheck) > 0 && vHealthCheck[0] != nil { diff --git a/aws/resource_aws_appmesh_virtual_node_migrate.go b/aws/resource_aws_appmesh_virtual_node_migrate.go index eb71da9efdd..312f2352c35 100644 --- a/aws/resource_aws_appmesh_virtual_node_migrate.go +++ b/aws/resource_aws_appmesh_virtual_node_migrate.go @@ -29,7 +29,7 @@ func migrateAppmeshVirtualNodeStateV0toV1(is *terraform.InstanceState) (*terrafo delete(is.Attributes, "spec.0.backends.#") for k, v := range is.Attributes { if strings.HasPrefix(k, "spec.0.backends.") { - hash := appmeshVirtualNodeBackendHash(map[string]interface{}{ + hash := appmeshBackendHash(map[string]interface{}{ "virtual_service": []interface{}{map[string]interface{}{ "virtual_service_name": v, }}, diff --git a/aws/resource_aws_appmesh_virtual_router.go b/aws/resource_aws_appmesh_virtual_router.go index c4a4f6188cc..131cf0d3573 100644 --- a/aws/resource_aws_appmesh_virtual_router.go +++ b/aws/resource_aws_appmesh_virtual_router.go @@ -257,6 +257,75 @@ func resourceAwsAppmeshVirtualRouterImport(d *schema.ResourceData, meta interfac return []*schema.ResourceData{d}, nil } +func expandAppmeshVirtualRouterSpec(vSpec []interface{}) *appmesh.VirtualRouterSpec { + spec := &appmesh.VirtualRouterSpec{} + + if len(vSpec) == 0 || vSpec[0] == nil { + // Empty Spec is allowed. + return spec + } + mSpec := vSpec[0].(map[string]interface{}) + + if vListeners, ok := mSpec["listener"].(*schema.Set); ok && vListeners.Len() > 0 { + listeners := []*appmesh.VirtualRouterListener{} + + for _, vListener := range vListeners.List() { + listener := &appmesh.VirtualRouterListener{} + + mListener := vListener.(map[string]interface{}) + + if vPortMapping, ok := mListener["port_mapping"].([]interface{}); ok && len(vPortMapping) > 0 && vPortMapping[0] != nil { + mPortMapping := vPortMapping[0].(map[string]interface{}) + + listener.PortMapping = &appmesh.PortMapping{} + + if vPort, ok := mPortMapping["port"].(int); ok && vPort > 0 { + listener.PortMapping.Port = aws.Int64(int64(vPort)) + } + if vProtocol, ok := mPortMapping["protocol"].(string); ok && vProtocol != "" { + listener.PortMapping.Protocol = aws.String(vProtocol) + } + } + + listeners = append(listeners, listener) + } + + spec.Listeners = listeners + } + + return spec +} + +func flattenAppmeshVirtualRouterSpec(spec *appmesh.VirtualRouterSpec) []interface{} { + if spec == nil { + return []interface{}{} + } + + mSpec := map[string]interface{}{} + + if spec.Listeners != nil { + vListeners := []interface{}{} + + for _, listener := range spec.Listeners { + mListener := map[string]interface{}{} + + if listener.PortMapping != nil { + mPortMapping := map[string]interface{}{ + "port": int(aws.Int64Value(listener.PortMapping.Port)), + "protocol": aws.StringValue(listener.PortMapping.Protocol), + } + mListener["port_mapping"] = []interface{}{mPortMapping} + } + + vListeners = append(vListeners, mListener) + } + + mSpec["listener"] = schema.NewSet(appmeshVirtualRouterListenerHash, vListeners) + } + + return []interface{}{mSpec} +} + func appmeshVirtualRouterListenerHash(vListener interface{}) int { var buf bytes.Buffer mListener := vListener.(map[string]interface{}) diff --git a/aws/resource_aws_appmesh_virtual_service.go b/aws/resource_aws_appmesh_virtual_service.go index 9ac2fbba396..c49350e4a34 100644 --- a/aws/resource_aws_appmesh_virtual_service.go +++ b/aws/resource_aws_appmesh_virtual_service.go @@ -251,3 +251,73 @@ func resourceAwsAppmeshVirtualServiceImport(d *schema.ResourceData, meta interfa return []*schema.ResourceData{d}, nil } + +func expandAppmeshVirtualServiceSpec(vSpec []interface{}) *appmesh.VirtualServiceSpec { + spec := &appmesh.VirtualServiceSpec{} + + if len(vSpec) == 0 || vSpec[0] == nil { + // Empty Spec is allowed. + return spec + } + mSpec := vSpec[0].(map[string]interface{}) + + if vProvider, ok := mSpec["provider"].([]interface{}); ok && len(vProvider) > 0 && vProvider[0] != nil { + mProvider := vProvider[0].(map[string]interface{}) + + spec.Provider = &appmesh.VirtualServiceProvider{} + + if vVirtualNode, ok := mProvider["virtual_node"].([]interface{}); ok && len(vVirtualNode) > 0 && vVirtualNode[0] != nil { + mVirtualNode := vVirtualNode[0].(map[string]interface{}) + + if vVirtualNodeName, ok := mVirtualNode["virtual_node_name"].(string); ok && vVirtualNodeName != "" { + spec.Provider.VirtualNode = &appmesh.VirtualNodeServiceProvider{ + VirtualNodeName: aws.String(vVirtualNodeName), + } + } + } + + if vVirtualRouter, ok := mProvider["virtual_router"].([]interface{}); ok && len(vVirtualRouter) > 0 && vVirtualRouter[0] != nil { + mVirtualRouter := vVirtualRouter[0].(map[string]interface{}) + + if vVirtualRouterName, ok := mVirtualRouter["virtual_router_name"].(string); ok && vVirtualRouterName != "" { + spec.Provider.VirtualRouter = &appmesh.VirtualRouterServiceProvider{ + VirtualRouterName: aws.String(vVirtualRouterName), + } + } + } + } + + return spec +} + +func flattenAppmeshVirtualServiceSpec(spec *appmesh.VirtualServiceSpec) []interface{} { + if spec == nil { + return []interface{}{} + } + + mSpec := map[string]interface{}{} + + if spec.Provider != nil { + mProvider := map[string]interface{}{} + + if spec.Provider.VirtualNode != nil { + mProvider["virtual_node"] = []interface{}{ + map[string]interface{}{ + "virtual_node_name": aws.StringValue(spec.Provider.VirtualNode.VirtualNodeName), + }, + } + } + + if spec.Provider.VirtualRouter != nil { + mProvider["virtual_router"] = []interface{}{ + map[string]interface{}{ + "virtual_router_name": aws.StringValue(spec.Provider.VirtualRouter.VirtualRouterName), + }, + } + } + + mSpec["provider"] = []interface{}{mProvider} + } + + return []interface{}{mSpec} +} diff --git a/aws/structure.go b/aws/structure.go index 9922f6dbc42..080046bf8d3 100644 --- a/aws/structure.go +++ b/aws/structure.go @@ -13,7 +13,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" "github.com/aws/aws-sdk-go/service/apigateway" - "github.com/aws/aws-sdk-go/service/appmesh" "github.com/aws/aws-sdk-go/service/appsync" "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/aws/aws-sdk-go/service/cloudformation" @@ -4828,446 +4827,6 @@ func flattenRdsScalingConfigurationInfo(scalingConfigurationInfo *rds.ScalingCon return []interface{}{m} } -func expandAppmeshMeshSpec(vSpec []interface{}) *appmesh.MeshSpec { - spec := &appmesh.MeshSpec{} - - if len(vSpec) == 0 || vSpec[0] == nil { - // Empty Spec is allowed. - return spec - } - mSpec := vSpec[0].(map[string]interface{}) - - if vEgressFilter, ok := mSpec["egress_filter"].([]interface{}); ok && len(vEgressFilter) > 0 && vEgressFilter[0] != nil { - mEgressFilter := vEgressFilter[0].(map[string]interface{}) - - if vType, ok := mEgressFilter["type"].(string); ok && vType != "" { - spec.EgressFilter = &appmesh.EgressFilter{ - Type: aws.String(vType), - } - } - } - - return spec -} - -func flattenAppmeshMeshSpec(spec *appmesh.MeshSpec) []interface{} { - if spec == nil { - return []interface{}{} - } - - mSpec := map[string]interface{}{} - - if spec.EgressFilter != nil { - mSpec["egress_filter"] = []interface{}{ - map[string]interface{}{ - "type": aws.StringValue(spec.EgressFilter.Type), - }, - } - } - - return []interface{}{mSpec} -} - -func expandAppmeshVirtualRouterSpec(vSpec []interface{}) *appmesh.VirtualRouterSpec { - spec := &appmesh.VirtualRouterSpec{} - - if len(vSpec) == 0 || vSpec[0] == nil { - // Empty Spec is allowed. - return spec - } - mSpec := vSpec[0].(map[string]interface{}) - - if vListeners, ok := mSpec["listener"].(*schema.Set); ok && vListeners.Len() > 0 { - listeners := []*appmesh.VirtualRouterListener{} - - for _, vListener := range vListeners.List() { - listener := &appmesh.VirtualRouterListener{} - - mListener := vListener.(map[string]interface{}) - - if vPortMapping, ok := mListener["port_mapping"].([]interface{}); ok && len(vPortMapping) > 0 && vPortMapping[0] != nil { - mPortMapping := vPortMapping[0].(map[string]interface{}) - - listener.PortMapping = &appmesh.PortMapping{} - - if vPort, ok := mPortMapping["port"].(int); ok && vPort > 0 { - listener.PortMapping.Port = aws.Int64(int64(vPort)) - } - if vProtocol, ok := mPortMapping["protocol"].(string); ok && vProtocol != "" { - listener.PortMapping.Protocol = aws.String(vProtocol) - } - } - - listeners = append(listeners, listener) - } - - spec.Listeners = listeners - } - - return spec -} - -func flattenAppmeshVirtualRouterSpec(spec *appmesh.VirtualRouterSpec) []interface{} { - if spec == nil { - return []interface{}{} - } - - mSpec := map[string]interface{}{} - - if spec.Listeners != nil { - vListeners := []interface{}{} - - for _, listener := range spec.Listeners { - mListener := map[string]interface{}{} - - if listener.PortMapping != nil { - mPortMapping := map[string]interface{}{ - "port": int(aws.Int64Value(listener.PortMapping.Port)), - "protocol": aws.StringValue(listener.PortMapping.Protocol), - } - mListener["port_mapping"] = []interface{}{mPortMapping} - } - - vListeners = append(vListeners, mListener) - } - - mSpec["listener"] = schema.NewSet(appmeshVirtualNodeListenerHash, vListeners) - } - - return []interface{}{mSpec} -} - -func expandAppmeshVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { - spec := &appmesh.VirtualNodeSpec{} - - if len(vSpec) == 0 || vSpec[0] == nil { - // Empty Spec is allowed. - return spec - } - mSpec := vSpec[0].(map[string]interface{}) - - if vBackends, ok := mSpec["backend"].(*schema.Set); ok && vBackends.Len() > 0 { - backends := []*appmesh.Backend{} - - for _, vBackend := range vBackends.List() { - backend := &appmesh.Backend{} - - mBackend := vBackend.(map[string]interface{}) - - if vVirtualService, ok := mBackend["virtual_service"].([]interface{}); ok && len(vVirtualService) > 0 && vVirtualService[0] != nil { - mVirtualService := vVirtualService[0].(map[string]interface{}) - - backend.VirtualService = &appmesh.VirtualServiceBackend{} - - if vVirtualServiceName, ok := mVirtualService["virtual_service_name"].(string); ok { - backend.VirtualService.VirtualServiceName = aws.String(vVirtualServiceName) - } - } - backends = append(backends, backend) - } - - spec.Backends = backends - } - - if vListeners, ok := mSpec["listener"].(*schema.Set); ok && vListeners.Len() > 0 { - listeners := []*appmesh.Listener{} - - for _, vListener := range vListeners.List() { - listener := &appmesh.Listener{} - - mListener := vListener.(map[string]interface{}) - - if vHealthCheck, ok := mListener["health_check"].([]interface{}); ok && len(vHealthCheck) > 0 && vHealthCheck[0] != nil { - mHealthCheck := vHealthCheck[0].(map[string]interface{}) - - listener.HealthCheck = &appmesh.HealthCheckPolicy{} - - if vHealthyThreshold, ok := mHealthCheck["healthy_threshold"].(int); ok && vHealthyThreshold > 0 { - listener.HealthCheck.HealthyThreshold = aws.Int64(int64(vHealthyThreshold)) - } - if vIntervalMillis, ok := mHealthCheck["interval_millis"].(int); ok && vIntervalMillis > 0 { - listener.HealthCheck.IntervalMillis = aws.Int64(int64(vIntervalMillis)) - } - if vPath, ok := mHealthCheck["path"].(string); ok && vPath != "" { - listener.HealthCheck.Path = aws.String(vPath) - } - if vPort, ok := mHealthCheck["port"].(int); ok && vPort > 0 { - listener.HealthCheck.Port = aws.Int64(int64(vPort)) - } - if vProtocol, ok := mHealthCheck["protocol"].(string); ok && vProtocol != "" { - listener.HealthCheck.Protocol = aws.String(vProtocol) - } - if vTimeoutMillis, ok := mHealthCheck["timeout_millis"].(int); ok && vTimeoutMillis > 0 { - listener.HealthCheck.TimeoutMillis = aws.Int64(int64(vTimeoutMillis)) - } - if vUnhealthyThreshold, ok := mHealthCheck["unhealthy_threshold"].(int); ok && vUnhealthyThreshold > 0 { - listener.HealthCheck.UnhealthyThreshold = aws.Int64(int64(vUnhealthyThreshold)) - } - } - - if vPortMapping, ok := mListener["port_mapping"].([]interface{}); ok && len(vPortMapping) > 0 && vPortMapping[0] != nil { - mPortMapping := vPortMapping[0].(map[string]interface{}) - - listener.PortMapping = &appmesh.PortMapping{} - - if vPort, ok := mPortMapping["port"].(int); ok && vPort > 0 { - listener.PortMapping.Port = aws.Int64(int64(vPort)) - } - if vProtocol, ok := mPortMapping["protocol"].(string); ok && vProtocol != "" { - listener.PortMapping.Protocol = aws.String(vProtocol) - } - } - - listeners = append(listeners, listener) - } - - spec.Listeners = listeners - } - - if vLogging, ok := mSpec["logging"].([]interface{}); ok && len(vLogging) > 0 && vLogging[0] != nil { - mLogging := vLogging[0].(map[string]interface{}) - - if vAccessLog, ok := mLogging["access_log"].([]interface{}); ok && len(vAccessLog) > 0 && vAccessLog[0] != nil { - mAccessLog := vAccessLog[0].(map[string]interface{}) - - if vFile, ok := mAccessLog["file"].([]interface{}); ok && len(vFile) > 0 && vFile[0] != nil { - mFile := vFile[0].(map[string]interface{}) - - if vPath, ok := mFile["path"].(string); ok && vPath != "" { - spec.Logging = &appmesh.Logging{ - AccessLog: &appmesh.AccessLog{ - File: &appmesh.FileAccessLog{ - Path: aws.String(vPath), - }, - }, - } - } - } - } - } - - if vServiceDiscovery, ok := mSpec["service_discovery"].([]interface{}); ok && len(vServiceDiscovery) > 0 && vServiceDiscovery[0] != nil { - spec.ServiceDiscovery = &appmesh.ServiceDiscovery{} - - mServiceDiscovery := vServiceDiscovery[0].(map[string]interface{}) - - if vAwsCloudMap, ok := mServiceDiscovery["aws_cloud_map"].([]interface{}); ok && len(vAwsCloudMap) > 0 && vAwsCloudMap[0] != nil { - spec.ServiceDiscovery.AwsCloudMap = &appmesh.AwsCloudMapServiceDiscovery{} - - mAwsCloudMap := vAwsCloudMap[0].(map[string]interface{}) - - if vAttributes, ok := mAwsCloudMap["attributes"].(map[string]interface{}); ok && len(vAttributes) > 0 { - attributes := []*appmesh.AwsCloudMapInstanceAttribute{} - - for k, v := range vAttributes { - attributes = append(attributes, &appmesh.AwsCloudMapInstanceAttribute{ - Key: aws.String(k), - Value: aws.String(v.(string)), - }) - } - - spec.ServiceDiscovery.AwsCloudMap.Attributes = attributes - } - if vNamespaceName, ok := mAwsCloudMap["namespace_name"].(string); ok && vNamespaceName != "" { - spec.ServiceDiscovery.AwsCloudMap.NamespaceName = aws.String(vNamespaceName) - } - if vServiceName, ok := mAwsCloudMap["service_name"].(string); ok && vServiceName != "" { - spec.ServiceDiscovery.AwsCloudMap.ServiceName = aws.String(vServiceName) - } - } - - if vDns, ok := mServiceDiscovery["dns"].([]interface{}); ok && len(vDns) > 0 && vDns[0] != nil { - mDns := vDns[0].(map[string]interface{}) - - if vHostname, ok := mDns["hostname"].(string); ok && vHostname != "" { - spec.ServiceDiscovery.Dns = &appmesh.DnsServiceDiscovery{ - Hostname: aws.String(vHostname), - } - } - } - } - - return spec -} - -func flattenAppmeshVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { - if spec == nil { - return []interface{}{} - } - - mSpec := map[string]interface{}{} - - if spec.Backends != nil { - vBackends := []interface{}{} - - for _, backend := range spec.Backends { - mBackend := map[string]interface{}{} - - if backend.VirtualService != nil { - mVirtualService := map[string]interface{}{ - "virtual_service_name": aws.StringValue(backend.VirtualService.VirtualServiceName), - } - mBackend["virtual_service"] = []interface{}{mVirtualService} - } - - vBackends = append(vBackends, mBackend) - } - - mSpec["backend"] = schema.NewSet(appmeshVirtualNodeBackendHash, vBackends) - } - - if spec.Listeners != nil { - vListeners := []interface{}{} - - for _, listener := range spec.Listeners { - mListener := map[string]interface{}{} - - if listener.HealthCheck != nil { - mHealthCheck := map[string]interface{}{ - "healthy_threshold": int(aws.Int64Value(listener.HealthCheck.HealthyThreshold)), - "interval_millis": int(aws.Int64Value(listener.HealthCheck.IntervalMillis)), - "path": aws.StringValue(listener.HealthCheck.Path), - "port": int(aws.Int64Value(listener.HealthCheck.Port)), - "protocol": aws.StringValue(listener.HealthCheck.Protocol), - "timeout_millis": int(aws.Int64Value(listener.HealthCheck.TimeoutMillis)), - "unhealthy_threshold": int(aws.Int64Value(listener.HealthCheck.UnhealthyThreshold)), - } - mListener["health_check"] = []interface{}{mHealthCheck} - } - - if listener.PortMapping != nil { - mPortMapping := map[string]interface{}{ - "port": int(aws.Int64Value(listener.PortMapping.Port)), - "protocol": aws.StringValue(listener.PortMapping.Protocol), - } - mListener["port_mapping"] = []interface{}{mPortMapping} - } - - vListeners = append(vListeners, mListener) - } - - mSpec["listener"] = schema.NewSet(appmeshVirtualNodeListenerHash, vListeners) - } - - if spec.Logging != nil && spec.Logging.AccessLog != nil && spec.Logging.AccessLog.File != nil { - mSpec["logging"] = []interface{}{ - map[string]interface{}{ - "access_log": []interface{}{ - map[string]interface{}{ - "file": []interface{}{ - map[string]interface{}{ - "path": aws.StringValue(spec.Logging.AccessLog.File.Path), - }, - }, - }, - }, - }, - } - } - - if spec.ServiceDiscovery != nil { - mServiceDiscovery := map[string]interface{}{} - - if spec.ServiceDiscovery.AwsCloudMap != nil { - vAttributes := map[string]interface{}{} - - for _, attribute := range spec.ServiceDiscovery.AwsCloudMap.Attributes { - vAttributes[aws.StringValue(attribute.Key)] = aws.StringValue(attribute.Value) - } - - mServiceDiscovery["aws_cloud_map"] = []interface{}{ - map[string]interface{}{ - "attributes": vAttributes, - "namespace_name": aws.StringValue(spec.ServiceDiscovery.AwsCloudMap.NamespaceName), - "service_name": aws.StringValue(spec.ServiceDiscovery.AwsCloudMap.ServiceName), - }, - } - } - - if spec.ServiceDiscovery.Dns != nil { - mServiceDiscovery["dns"] = []interface{}{ - map[string]interface{}{ - "hostname": aws.StringValue(spec.ServiceDiscovery.Dns.Hostname), - }, - } - } - - mSpec["service_discovery"] = []interface{}{mServiceDiscovery} - } - - return []interface{}{mSpec} -} - -func expandAppmeshVirtualServiceSpec(vSpec []interface{}) *appmesh.VirtualServiceSpec { - spec := &appmesh.VirtualServiceSpec{} - - if len(vSpec) == 0 || vSpec[0] == nil { - // Empty Spec is allowed. - return spec - } - mSpec := vSpec[0].(map[string]interface{}) - - if vProvider, ok := mSpec["provider"].([]interface{}); ok && len(vProvider) > 0 && vProvider[0] != nil { - mProvider := vProvider[0].(map[string]interface{}) - - spec.Provider = &appmesh.VirtualServiceProvider{} - - if vVirtualNode, ok := mProvider["virtual_node"].([]interface{}); ok && len(vVirtualNode) > 0 && vVirtualNode[0] != nil { - mVirtualNode := vVirtualNode[0].(map[string]interface{}) - - if vVirtualNodeName, ok := mVirtualNode["virtual_node_name"].(string); ok && vVirtualNodeName != "" { - spec.Provider.VirtualNode = &appmesh.VirtualNodeServiceProvider{ - VirtualNodeName: aws.String(vVirtualNodeName), - } - } - } - - if vVirtualRouter, ok := mProvider["virtual_router"].([]interface{}); ok && len(vVirtualRouter) > 0 && vVirtualRouter[0] != nil { - mVirtualRouter := vVirtualRouter[0].(map[string]interface{}) - - if vVirtualRouterName, ok := mVirtualRouter["virtual_router_name"].(string); ok && vVirtualRouterName != "" { - spec.Provider.VirtualRouter = &appmesh.VirtualRouterServiceProvider{ - VirtualRouterName: aws.String(vVirtualRouterName), - } - } - } - } - - return spec -} - -func flattenAppmeshVirtualServiceSpec(spec *appmesh.VirtualServiceSpec) []interface{} { - if spec == nil { - return []interface{}{} - } - - mSpec := map[string]interface{}{} - - if spec.Provider != nil { - mProvider := map[string]interface{}{} - - if spec.Provider.VirtualNode != nil { - mProvider["virtual_node"] = []interface{}{ - map[string]interface{}{ - "virtual_node_name": aws.StringValue(spec.Provider.VirtualNode.VirtualNodeName), - }, - } - } - - if spec.Provider.VirtualRouter != nil { - mProvider["virtual_router"] = []interface{}{ - map[string]interface{}{ - "virtual_router_name": aws.StringValue(spec.Provider.VirtualRouter.VirtualRouterName), - }, - } - } - - mSpec["provider"] = []interface{}{mProvider} - } - - return []interface{}{mSpec} -} - func flattenAppsyncPipelineConfig(c *appsync.PipelineConfig) []interface{} { if c == nil { return nil From daa5a3088b538a6c30a63aa6fa4d5beb0d8818f3 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 24 Jul 2019 11:00:19 -0400 Subject: [PATCH 10/23] 'appmesh' -> 'appmeshpreview'. --- aws/resource_aws_appmesh_mesh.go | 10 +++---- aws/resource_aws_appmesh_mesh_test.go | 8 +++--- aws/resource_aws_appmesh_route.go | 12 ++++----- aws/resource_aws_appmesh_route_test.go | 8 +++--- aws/resource_aws_appmesh_virtual_node.go | 12 ++++----- aws/resource_aws_appmesh_virtual_node_test.go | 6 ++--- aws/resource_aws_appmesh_virtual_router.go | 12 ++++----- ...esource_aws_appmesh_virtual_router_test.go | 8 +++--- aws/resource_aws_appmesh_virtual_service.go | 12 ++++----- ...source_aws_appmesh_virtual_service_test.go | 6 ++--- aws/tagsAppmesh.go | 26 +++++++++---------- aws/tagsAppmesh_test.go | 8 +++--- 12 files changed, 64 insertions(+), 64 deletions(-) diff --git a/aws/resource_aws_appmesh_mesh.go b/aws/resource_aws_appmesh_mesh.go index 2fe5c7e497e..5aee027a1e8 100644 --- a/aws/resource_aws_appmesh_mesh.go +++ b/aws/resource_aws_appmesh_mesh.go @@ -6,7 +6,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" ) @@ -81,7 +81,7 @@ func resourceAwsAppmeshMesh() *schema.Resource { } func resourceAwsAppmeshMeshCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn meshName := d.Get("name").(string) req := &appmesh.CreateMeshInput{ @@ -102,7 +102,7 @@ func resourceAwsAppmeshMeshCreate(d *schema.ResourceData, meta interface{}) erro } func resourceAwsAppmeshMeshRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeMesh(&appmesh.DescribeMeshInput{ MeshName: aws.String(d.Id()), @@ -144,7 +144,7 @@ func resourceAwsAppmeshMeshRead(d *schema.ResourceData, meta interface{}) error } func resourceAwsAppmeshMeshUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn if d.HasChange("spec") { _, v := d.GetChange("spec") @@ -174,7 +174,7 @@ func resourceAwsAppmeshMeshUpdate(d *schema.ResourceData, meta interface{}) erro } func resourceAwsAppmeshMeshDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn log.Printf("[DEBUG] Deleting App Mesh service mesh: %s", d.Id()) _, err := conn.DeleteMesh(&appmesh.DeleteMeshInput{ diff --git a/aws/resource_aws_appmesh_mesh_test.go b/aws/resource_aws_appmesh_mesh_test.go index 20e13093ff8..a2b4715360d 100644 --- a/aws/resource_aws_appmesh_mesh_test.go +++ b/aws/resource_aws_appmesh_mesh_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -28,7 +28,7 @@ func testSweepAppmeshMeshes(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.(*AWSClient).appmeshconn + conn := client.(*AWSClient).appmeshpreviewconn err = conn.ListMeshesPages(&appmesh.ListMeshesInput{}, func(page *appmesh.ListMeshesOutput, isLast bool) bool { if page == nil { @@ -186,7 +186,7 @@ func testAccAwsAppmeshMesh_tags(t *testing.T) { } func testAccCheckAppmeshMeshDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appmesh_mesh" { @@ -210,7 +210,7 @@ func testAccCheckAppmeshMeshDestroy(s *terraform.State) error { func testAccCheckAppmeshMeshExists(name string, v *appmesh.MeshData) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn rs, ok := s.RootModule().Resources[name] if !ok { diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index c5f7e3eae7c..5031fd6d41a 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -9,7 +9,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -182,7 +182,7 @@ func resourceAwsAppmeshRoute() *schema.Resource { } func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn req := &appmesh.CreateRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), @@ -204,7 +204,7 @@ func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) err } func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), @@ -250,7 +250,7 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error } func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn if d.HasChange("spec") { _, v := d.GetChange("spec") @@ -282,7 +282,7 @@ func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) err } func resourceAwsAppmeshRouteDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn log.Printf("[DEBUG] Deleting App Mesh route: %s", d.Id()) _, err := conn.DeleteRoute(&appmesh.DeleteRouteInput{ @@ -311,7 +311,7 @@ func resourceAwsAppmeshRouteImport(d *schema.ResourceData, meta interface{}) ([] name := parts[2] log.Printf("[DEBUG] Importing App Mesh route %s from mesh %s/virtual router %s ", name, mesh, vrName) - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeRoute(&appmesh.DescribeRouteInput{ MeshName: aws.String(mesh), diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index d0019d29f6c..f84763df603 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -25,7 +25,7 @@ func testSweepAppmeshRoutes(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.(*AWSClient).appmeshconn + conn := client.(*AWSClient).appmeshpreviewconn err = conn.ListMeshesPages(&appmesh.ListMeshesInput{}, func(page *appmesh.ListMeshesOutput, isLast bool) bool { if page == nil { @@ -273,7 +273,7 @@ func testAccAwsAppmeshRoute_tags(t *testing.T) { } func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appmesh_route" { @@ -299,7 +299,7 @@ func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { func testAccCheckAppmeshRouteExists(name string, v *appmesh.RouteData) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn rs, ok := s.RootModule().Resources[name] if !ok { diff --git a/aws/resource_aws_appmesh_virtual_node.go b/aws/resource_aws_appmesh_virtual_node.go index 5149d9486a1..95c25cf2f29 100644 --- a/aws/resource_aws_appmesh_virtual_node.go +++ b/aws/resource_aws_appmesh_virtual_node.go @@ -8,7 +8,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -297,7 +297,7 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { } func resourceAwsAppmeshVirtualNodeCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn req := &appmesh.CreateVirtualNodeInput{ MeshName: aws.String(d.Get("mesh_name").(string)), @@ -318,7 +318,7 @@ func resourceAwsAppmeshVirtualNodeCreate(d *schema.ResourceData, meta interface{ } func resourceAwsAppmeshVirtualNodeRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeVirtualNode(&appmesh.DescribeVirtualNodeInput{ MeshName: aws.String(d.Get("mesh_name").(string)), @@ -362,7 +362,7 @@ func resourceAwsAppmeshVirtualNodeRead(d *schema.ResourceData, meta interface{}) } func resourceAwsAppmeshVirtualNodeUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn if d.HasChange("spec") { _, v := d.GetChange("spec") @@ -393,7 +393,7 @@ func resourceAwsAppmeshVirtualNodeUpdate(d *schema.ResourceData, meta interface{ } func resourceAwsAppmeshVirtualNodeDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn log.Printf("[DEBUG] Deleting App Mesh virtual node: %s", d.Id()) _, err := conn.DeleteVirtualNode(&appmesh.DeleteVirtualNodeInput{ @@ -420,7 +420,7 @@ func resourceAwsAppmeshVirtualNodeImport(d *schema.ResourceData, meta interface{ name := parts[1] log.Printf("[DEBUG] Importing App Mesh virtual node %s from mesh %s", name, mesh) - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeVirtualNode(&appmesh.DescribeVirtualNodeInput{ MeshName: aws.String(mesh), diff --git a/aws/resource_aws_appmesh_virtual_node_test.go b/aws/resource_aws_appmesh_virtual_node_test.go index cc07334646d..19ffcf5999e 100644 --- a/aws/resource_aws_appmesh_virtual_node_test.go +++ b/aws/resource_aws_appmesh_virtual_node_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -279,7 +279,7 @@ func testAccAwsAppmeshVirtualNode_tags(t *testing.T) { } func testAccCheckAppmeshVirtualNodeDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appmesh_virtual_node" { @@ -304,7 +304,7 @@ func testAccCheckAppmeshVirtualNodeDestroy(s *terraform.State) error { func testAccCheckAppmeshVirtualNodeExists(name string, v *appmesh.VirtualNodeData) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn rs, ok := s.RootModule().Resources[name] if !ok { diff --git a/aws/resource_aws_appmesh_virtual_router.go b/aws/resource_aws_appmesh_virtual_router.go index 131cf0d3573..687d02a41ae 100644 --- a/aws/resource_aws_appmesh_virtual_router.go +++ b/aws/resource_aws_appmesh_virtual_router.go @@ -8,7 +8,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/hashcode" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -117,7 +117,7 @@ func resourceAwsAppmeshVirtualRouter() *schema.Resource { } func resourceAwsAppmeshVirtualRouterCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn req := &appmesh.CreateVirtualRouterInput{ MeshName: aws.String(d.Get("mesh_name").(string)), @@ -138,7 +138,7 @@ func resourceAwsAppmeshVirtualRouterCreate(d *schema.ResourceData, meta interfac } func resourceAwsAppmeshVirtualRouterRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeVirtualRouter(&appmesh.DescribeVirtualRouterInput{ MeshName: aws.String(d.Get("mesh_name").(string)), @@ -182,7 +182,7 @@ func resourceAwsAppmeshVirtualRouterRead(d *schema.ResourceData, meta interface{ } func resourceAwsAppmeshVirtualRouterUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn if d.HasChange("spec") { _, v := d.GetChange("spec") @@ -213,7 +213,7 @@ func resourceAwsAppmeshVirtualRouterUpdate(d *schema.ResourceData, meta interfac } func resourceAwsAppmeshVirtualRouterDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn log.Printf("[DEBUG] Deleting App Mesh virtual router: %s", d.Id()) _, err := conn.DeleteVirtualRouter(&appmesh.DeleteVirtualRouterInput{ @@ -240,7 +240,7 @@ func resourceAwsAppmeshVirtualRouterImport(d *schema.ResourceData, meta interfac name := parts[1] log.Printf("[DEBUG] Importing App Mesh virtual router %s from mesh %s", name, mesh) - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeVirtualRouter(&appmesh.DescribeVirtualRouterInput{ MeshName: aws.String(mesh), diff --git a/aws/resource_aws_appmesh_virtual_router_test.go b/aws/resource_aws_appmesh_virtual_router_test.go index e8911bb9319..d02f01669ca 100644 --- a/aws/resource_aws_appmesh_virtual_router_test.go +++ b/aws/resource_aws_appmesh_virtual_router_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -28,7 +28,7 @@ func testSweepAppmeshVirtualRouters(region string) error { if err != nil { return fmt.Errorf("error getting client: %s", err) } - conn := client.(*AWSClient).appmeshconn + conn := client.(*AWSClient).appmeshpreviewconn err = conn.ListMeshesPages(&appmesh.ListMeshesInput{}, func(page *appmesh.ListMeshesOutput, isLast bool) bool { if page == nil { @@ -208,7 +208,7 @@ func testAccAwsAppmeshVirtualRouter_tags(t *testing.T) { } func testAccCheckAppmeshVirtualRouterDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appmesh_virtual_router" { @@ -233,7 +233,7 @@ func testAccCheckAppmeshVirtualRouterDestroy(s *terraform.State) error { func testAccCheckAppmeshVirtualRouterExists(name string, v *appmesh.VirtualRouterData) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn rs, ok := s.RootModule().Resources[name] if !ok { diff --git a/aws/resource_aws_appmesh_virtual_service.go b/aws/resource_aws_appmesh_virtual_service.go index c49350e4a34..a720f98075d 100644 --- a/aws/resource_aws_appmesh_virtual_service.go +++ b/aws/resource_aws_appmesh_virtual_service.go @@ -7,7 +7,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" ) @@ -112,7 +112,7 @@ func resourceAwsAppmeshVirtualService() *schema.Resource { } func resourceAwsAppmeshVirtualServiceCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn req := &appmesh.CreateVirtualServiceInput{ MeshName: aws.String(d.Get("mesh_name").(string)), @@ -133,7 +133,7 @@ func resourceAwsAppmeshVirtualServiceCreate(d *schema.ResourceData, meta interfa } func resourceAwsAppmeshVirtualServiceRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeVirtualService(&appmesh.DescribeVirtualServiceInput{ MeshName: aws.String(d.Get("mesh_name").(string)), @@ -177,7 +177,7 @@ func resourceAwsAppmeshVirtualServiceRead(d *schema.ResourceData, meta interface } func resourceAwsAppmeshVirtualServiceUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn if d.HasChange("spec") { _, v := d.GetChange("spec") @@ -208,7 +208,7 @@ func resourceAwsAppmeshVirtualServiceUpdate(d *schema.ResourceData, meta interfa } func resourceAwsAppmeshVirtualServiceDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn log.Printf("[DEBUG] Deleting App Mesh virtual service: %s", d.Id()) _, err := conn.DeleteVirtualService(&appmesh.DeleteVirtualServiceInput{ @@ -235,7 +235,7 @@ func resourceAwsAppmeshVirtualServiceImport(d *schema.ResourceData, meta interfa name := parts[1] log.Printf("[DEBUG] Importing App Mesh virtual service %s from mesh %s", name, mesh) - conn := meta.(*AWSClient).appmeshconn + conn := meta.(*AWSClient).appmeshpreviewconn resp, err := conn.DescribeVirtualService(&appmesh.DescribeVirtualServiceInput{ MeshName: aws.String(mesh), diff --git a/aws/resource_aws_appmesh_virtual_service_test.go b/aws/resource_aws_appmesh_virtual_service_test.go index 297b72ea32d..4069a4b3ba9 100644 --- a/aws/resource_aws_appmesh_virtual_service_test.go +++ b/aws/resource_aws_appmesh_virtual_service_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + appmesh "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -164,7 +164,7 @@ func testAccAwsAppmeshVirtualService_tags(t *testing.T) { } func testAccCheckAppmeshVirtualServiceDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn for _, rs := range s.RootModule().Resources { if rs.Type != "aws_appmesh_virtual_service" { @@ -189,7 +189,7 @@ func testAccCheckAppmeshVirtualServiceDestroy(s *terraform.State) error { func testAccCheckAppmeshVirtualServiceExists(name string, v *appmesh.VirtualServiceData) resource.TestCheckFunc { return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).appmeshconn + conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn rs, ok := s.RootModule().Resources[name] if !ok { diff --git a/aws/tagsAppmesh.go b/aws/tagsAppmesh.go index cd15db36b7b..bf0106eedfc 100644 --- a/aws/tagsAppmesh.go +++ b/aws/tagsAppmesh.go @@ -5,13 +5,13 @@ import ( "regexp" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + "github.com/aws/aws-sdk-go/service/appmeshpreview" "github.com/hashicorp/terraform/helper/schema" ) // setTags is a helper to set the tags for a resource. It expects the // tags field to be named "tags" -func setTagsAppmesh(conn *appmesh.AppMesh, d *schema.ResourceData, arn string) error { +func setTagsAppmesh(conn *appmeshpreview.AppMeshPreview, d *schema.ResourceData, arn string) error { if d.HasChange("tags") { oraw, nraw := d.GetChange("tags") o := oraw.(map[string]interface{}) @@ -20,7 +20,7 @@ func setTagsAppmesh(conn *appmesh.AppMesh, d *schema.ResourceData, arn string) e // Set tags if len(remove) > 0 { - input := appmesh.UntagResourceInput{ + input := appmeshpreview.UntagResourceInput{ ResourceArn: aws.String(arn), TagKeys: remove, } @@ -31,7 +31,7 @@ func setTagsAppmesh(conn *appmesh.AppMesh, d *schema.ResourceData, arn string) e } } if len(create) > 0 { - input := appmesh.TagResourceInput{ + input := appmeshpreview.TagResourceInput{ ResourceArn: aws.String(arn), Tags: create, } @@ -49,7 +49,7 @@ func setTagsAppmesh(conn *appmesh.AppMesh, d *schema.ResourceData, arn string) e // diffTags takes our tags locally and the ones remotely and returns // the set of tags that must be created, and the set of tags that must // be destroyed. -func diffTagsAppmesh(oldTags, newTags []*appmesh.TagRef) ([]*appmesh.TagRef, []*string) { +func diffTagsAppmesh(oldTags, newTags []*appmeshpreview.TagRef) ([]*appmeshpreview.TagRef, []*string) { // First, we're creating everything we have create := make(map[string]interface{}) for _, t := range newTags { @@ -72,10 +72,10 @@ func diffTagsAppmesh(oldTags, newTags []*appmesh.TagRef) ([]*appmesh.TagRef, []* } // tagsFromMap returns the tags for the given map of data. -func tagsFromMapAppmesh(m map[string]interface{}) []*appmesh.TagRef { - var result []*appmesh.TagRef +func tagsFromMapAppmesh(m map[string]interface{}) []*appmeshpreview.TagRef { + var result []*appmeshpreview.TagRef for k, v := range m { - t := &appmesh.TagRef{ + t := &appmeshpreview.TagRef{ Key: aws.String(k), Value: aws.String(v.(string)), } @@ -88,7 +88,7 @@ func tagsFromMapAppmesh(m map[string]interface{}) []*appmesh.TagRef { } // tagsToMap turns the list of tags into a map. -func tagsToMapAppmesh(ts []*appmesh.TagRef) map[string]string { +func tagsToMapAppmesh(ts []*appmeshpreview.TagRef) map[string]string { result := make(map[string]string) for _, t := range ts { if !tagIgnoredAppmesh(t) { @@ -99,15 +99,15 @@ func tagsToMapAppmesh(ts []*appmesh.TagRef) map[string]string { return result } -func saveTagsAppmesh(conn *appmesh.AppMesh, d *schema.ResourceData, arn string) error { - resp, err := conn.ListTagsForResource(&appmesh.ListTagsForResourceInput{ +func saveTagsAppmesh(conn *appmeshpreview.AppMeshPreview, d *schema.ResourceData, arn string) error { + resp, err := conn.ListTagsForResource(&appmeshpreview.ListTagsForResourceInput{ ResourceArn: aws.String(arn), }) if err != nil { return err } - var dt []*appmesh.TagRef + var dt []*appmeshpreview.TagRef if len(resp.Tags) > 0 { dt = resp.Tags } @@ -117,7 +117,7 @@ func saveTagsAppmesh(conn *appmesh.AppMesh, d *schema.ResourceData, arn string) // compare a tag against a list of strings and checks if it should // be ignored or not -func tagIgnoredAppmesh(t *appmesh.TagRef) bool { +func tagIgnoredAppmesh(t *appmeshpreview.TagRef) bool { filter := []string{"^aws:"} for _, v := range filter { log.Printf("[DEBUG] Matching %v with %v\n", v, aws.StringValue(t.Key)) diff --git a/aws/tagsAppmesh_test.go b/aws/tagsAppmesh_test.go index 0351979bf6c..26ee6057aea 100644 --- a/aws/tagsAppmesh_test.go +++ b/aws/tagsAppmesh_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmesh" + "github.com/aws/aws-sdk-go/service/appmeshpreview" ) func TestDiffAppmeshTags(t *testing.T) { @@ -96,12 +96,12 @@ func TestDiffAppmeshTags(t *testing.T) { } func TestIgnoringTagsAppmesh(t *testing.T) { - var ignoredTags []*appmesh.TagRef - ignoredTags = append(ignoredTags, &appmesh.TagRef{ + var ignoredTags []*appmeshpreview.TagRef + ignoredTags = append(ignoredTags, &appmeshpreview.TagRef{ Key: aws.String("aws:cloudformation:logical-id"), Value: aws.String("foo"), }) - ignoredTags = append(ignoredTags, &appmesh.TagRef{ + ignoredTags = append(ignoredTags, &appmeshpreview.TagRef{ Key: aws.String("aws:foo:bar"), Value: aws.String("baz"), }) From ed5042a7102ca5a2a2cfdac240a4b23e88fd7589 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 25 Jul 2019 11:43:31 -0400 Subject: [PATCH 11/23] Tags not support on current AppMesh preview: 'BadRequestException: Resource tagging is not supported.' --- aws/resource_aws_appmesh_mesh.go | 38 ++-- aws/resource_aws_appmesh_mesh_test.go | 182 ++++++++--------- aws/resource_aws_appmesh_route.go | 38 ++-- aws/resource_aws_appmesh_route_test.go | 170 ++++++++-------- aws/resource_aws_appmesh_test.go | 10 +- aws/resource_aws_appmesh_virtual_node.go | 38 ++-- aws/resource_aws_appmesh_virtual_node_test.go | 120 +++++------ aws/resource_aws_appmesh_virtual_router.go | 38 ++-- ...esource_aws_appmesh_virtual_router_test.go | 162 +++++++-------- aws/resource_aws_appmesh_virtual_service.go | 38 ++-- ...source_aws_appmesh_virtual_service_test.go | 186 +++++++++--------- 11 files changed, 510 insertions(+), 510 deletions(-) diff --git a/aws/resource_aws_appmesh_mesh.go b/aws/resource_aws_appmesh_mesh.go index 5aee027a1e8..8a646709b43 100644 --- a/aws/resource_aws_appmesh_mesh.go +++ b/aws/resource_aws_appmesh_mesh.go @@ -87,7 +87,7 @@ func resourceAwsAppmeshMeshCreate(d *schema.ResourceData, meta interface{}) erro req := &appmesh.CreateMeshInput{ MeshName: aws.String(meshName), Spec: expandAppmeshMeshSpec(d.Get("spec").([]interface{})), - Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh service mesh: %#v", req) @@ -130,15 +130,15 @@ func resourceAwsAppmeshMeshRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error setting spec: %s", err) } - err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Mesh.Metadata.Arn)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh service mesh (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error saving tags: %s", err) - } + // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Mesh.Metadata.Arn)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh service mesh (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error saving tags: %s", err) + // } return nil } @@ -160,15 +160,15 @@ func resourceAwsAppmeshMeshUpdate(d *schema.ResourceData, meta interface{}) erro } } - err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh service mesh (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh service mesh (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error setting tags: %s", err) + // } return resourceAwsAppmeshMeshRead(d, meta) } diff --git a/aws/resource_aws_appmesh_mesh_test.go b/aws/resource_aws_appmesh_mesh_test.go index a2b4715360d..cb909d3f71c 100644 --- a/aws/resource_aws_appmesh_mesh_test.go +++ b/aws/resource_aws_appmesh_mesh_test.go @@ -131,59 +131,59 @@ func testAccAwsAppmeshMesh_egressFilter(t *testing.T) { }) } -func testAccAwsAppmeshMesh_tags(t *testing.T) { - var mesh appmesh.MeshData - resourceName := "aws_appmesh_mesh.foo" - rName := fmt.Sprintf("tf-test-%d", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshMeshDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAppmeshMeshConfigWithTags(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshMeshExists( - resourceName, &mesh), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad"), - ), - }, - { - Config: testAccAppmeshMeshConfigWithUpdateTags(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshMeshExists( - resourceName, &mesh), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "3"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad2"), - resource.TestCheckResourceAttr( - resourceName, "tags.fizz", "buzz"), - ), - }, - { - Config: testAccAppmeshMeshConfigWithRemoveTags(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshMeshExists( - resourceName, &mesh), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "1"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +// func testAccAwsAppmeshMesh_tags(t *testing.T) { +// var mesh appmesh.MeshData +// resourceName := "aws_appmesh_mesh.foo" +// rName := fmt.Sprintf("tf-test-%d", acctest.RandInt()) + +// resource.Test(t, resource.TestCase{ +// PreCheck: func() { testAccPreCheck(t) }, +// Providers: testAccProviders, +// CheckDestroy: testAccCheckAppmeshMeshDestroy, +// Steps: []resource.TestStep{ +// { +// Config: testAccAppmeshMeshConfigWithTags(rName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshMeshExists( +// resourceName, &mesh), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad"), +// ), +// }, +// { +// Config: testAccAppmeshMeshConfigWithUpdateTags(rName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshMeshExists( +// resourceName, &mesh), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "3"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.fizz", "buzz"), +// ), +// }, +// { +// Config: testAccAppmeshMeshConfigWithRemoveTags(rName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshMeshExists( +// resourceName, &mesh), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "1"), +// ), +// }, +// { +// ResourceName: resourceName, +// ImportState: true, +// ImportStateVerify: true, +// }, +// }, +// }) +// } func testAccCheckAppmeshMeshDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn @@ -255,41 +255,41 @@ resource "aws_appmesh_mesh" "foo" { `, name, egressFilterType) } -func testAccAppmeshMeshConfigWithTags(name string) string { - return fmt.Sprintf(` -resource "aws_appmesh_mesh" "foo" { - name = "%s" - - tags = { - foo = "bar" - good = "bad" - } -} -`, name) -} - -func testAccAppmeshMeshConfigWithUpdateTags(name string) string { - return fmt.Sprintf(` -resource "aws_appmesh_mesh" "foo" { - name = "%s" - - tags = { - foo = "bar" - good = "bad2" - fizz = "buzz" - } -} -`, name) -} - -func testAccAppmeshMeshConfigWithRemoveTags(name string) string { - return fmt.Sprintf(` -resource "aws_appmesh_mesh" "foo" { - name = "%s" - - tags = { - foo = "bar" - } -} -`, name) -} +// func testAccAppmeshMeshConfigWithTags(name string) string { +// return fmt.Sprintf(` +// resource "aws_appmesh_mesh" "foo" { +// name = "%s" + +// tags = { +// foo = "bar" +// good = "bad" +// } +// } +// `, name) +// } + +// func testAccAppmeshMeshConfigWithUpdateTags(name string) string { +// return fmt.Sprintf(` +// resource "aws_appmesh_mesh" "foo" { +// name = "%s" + +// tags = { +// foo = "bar" +// good = "bad2" +// fizz = "buzz" +// } +// } +// `, name) +// } + +// func testAccAppmeshMeshConfigWithRemoveTags(name string) string { +// return fmt.Sprintf(` +// resource "aws_appmesh_mesh" "foo" { +// name = "%s" + +// tags = { +// foo = "bar" +// } +// } +// `, name) +// } diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index 5031fd6d41a..cd78e37bf1e 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -189,7 +189,7 @@ func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) err RouteName: aws.String(d.Get("name").(string)), VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), Spec: expandAppmeshRouteSpec(d.Get("spec").([]interface{})), - Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh route: %#v", req) @@ -236,15 +236,15 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("error setting spec: %s", err) } - err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error saving tags: %s", err) - } + // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error saving tags: %s", err) + // } return nil } @@ -268,15 +268,15 @@ func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) err } } - err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error setting tags: %s", err) + // } return resourceAwsAppmeshRouteRead(d, meta) } diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index f84763df603..ac8bdb853f5 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -216,61 +216,61 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { }) } -func testAccAwsAppmeshRoute_tags(t *testing.T) { - var r appmesh.RouteData - resourceName := "aws_appmesh_route.foo" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) - vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshRouteDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo", "bar", "good", "bad"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad"), - ), - }, - { - Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo2", "bar", "good", "bad2"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo2", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad2"), - ), - }, - { - Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "0"), - ), - }, - { - ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +// func testAccAwsAppmeshRoute_tags(t *testing.T) { +// var r appmesh.RouteData +// resourceName := "aws_appmesh_route.foo" +// meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) +// vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) +// vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) +// vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) +// rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) + +// resource.Test(t, resource.TestCase{ +// PreCheck: func() { testAccPreCheck(t) }, +// Providers: testAccProviders, +// CheckDestroy: testAccCheckAppmeshRouteDestroy, +// Steps: []resource.TestStep{ +// { +// Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo", "bar", "good", "bad"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad"), +// ), +// }, +// { +// Config: testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, "foo2", "bar", "good", "bad2"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo2", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad2"), +// ), +// }, +// { +// Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshRouteExists(resourceName, &r), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "0"), +// ), +// }, +// { +// ResourceName: resourceName, +// ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), +// ImportState: true, +// ImportStateVerify: true, +// }, +// }, +// }) +// } func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn @@ -466,33 +466,33 @@ resource "aws_appmesh_route" "foo" { `, rName) } -func testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { - return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` - -resource "aws_appmesh_route" "foo" { - name = %[1]q - mesh_name = "${aws_appmesh_mesh.foo.id}" - virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" - - spec { - http_route { - match { - prefix = "/" - } - - action { - weighted_target { - virtual_node = "${aws_appmesh_virtual_node.foo.name}" - weight = 100 - } - } - } - } - - tags = { - %[2]s = %[3]q - %[4]s = %[5]q - } -} -`, rName, tagKey1, tagValue1, tagKey2, tagValue2) -} +// func testAccAppmeshRouteConfigWithTags(meshName, vrName, vn1Name, vn2Name, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { +// return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` + +// resource "aws_appmesh_route" "foo" { +// name = %[1]q +// mesh_name = "${aws_appmesh_mesh.foo.id}" +// virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" + +// spec { +// http_route { +// match { +// prefix = "/" +// } + +// action { +// weighted_target { +// virtual_node = "${aws_appmesh_virtual_node.foo.name}" +// weight = 100 +// } +// } +// } +// } + +// tags = { +// %[2]s = %[3]q +// %[4]s = %[5]q +// } +// } +// `, rName, tagKey1, tagValue1, tagKey2, tagValue2) +// } diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index bc26eadbc17..d8636004608 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -9,28 +9,28 @@ func TestAccAWSAppmesh(t *testing.T) { "Mesh": { "basic": testAccAwsAppmeshMesh_basic, "egressFilter": testAccAwsAppmeshMesh_egressFilter, - "tags": testAccAwsAppmeshMesh_tags, + // "tags": testAccAwsAppmeshMesh_tags, }, "Route": { "httpRoute": testAccAwsAppmeshRoute_httpRoute, "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, - "tags": testAccAwsAppmeshRoute_tags, + // "tags": testAccAwsAppmeshRoute_tags, }, "VirtualNode": { "basic": testAccAwsAppmeshVirtualNode_basic, "cloudMapServiceDiscovery": testAccAwsAppmeshVirtualNode_cloudMapServiceDiscovery, "listenerHealthChecks": testAccAwsAppmeshVirtualNode_listenerHealthChecks, "logging": testAccAwsAppmeshVirtualNode_logging, - "tags": testAccAwsAppmeshVirtualNode_tags, + // "tags": testAccAwsAppmeshVirtualNode_tags, }, "VirtualRouter": { "basic": testAccAwsAppmeshVirtualRouter_basic, - "tags": testAccAwsAppmeshVirtualRouter_tags, + // "tags": testAccAwsAppmeshVirtualRouter_tags, }, "VirtualService": { "virtualNode": testAccAwsAppmeshVirtualService_virtualNode, "virtualRouter": testAccAwsAppmeshVirtualService_virtualRouter, - "tags": testAccAwsAppmeshVirtualService_tags, + // "tags": testAccAwsAppmeshVirtualService_tags, }, } diff --git a/aws/resource_aws_appmesh_virtual_node.go b/aws/resource_aws_appmesh_virtual_node.go index 95c25cf2f29..3749f63c2bf 100644 --- a/aws/resource_aws_appmesh_virtual_node.go +++ b/aws/resource_aws_appmesh_virtual_node.go @@ -303,7 +303,7 @@ func resourceAwsAppmeshVirtualNodeCreate(d *schema.ResourceData, meta interface{ MeshName: aws.String(d.Get("mesh_name").(string)), VirtualNodeName: aws.String(d.Get("name").(string)), Spec: expandAppmeshVirtualNodeSpec(d.Get("spec").([]interface{})), - Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh virtual node: %#v", req) @@ -348,15 +348,15 @@ func resourceAwsAppmeshVirtualNodeRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("error setting spec: %s", err) } - err = saveTagsAppmesh(conn, d, aws.StringValue(resp.VirtualNode.Metadata.Arn)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh virtual node (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error saving tags: %s", err) - } + // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.VirtualNode.Metadata.Arn)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh virtual node (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error saving tags: %s", err) + // } return nil } @@ -379,15 +379,15 @@ func resourceAwsAppmeshVirtualNodeUpdate(d *schema.ResourceData, meta interface{ } } - err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh virtual node (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh virtual node (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error setting tags: %s", err) + // } return resourceAwsAppmeshVirtualNodeRead(d, meta) } diff --git a/aws/resource_aws_appmesh_virtual_node_test.go b/aws/resource_aws_appmesh_virtual_node_test.go index 19ffcf5999e..ffebef7f2a5 100644 --- a/aws/resource_aws_appmesh_virtual_node_test.go +++ b/aws/resource_aws_appmesh_virtual_node_test.go @@ -232,51 +232,51 @@ func testAccAwsAppmeshVirtualNode_logging(t *testing.T) { }) } -func testAccAwsAppmeshVirtualNode_tags(t *testing.T) { - var vn appmesh.VirtualNodeData - resourceName := "aws_appmesh_virtual_node.test" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vnName := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAppmeshVirtualNodeConfig_tags(meshName, vnName, "foo", "bar", "good", "bad"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"), - resource.TestCheckResourceAttr(resourceName, "tags.good", "bad"), - ), - }, - { - Config: testAccAppmeshVirtualNodeConfig_tags(meshName, vnName, "foo2", "bar", "good", "bad2"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr(resourceName, "tags.foo2", "bar"), - resource.TestCheckResourceAttr(resourceName, "tags.good", "bad2"), - ), - }, - { - Config: testAccAppmeshVirtualNodeConfig_basic(meshName, vnName), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - ), - }, - { - ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s", meshName, vnName), - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +// func testAccAwsAppmeshVirtualNode_tags(t *testing.T) { +// var vn appmesh.VirtualNodeData +// resourceName := "aws_appmesh_virtual_node.test" +// meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) +// vnName := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) + +// resource.Test(t, resource.TestCase{ +// PreCheck: func() { testAccPreCheck(t) }, +// Providers: testAccProviders, +// CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, +// Steps: []resource.TestStep{ +// { +// Config: testAccAppmeshVirtualNodeConfig_tags(meshName, vnName, "foo", "bar", "good", "bad"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), +// resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"), +// resource.TestCheckResourceAttr(resourceName, "tags.good", "bad"), +// ), +// }, +// { +// Config: testAccAppmeshVirtualNodeConfig_tags(meshName, vnName, "foo2", "bar", "good", "bad2"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), +// resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr(resourceName, "tags.foo2", "bar"), +// resource.TestCheckResourceAttr(resourceName, "tags.good", "bad2"), +// ), +// }, +// { +// Config: testAccAppmeshVirtualNodeConfig_basic(meshName, vnName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), +// resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), +// ), +// }, +// { +// ResourceName: resourceName, +// ImportStateId: fmt.Sprintf("%s/%s", meshName, vnName), +// ImportState: true, +// ImportStateVerify: true, +// }, +// }, +// }) +// } func testAccCheckAppmeshVirtualNodeDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn @@ -508,18 +508,18 @@ resource "aws_appmesh_virtual_node" "test" { `, vnName, path) } -func testAccAppmeshVirtualNodeConfig_tags(meshName, vnName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { - return testAccAppmeshVirtualNodeConfig_mesh(meshName) + fmt.Sprintf(` -resource "aws_appmesh_virtual_node" "test" { - name = %[1]q - mesh_name = "${aws_appmesh_mesh.test.id}" - - spec {} - - tags = { - %[2]s = %[3]q - %[4]s = %[5]q - } -} -`, vnName, tagKey1, tagValue1, tagKey2, tagValue2) -} +// func testAccAppmeshVirtualNodeConfig_tags(meshName, vnName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { +// return testAccAppmeshVirtualNodeConfig_mesh(meshName) + fmt.Sprintf(` +// resource "aws_appmesh_virtual_node" "test" { +// name = %[1]q +// mesh_name = "${aws_appmesh_mesh.test.id}" + +// spec {} + +// tags = { +// %[2]s = %[3]q +// %[4]s = %[5]q +// } +// } +// `, vnName, tagKey1, tagValue1, tagKey2, tagValue2) +// } diff --git a/aws/resource_aws_appmesh_virtual_router.go b/aws/resource_aws_appmesh_virtual_router.go index 687d02a41ae..ae520d13130 100644 --- a/aws/resource_aws_appmesh_virtual_router.go +++ b/aws/resource_aws_appmesh_virtual_router.go @@ -123,7 +123,7 @@ func resourceAwsAppmeshVirtualRouterCreate(d *schema.ResourceData, meta interfac MeshName: aws.String(d.Get("mesh_name").(string)), VirtualRouterName: aws.String(d.Get("name").(string)), Spec: expandAppmeshVirtualRouterSpec(d.Get("spec").([]interface{})), - Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh virtual router: %#v", req) @@ -168,15 +168,15 @@ func resourceAwsAppmeshVirtualRouterRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("error setting spec: %s", err) } - err = saveTagsAppmesh(conn, d, aws.StringValue(resp.VirtualRouter.Metadata.Arn)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh virtual router (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error saving tags: %s", err) - } + // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.VirtualRouter.Metadata.Arn)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh virtual router (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error saving tags: %s", err) + // } return nil } @@ -199,15 +199,15 @@ func resourceAwsAppmeshVirtualRouterUpdate(d *schema.ResourceData, meta interfac } } - err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh virtual router (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh virtual router (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error setting tags: %s", err) + // } return resourceAwsAppmeshVirtualRouterRead(d, meta) } diff --git a/aws/resource_aws_appmesh_virtual_router_test.go b/aws/resource_aws_appmesh_virtual_router_test.go index d02f01669ca..a3e27d0c69a 100644 --- a/aws/resource_aws_appmesh_virtual_router_test.go +++ b/aws/resource_aws_appmesh_virtual_router_test.go @@ -151,61 +151,61 @@ func testAccAwsAppmeshVirtualRouter_basic(t *testing.T) { }) } -func testAccAwsAppmeshVirtualRouter_tags(t *testing.T) { - var vr appmesh.VirtualRouterData - resourceName := "aws_appmesh_virtual_router.foo" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshVirtualRouterDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAppmeshVirtualRouterConfig_tags(meshName, vrName, "foo", "bar", "good", "bad"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualRouterExists( - resourceName, &vr), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad"), - ), - }, - { - Config: testAccAppmeshVirtualRouterConfig_tags(meshName, vrName, "foo2", "bar", "good", "bad2"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualRouterExists( - resourceName, &vr), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo2", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad2"), - ), - }, - { - Config: testAccAppmeshVirtualRouterConfig_basic(meshName, vrName), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualRouterExists( - resourceName, &vr), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "0"), - ), - }, - { - ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s", meshName, vrName), - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +// func testAccAwsAppmeshVirtualRouter_tags(t *testing.T) { +// var vr appmesh.VirtualRouterData +// resourceName := "aws_appmesh_virtual_router.foo" +// meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) +// vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) + +// resource.Test(t, resource.TestCase{ +// PreCheck: func() { testAccPreCheck(t) }, +// Providers: testAccProviders, +// CheckDestroy: testAccCheckAppmeshVirtualRouterDestroy, +// Steps: []resource.TestStep{ +// { +// Config: testAccAppmeshVirtualRouterConfig_tags(meshName, vrName, "foo", "bar", "good", "bad"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualRouterExists( +// resourceName, &vr), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad"), +// ), +// }, +// { +// Config: testAccAppmeshVirtualRouterConfig_tags(meshName, vrName, "foo2", "bar", "good", "bad2"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualRouterExists( +// resourceName, &vr), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo2", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad2"), +// ), +// }, +// { +// Config: testAccAppmeshVirtualRouterConfig_basic(meshName, vrName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualRouterExists( +// resourceName, &vr), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "0"), +// ), +// }, +// { +// ResourceName: resourceName, +// ImportStateId: fmt.Sprintf("%s/%s", meshName, vrName), +// ImportState: true, +// ImportStateVerify: true, +// }, +// }, +// }) +// } func testAccCheckAppmeshVirtualRouterDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn @@ -301,29 +301,29 @@ resource "aws_appmesh_virtual_router" "foo" { `, meshName, vrName) } -func testAccAppmeshVirtualRouterConfig_tags(meshName, vrName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { - return fmt.Sprintf(` -resource "aws_appmesh_mesh" "foo" { - name = "%[1]s" -} - -resource "aws_appmesh_virtual_router" "foo" { - name = "%[2]s" - mesh_name = "${aws_appmesh_mesh.foo.id}" - - spec { - listener { - port_mapping { - port = 8080 - protocol = "http" - } - } - } - - tags = { - %[3]s = %[4]q - %[5]s = %[6]q - } -} -`, meshName, vrName, tagKey1, tagValue1, tagKey2, tagValue2) -} +// func testAccAppmeshVirtualRouterConfig_tags(meshName, vrName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { +// return fmt.Sprintf(` +// resource "aws_appmesh_mesh" "foo" { +// name = "%[1]s" +// } + +// resource "aws_appmesh_virtual_router" "foo" { +// name = "%[2]s" +// mesh_name = "${aws_appmesh_mesh.foo.id}" + +// spec { +// listener { +// port_mapping { +// port = 8080 +// protocol = "http" +// } +// } +// } + +// tags = { +// %[3]s = %[4]q +// %[5]s = %[6]q +// } +// } +// `, meshName, vrName, tagKey1, tagValue1, tagKey2, tagValue2) +// } diff --git a/aws/resource_aws_appmesh_virtual_service.go b/aws/resource_aws_appmesh_virtual_service.go index a720f98075d..59a3e63121f 100644 --- a/aws/resource_aws_appmesh_virtual_service.go +++ b/aws/resource_aws_appmesh_virtual_service.go @@ -118,7 +118,7 @@ func resourceAwsAppmeshVirtualServiceCreate(d *schema.ResourceData, meta interfa MeshName: aws.String(d.Get("mesh_name").(string)), VirtualServiceName: aws.String(d.Get("name").(string)), Spec: expandAppmeshVirtualServiceSpec(d.Get("spec").([]interface{})), - Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), } log.Printf("[DEBUG] Creating App Mesh virtual service: %#v", req) @@ -163,15 +163,15 @@ func resourceAwsAppmeshVirtualServiceRead(d *schema.ResourceData, meta interface return fmt.Errorf("error setting spec: %s", err) } - err = saveTagsAppmesh(conn, d, aws.StringValue(resp.VirtualService.Metadata.Arn)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh virtual service (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error saving tags: %s", err) - } + // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.VirtualService.Metadata.Arn)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh virtual service (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error saving tags: %s", err) + // } return nil } @@ -194,15 +194,15 @@ func resourceAwsAppmeshVirtualServiceUpdate(d *schema.ResourceData, meta interfa } } - err := setTagsAppmesh(conn, d, d.Get("arn").(string)) - if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { - log.Printf("[WARN] App Mesh virtual service (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if err != nil { - return fmt.Errorf("error setting tags: %s", err) - } + // err := setTagsAppmesh(conn, d, d.Get("arn").(string)) + // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { + // log.Printf("[WARN] App Mesh virtual service (%s) not found, removing from state", d.Id()) + // d.SetId("") + // return nil + // } + // if err != nil { + // return fmt.Errorf("error setting tags: %s", err) + // } return resourceAwsAppmeshVirtualServiceRead(d, meta) } diff --git a/aws/resource_aws_appmesh_virtual_service_test.go b/aws/resource_aws_appmesh_virtual_service_test.go index 4069a4b3ba9..f7ab33d842d 100644 --- a/aws/resource_aws_appmesh_virtual_service_test.go +++ b/aws/resource_aws_appmesh_virtual_service_test.go @@ -108,60 +108,60 @@ func testAccAwsAppmeshVirtualService_virtualRouter(t *testing.T) { }) } -func testAccAwsAppmeshVirtualService_tags(t *testing.T) { - var vs appmesh.VirtualServiceData - resourceName := "aws_appmesh_virtual_service.foo" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vnName1 := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - vnName2 := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - vsName := fmt.Sprintf("tf-test-%d.mesh.local", acctest.RandInt()) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshVirtualServiceDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAppmeshVirtualServiceConfig_tags(meshName, vnName1, vnName2, vsName, "aws_appmesh_virtual_node.foo", "foo", "bar", "good", "bad"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualServiceExists(resourceName, &vs), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad"), - ), - }, - { - Config: testAccAppmeshVirtualServiceConfig_tags(meshName, vnName1, vnName2, vsName, "aws_appmesh_virtual_node.foo", "foo2", "bar", "good", "bad2"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualServiceExists(resourceName, &vs), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "2"), - resource.TestCheckResourceAttr( - resourceName, "tags.foo2", "bar"), - resource.TestCheckResourceAttr( - resourceName, "tags.good", "bad2"), - ), - }, - { - Config: testAccAppmeshVirtualServiceConfig_virtualNode(meshName, vnName1, vnName2, vsName, "aws_appmesh_virtual_node.foo"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshVirtualServiceExists(resourceName, &vs), - resource.TestCheckResourceAttr( - resourceName, "tags.%", "0"), - ), - }, - { - ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s", meshName, vsName), - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +// func testAccAwsAppmeshVirtualService_tags(t *testing.T) { +// var vs appmesh.VirtualServiceData +// resourceName := "aws_appmesh_virtual_service.foo" +// meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) +// vnName1 := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) +// vnName2 := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) +// vsName := fmt.Sprintf("tf-test-%d.mesh.local", acctest.RandInt()) + +// resource.Test(t, resource.TestCase{ +// PreCheck: func() { testAccPreCheck(t) }, +// Providers: testAccProviders, +// CheckDestroy: testAccCheckAppmeshVirtualServiceDestroy, +// Steps: []resource.TestStep{ +// { +// Config: testAccAppmeshVirtualServiceConfig_tags(meshName, vnName1, vnName2, vsName, "aws_appmesh_virtual_node.foo", "foo", "bar", "good", "bad"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualServiceExists(resourceName, &vs), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad"), +// ), +// }, +// { +// Config: testAccAppmeshVirtualServiceConfig_tags(meshName, vnName1, vnName2, vsName, "aws_appmesh_virtual_node.foo", "foo2", "bar", "good", "bad2"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualServiceExists(resourceName, &vs), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "2"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.foo2", "bar"), +// resource.TestCheckResourceAttr( +// resourceName, "tags.good", "bad2"), +// ), +// }, +// { +// Config: testAccAppmeshVirtualServiceConfig_virtualNode(meshName, vnName1, vnName2, vsName, "aws_appmesh_virtual_node.foo"), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckAppmeshVirtualServiceExists(resourceName, &vs), +// resource.TestCheckResourceAttr( +// resourceName, "tags.%", "0"), +// ), +// }, +// { +// ResourceName: resourceName, +// ImportStateId: fmt.Sprintf("%s/%s", meshName, vsName), +// ImportState: true, +// ImportStateVerify: true, +// }, +// }, +// }) +// } func testAccCheckAppmeshVirtualServiceDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn @@ -297,42 +297,42 @@ resource "aws_appmesh_virtual_service" "foo" { `, meshName, vrName1, vrName2, vsName, rName) } -func testAccAppmeshVirtualServiceConfig_tags(meshName, vnName1, vnName2, vsName, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { - return fmt.Sprintf(` -resource "aws_appmesh_mesh" "foo" { - name = "%[1]s" -} - -resource "aws_appmesh_virtual_node" "foo" { - name = "%[2]s" - mesh_name = "${aws_appmesh_mesh.foo.id}" - - spec {} -} - -resource "aws_appmesh_virtual_node" "bar" { - name = "%[3]s" - mesh_name = "${aws_appmesh_mesh.foo.id}" - - spec {} -} - -resource "aws_appmesh_virtual_service" "foo" { - name = "%[4]s" - mesh_name = "${aws_appmesh_mesh.foo.id}" - - spec { - provider { - virtual_node { - virtual_node_name = "${%s.name}" - } - } - } - - tags = { - %[6]s = %[7]q - %[8]s = %[9]q - } -} -`, meshName, vnName1, vnName2, vsName, rName, tagKey1, tagValue1, tagKey2, tagValue2) -} +// func testAccAppmeshVirtualServiceConfig_tags(meshName, vnName1, vnName2, vsName, rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { +// return fmt.Sprintf(` +// resource "aws_appmesh_mesh" "foo" { +// name = "%[1]s" +// } + +// resource "aws_appmesh_virtual_node" "foo" { +// name = "%[2]s" +// mesh_name = "${aws_appmesh_mesh.foo.id}" + +// spec {} +// } + +// resource "aws_appmesh_virtual_node" "bar" { +// name = "%[3]s" +// mesh_name = "${aws_appmesh_mesh.foo.id}" + +// spec {} +// } + +// resource "aws_appmesh_virtual_service" "foo" { +// name = "%[4]s" +// mesh_name = "${aws_appmesh_mesh.foo.id}" + +// spec { +// provider { +// virtual_node { +// virtual_node_name = "${%s.name}" +// } +// } +// } + +// tags = { +// %[6]s = %[7]q +// %[8]s = %[9]q +// } +// } +// `, meshName, vnName1, vnName2, vsName, rName, tagKey1, tagValue1, tagKey2, tagValue2) +// } From b72438e1fac2cea2b58ada17fdf4318412fb9c81 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 25 Jul 2019 11:57:30 -0400 Subject: [PATCH 12/23] 'appmesh' -> 'appmesh-preview' in ARNs for acceptance tests. --- aws/resource_aws_appmesh_mesh_test.go | 2 +- aws/resource_aws_appmesh_route_test.go | 8 ++++---- aws/resource_aws_appmesh_virtual_node_test.go | 6 +++--- aws/resource_aws_appmesh_virtual_router_test.go | 2 +- aws/resource_aws_appmesh_virtual_service_test.go | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/aws/resource_aws_appmesh_mesh_test.go b/aws/resource_aws_appmesh_mesh_test.go index cb909d3f71c..2edd7536f08 100644 --- a/aws/resource_aws_appmesh_mesh_test.go +++ b/aws/resource_aws_appmesh_mesh_test.go @@ -80,7 +80,7 @@ func testAccAwsAppmeshMesh_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s", rName))), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s", rName))), ), }, { diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index ac8bdb853f5..64f968074ed 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -129,7 +129,7 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), ), }, { @@ -147,7 +147,7 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/path"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), ), }, { @@ -187,7 +187,7 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.0.weighted_target.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), ), }, { @@ -203,7 +203,7 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.0.weighted_target.#", "2"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), ), }, { diff --git a/aws/resource_aws_appmesh_virtual_node_test.go b/aws/resource_aws_appmesh_virtual_node_test.go index ffebef7f2a5..e19bbedd21c 100644 --- a/aws/resource_aws_appmesh_virtual_node_test.go +++ b/aws/resource_aws_appmesh_virtual_node_test.go @@ -36,7 +36,7 @@ func testAccAwsAppmeshVirtualNode_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), ), }, { @@ -141,7 +141,7 @@ func testAccAwsAppmeshVirtualNode_listenerHealthChecks(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.0.hostname", "serviceb.simpleapp.local"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), ), }, { @@ -173,7 +173,7 @@ func testAccAwsAppmeshVirtualNode_listenerHealthChecks(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.0.hostname", "serviceb1.simpleapp.local"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), ), }, { diff --git a/aws/resource_aws_appmesh_virtual_router_test.go b/aws/resource_aws_appmesh_virtual_router_test.go index a3e27d0c69a..fcee4c19cbe 100644 --- a/aws/resource_aws_appmesh_virtual_router_test.go +++ b/aws/resource_aws_appmesh_virtual_router_test.go @@ -117,7 +117,7 @@ func testAccAwsAppmeshVirtualRouter_basic(t *testing.T) { resource.TestCheckResourceAttrSet( resourceName, "last_updated_date"), resource.TestMatchResourceAttr( - resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s", meshName, vrName))), + resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s", meshName, vrName))), ), }, { diff --git a/aws/resource_aws_appmesh_virtual_service_test.go b/aws/resource_aws_appmesh_virtual_service_test.go index f7ab33d842d..0aebcd71a44 100644 --- a/aws/resource_aws_appmesh_virtual_service_test.go +++ b/aws/resource_aws_appmesh_virtual_service_test.go @@ -38,7 +38,7 @@ func testAccAwsAppmeshVirtualService_virtualNode(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), resource.TestMatchResourceAttr( - resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualService/%s", meshName, vsName))), + resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualService/%s", meshName, vsName))), ), }, { @@ -89,7 +89,7 @@ func testAccAwsAppmeshVirtualService_virtualRouter(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), resource.TestMatchResourceAttr( - resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh:[^:]+:\\d{12}:mesh/%s/virtualService/%s", meshName, vsName))), + resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualService/%s", meshName, vsName))), ), }, { From 816a62e8e5752cdea2b2bf2d7223e08c6c2549ac Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 25 Jul 2019 12:08:04 -0400 Subject: [PATCH 13/23] Remove AppMesh tagging code to pass lint checks. --- aws/tagsAppmesh.go | 131 ---------------------------------------- aws/tagsAppmesh_test.go | 113 ---------------------------------- 2 files changed, 244 deletions(-) delete mode 100644 aws/tagsAppmesh.go delete mode 100644 aws/tagsAppmesh_test.go diff --git a/aws/tagsAppmesh.go b/aws/tagsAppmesh.go deleted file mode 100644 index bf0106eedfc..00000000000 --- a/aws/tagsAppmesh.go +++ /dev/null @@ -1,131 +0,0 @@ -package aws - -import ( - "log" - "regexp" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmeshpreview" - "github.com/hashicorp/terraform/helper/schema" -) - -// setTags is a helper to set the tags for a resource. It expects the -// tags field to be named "tags" -func setTagsAppmesh(conn *appmeshpreview.AppMeshPreview, d *schema.ResourceData, arn string) error { - if d.HasChange("tags") { - oraw, nraw := d.GetChange("tags") - o := oraw.(map[string]interface{}) - n := nraw.(map[string]interface{}) - create, remove := diffTagsAppmesh(tagsFromMapAppmesh(o), tagsFromMapAppmesh(n)) - - // Set tags - if len(remove) > 0 { - input := appmeshpreview.UntagResourceInput{ - ResourceArn: aws.String(arn), - TagKeys: remove, - } - log.Printf("[DEBUG] Removing Appmesh tags: %s", input) - _, err := conn.UntagResource(&input) - if err != nil { - return err - } - } - if len(create) > 0 { - input := appmeshpreview.TagResourceInput{ - ResourceArn: aws.String(arn), - Tags: create, - } - log.Printf("[DEBUG] Adding Appmesh tags: %s", input) - _, err := conn.TagResource(&input) - if err != nil { - return err - } - } - } - - return nil -} - -// diffTags takes our tags locally and the ones remotely and returns -// the set of tags that must be created, and the set of tags that must -// be destroyed. -func diffTagsAppmesh(oldTags, newTags []*appmeshpreview.TagRef) ([]*appmeshpreview.TagRef, []*string) { - // First, we're creating everything we have - create := make(map[string]interface{}) - for _, t := range newTags { - create[aws.StringValue(t.Key)] = aws.StringValue(t.Value) - } - - // Build the list of what to remove - var remove []*string - for _, t := range oldTags { - old, ok := create[aws.StringValue(t.Key)] - if !ok || old != aws.StringValue(t.Value) { - remove = append(remove, t.Key) - } else if ok { - // already present so remove from new - delete(create, aws.StringValue(t.Key)) - } - } - - return tagsFromMapAppmesh(create), remove -} - -// tagsFromMap returns the tags for the given map of data. -func tagsFromMapAppmesh(m map[string]interface{}) []*appmeshpreview.TagRef { - var result []*appmeshpreview.TagRef - for k, v := range m { - t := &appmeshpreview.TagRef{ - Key: aws.String(k), - Value: aws.String(v.(string)), - } - if !tagIgnoredAppmesh(t) { - result = append(result, t) - } - } - - return result -} - -// tagsToMap turns the list of tags into a map. -func tagsToMapAppmesh(ts []*appmeshpreview.TagRef) map[string]string { - result := make(map[string]string) - for _, t := range ts { - if !tagIgnoredAppmesh(t) { - result[aws.StringValue(t.Key)] = aws.StringValue(t.Value) - } - } - - return result -} - -func saveTagsAppmesh(conn *appmeshpreview.AppMeshPreview, d *schema.ResourceData, arn string) error { - resp, err := conn.ListTagsForResource(&appmeshpreview.ListTagsForResourceInput{ - ResourceArn: aws.String(arn), - }) - if err != nil { - return err - } - - var dt []*appmeshpreview.TagRef - if len(resp.Tags) > 0 { - dt = resp.Tags - } - - return d.Set("tags", tagsToMapAppmesh(dt)) -} - -// compare a tag against a list of strings and checks if it should -// be ignored or not -func tagIgnoredAppmesh(t *appmeshpreview.TagRef) bool { - filter := []string{"^aws:"} - for _, v := range filter { - log.Printf("[DEBUG] Matching %v with %v\n", v, aws.StringValue(t.Key)) - r, _ := regexp.MatchString(v, aws.StringValue(t.Key)) - if r { - log.Printf("[DEBUG] Found AWS specific tag %s (val: %s), ignoring.\n", aws.StringValue(t.Key), aws.StringValue(t.Value)) - return true - } - } - return false -} diff --git a/aws/tagsAppmesh_test.go b/aws/tagsAppmesh_test.go deleted file mode 100644 index 26ee6057aea..00000000000 --- a/aws/tagsAppmesh_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package aws - -import ( - "reflect" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/appmeshpreview" -) - -func TestDiffAppmeshTags(t *testing.T) { - cases := []struct { - Old, New map[string]interface{} - Create map[string]string - Remove []string - }{ - // Add - { - Old: map[string]interface{}{ - "foo": "bar", - }, - New: map[string]interface{}{ - "foo": "bar", - "bar": "baz", - }, - Create: map[string]string{ - "bar": "baz", - }, - Remove: []string{}, - }, - - // Modify - { - Old: map[string]interface{}{ - "foo": "bar", - }, - New: map[string]interface{}{ - "foo": "baz", - }, - Create: map[string]string{ - "foo": "baz", - }, - Remove: []string{ - "foo", - }, - }, - - // Overlap - { - Old: map[string]interface{}{ - "foo": "bar", - "hello": "world", - }, - New: map[string]interface{}{ - "foo": "baz", - "hello": "world", - }, - Create: map[string]string{ - "foo": "baz", - }, - Remove: []string{ - "foo", - }, - }, - - // Remove - { - Old: map[string]interface{}{ - "foo": "bar", - "bar": "baz", - }, - New: map[string]interface{}{ - "foo": "bar", - }, - Create: map[string]string{}, - Remove: []string{ - "bar", - }, - }, - } - - for i, tc := range cases { - c, r := diffTagsAppmesh(tagsFromMapAppmesh(tc.Old), tagsFromMapAppmesh(tc.New)) - cm := tagsToMapAppmesh(c) - rl := []string{} - for _, tagName := range r { - rl = append(rl, *tagName) - } - if !reflect.DeepEqual(cm, tc.Create) { - t.Fatalf("%d: bad create: %#v", i, cm) - } - if !reflect.DeepEqual(rl, tc.Remove) { - t.Fatalf("%d: bad remove: %#v", i, rl) - } - } -} - -func TestIgnoringTagsAppmesh(t *testing.T) { - var ignoredTags []*appmeshpreview.TagRef - ignoredTags = append(ignoredTags, &appmeshpreview.TagRef{ - Key: aws.String("aws:cloudformation:logical-id"), - Value: aws.String("foo"), - }) - ignoredTags = append(ignoredTags, &appmeshpreview.TagRef{ - Key: aws.String("aws:foo:bar"), - Value: aws.String("baz"), - }) - for _, tag := range ignoredTags { - if !tagIgnoredAppmesh(tag) { - t.Fatalf("Tag %v with value %v not ignored, but should be!", *tag.Key, *tag.Value) - } - } -} From 965a982a444d87b91bc6c5fed860d79e38fa10d4 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 25 Jul 2019 15:11:40 -0400 Subject: [PATCH 14/23] r/aws_appmesh_route: Initial support for HTTP header routing. --- aws/diff_suppress_funcs.go | 7 + aws/resource_aws_appmesh_route.go | 297 ++++++++++++++++++--- website/docs/r/appmesh_route.html.markdown | 2 +- 3 files changed, 272 insertions(+), 34 deletions(-) diff --git a/aws/diff_suppress_funcs.go b/aws/diff_suppress_funcs.go index 0e340e4351e..b1bb9f28e71 100644 --- a/aws/diff_suppress_funcs.go +++ b/aws/diff_suppress_funcs.go @@ -132,3 +132,10 @@ func suppressRoute53ZoneNameWithTrailingDot(k, old, new string, d *schema.Resour } return strings.TrimSuffix(old, ".") == strings.TrimSuffix(new, ".") } + +/* +// suppressStringsEqualFold suppresses any difference between two strings that are equal under Unicode case-folding. +func suppressStringsEqualFold(k, old, new string, d *schema.ResourceData) bool { + return strings.EqualFold(old, new) +} +*/ diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index cd78e37bf1e..8235777cec3 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -102,11 +102,107 @@ func resourceAwsAppmeshRoute() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "header": { + Type: schema.TypeSet, + Optional: true, + MinItems: 0, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "invert": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + + "match": { + Type: schema.TypeList, + Optional: true, + MinItems: 0, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "exact": { + Type: schema.TypeString, + Optional: true, + }, + + "prefix": { + Type: schema.TypeString, + Optional: true, + }, + + "range": { + Type: schema.TypeList, + Optional: true, + MinItems: 0, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "end": { + Type: schema.TypeInt, + Required: true, + }, + + "start": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + + "regex": { + Type: schema.TypeString, + Optional: true, + }, + + "suffix": { + Type: schema.TypeString, + Optional: true, + }, + }, + }, + }, + + "name": { + Type: schema.TypeString, + Required: true, + }, + }, + }, + Set: appmeshHttpRouteHeaderHash, + }, + + "method": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "CONNECT", + "DELETE", + "GET", + "HEAD", + "OPTIONS", + "PATCH", + "POST", + "PUT", + "TRACE", + }, false), + }, + "prefix": { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch(regexp.MustCompile(`^/`), "must start with /"), }, + + "scheme": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + appmesh.HttpSchemeHttp, + appmesh.HttpSchemeHttps, + }, false), + }, }, }, }, @@ -358,7 +454,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { if vVirtualNode, ok := mWeightedTarget["virtual_node"].(string); ok && vVirtualNode != "" { weightedTarget.VirtualNode = aws.String(vVirtualNode) } - if vWeight, ok := mWeightedTarget["weight"].(int); ok { + if vWeight, ok := mWeightedTarget["weight"].(int); ok && vWeight > 0 { weightedTarget.Weight = aws.Int64(int64(vWeight)) } @@ -372,13 +468,74 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { } if vHttpRouteMatch, ok := mHttpRoute["match"].([]interface{}); ok && len(vHttpRouteMatch) > 0 && vHttpRouteMatch[0] != nil { + httpRouteMatch := &appmesh.HttpRouteMatch{} + mHttpRouteMatch := vHttpRouteMatch[0].(map[string]interface{}) + if vMethod, ok := mHttpRouteMatch["method"].(string); ok && vMethod != "" { + httpRouteMatch.Method = aws.String(vMethod) + } if vPrefix, ok := mHttpRouteMatch["prefix"].(string); ok && vPrefix != "" { - spec.HttpRoute.Match = &appmesh.HttpRouteMatch{ - Prefix: aws.String(vPrefix), + httpRouteMatch.Prefix = aws.String(vPrefix) + } + if vScheme, ok := mHttpRouteMatch["scheme"].(string); ok && vScheme != "" { + httpRouteMatch.Scheme = aws.String(vScheme) + } + + if vHttpRouteHeaders, ok := mHttpRouteMatch["header"].(*schema.Set); ok && vHttpRouteHeaders.Len() > 0 { + httpRouteHeaders := []*appmesh.HttpRouteHeader{} + + for _, vHttpRouteHeader := range vHttpRouteHeaders.List() { + httpRouteHeader := &appmesh.HttpRouteHeader{} + + mHttpRouteHeader := vHttpRouteHeader.(map[string]interface{}) + + if vInvert, ok := mHttpRouteHeader["invert"].(bool); ok { + httpRouteHeader.Invert = aws.Bool(vInvert) + } + if vName, ok := mHttpRouteHeader["name"].(string); ok && vName != "" { + httpRouteHeader.Name = aws.String(vName) + } + + if vMatch, ok := mHttpRouteHeader["match"].([]interface{}); ok && len(vMatch) > 0 && vMatch[0] != nil { + httpRouteHeader.Match = &appmesh.HeaderMatchMethod{} + + mMatch := vMatch[0].(map[string]interface{}) + + if vExact, ok := mMatch["exact"].(string); ok && vExact != "" { + httpRouteHeader.Match.Exact = aws.String(vExact) + } + if vPrefix, ok := mMatch["prefix"].(string); ok && vPrefix != "" { + httpRouteHeader.Match.Prefix = aws.String(vPrefix) + } + if vRegex, ok := mMatch["regex"].(string); ok && vRegex != "" { + httpRouteHeader.Match.Regex = aws.String(vRegex) + } + if vSuffix, ok := mMatch["suffix"].(string); ok && vSuffix != "" { + httpRouteHeader.Match.Suffix = aws.String(vSuffix) + } + + if vRange, ok := mMatch["range"].([]interface{}); ok && len(vRange) > 0 && vRange[0] != nil { + httpRouteHeader.Match.Range = &appmesh.MatchRange{} + + mRange := vRange[0].(map[string]interface{}) + + if vEnd, ok := mRange["end"].(int); ok && vEnd > 0 { + httpRouteHeader.Match.Range.End = aws.Int64(int64(vEnd)) + } + if vStart, ok := mRange["start"].(int); ok && vStart > 0 { + httpRouteHeader.Match.Range.Start = aws.Int64(int64(vStart)) + } + } + } + + httpRouteHeaders = append(httpRouteHeaders, httpRouteHeader) } + + httpRouteMatch.Headers = httpRouteHeaders } + + spec.HttpRoute.Match = httpRouteMatch } } @@ -401,7 +558,7 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { if vVirtualNode, ok := mWeightedTarget["virtual_node"].(string); ok && vVirtualNode != "" { weightedTarget.VirtualNode = aws.String(vVirtualNode) } - if vWeight, ok := mWeightedTarget["weight"].(int); ok { + if vWeight, ok := mWeightedTarget["weight"].(int); ok && vWeight > 0 { weightedTarget.Weight = aws.Int64(int64(vWeight)) } @@ -425,32 +582,68 @@ func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { mSpec := map[string]interface{}{} - if spec.HttpRoute != nil { + if httpRoute := spec.HttpRoute; httpRoute != nil { mHttpRoute := map[string]interface{}{} - if spec.HttpRoute.Action != nil && spec.HttpRoute.Action.WeightedTargets != nil { - vWeightedTargets := []interface{}{} + if action := httpRoute.Action; action != nil { + if weightedTargets := action.WeightedTargets; weightedTargets != nil { + vWeightedTargets := []interface{}{} - for _, weightedTarget := range spec.HttpRoute.Action.WeightedTargets { - mWeightedTarget := map[string]interface{}{ - "virtual_node": aws.StringValue(weightedTarget.VirtualNode), - "weight": int(aws.Int64Value(weightedTarget.Weight)), + for _, weightedTarget := range weightedTargets { + mWeightedTarget := map[string]interface{}{ + "virtual_node": aws.StringValue(weightedTarget.VirtualNode), + "weight": int(aws.Int64Value(weightedTarget.Weight)), + } + + vWeightedTargets = append(vWeightedTargets, mWeightedTarget) } - vWeightedTargets = append(vWeightedTargets, mWeightedTarget) + mHttpRoute["action"] = []interface{}{ + map[string]interface{}{ + "weighted_target": schema.NewSet(appmeshWeightedTargetHash, vWeightedTargets), + }, + } } + } - mHttpRoute["action"] = []interface{}{ - map[string]interface{}{ - "weighted_target": schema.NewSet(appmeshWeightedTargetHash, vWeightedTargets), - }, + if httpRouteMatch := httpRoute.Match; httpRouteMatch != nil { + vHttpRouteHeaders := []interface{}{} + + for _, httpRouteHeader := range httpRouteMatch.Headers { + mHttpRouteHeader := map[string]interface{}{ + "invert": aws.BoolValue(httpRouteHeader.Invert), + "name": aws.StringValue(httpRouteHeader.Name), + } + + if match := httpRouteHeader.Match; match != nil { + mMatch := map[string]interface{}{ + "exact": aws.StringValue(match.Exact), + "prefix": aws.StringValue(match.Prefix), + "regex": aws.StringValue(match.Regex), + "suffix": aws.StringValue(match.Suffix), + } + + if r := match.Range; r != nil { + mRange := map[string]interface{}{ + "end": int(aws.Int64Value(r.End)), + "start": int(aws.Int64Value(r.Start)), + } + + mMatch["range"] = []interface{}{mRange} + } + + mHttpRouteHeader["match"] = []interface{}{mMatch} + } + + vHttpRouteHeaders = append(vHttpRouteHeaders, mHttpRouteHeader) } - } - if spec.HttpRoute.Match != nil { mHttpRoute["match"] = []interface{}{ map[string]interface{}{ - "prefix": aws.StringValue(spec.HttpRoute.Match.Prefix), + "header": schema.NewSet(appmeshHttpRouteHeaderHash, vHttpRouteHeaders), + "method": aws.StringValue(httpRouteMatch.Method), + "prefix": aws.StringValue(httpRouteMatch.Prefix), + "scheme": aws.StringValue(httpRouteMatch.Scheme), }, } } @@ -458,25 +651,27 @@ func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { mSpec["http_route"] = []interface{}{mHttpRoute} } - if spec.TcpRoute != nil { + if tcpRoute := spec.TcpRoute; tcpRoute != nil { mTcpRoute := map[string]interface{}{} - if spec.TcpRoute.Action != nil && spec.TcpRoute.Action.WeightedTargets != nil { - vWeightedTargets := []interface{}{} + if action := tcpRoute.Action; action != nil { + if weightedTargets := action.WeightedTargets; weightedTargets != nil { + vWeightedTargets := []interface{}{} - for _, weightedTarget := range spec.TcpRoute.Action.WeightedTargets { - mWeightedTarget := map[string]interface{}{ - "virtual_node": aws.StringValue(weightedTarget.VirtualNode), - "weight": int(aws.Int64Value(weightedTarget.Weight)), - } + for _, weightedTarget := range weightedTargets { + mWeightedTarget := map[string]interface{}{ + "virtual_node": aws.StringValue(weightedTarget.VirtualNode), + "weight": int(aws.Int64Value(weightedTarget.Weight)), + } - vWeightedTargets = append(vWeightedTargets, mWeightedTarget) - } + vWeightedTargets = append(vWeightedTargets, mWeightedTarget) + } - mTcpRoute["action"] = []interface{}{ - map[string]interface{}{ - "weighted_target": schema.NewSet(appmeshWeightedTargetHash, vWeightedTargets), - }, + mTcpRoute["action"] = []interface{}{ + map[string]interface{}{ + "weighted_target": schema.NewSet(appmeshWeightedTargetHash, vWeightedTargets), + }, + } } } @@ -486,6 +681,42 @@ func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { return []interface{}{mSpec} } +func appmeshHttpRouteHeaderHash(vHttpRouteHeader interface{}) int { + var buf bytes.Buffer + mHttpRouteHeader := vHttpRouteHeader.(map[string]interface{}) + if v, ok := mHttpRouteHeader["invert"].(bool); ok { + buf.WriteString(fmt.Sprintf("%t-", v)) + } + if vMatch, ok := mHttpRouteHeader["match"].([]interface{}); ok && len(vMatch) > 0 && vMatch[0] != nil { + mMatch := vMatch[0].(map[string]interface{}) + if v, ok := mMatch["exact"].(string); ok { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + if v, ok := mMatch["prefix"].(string); ok { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + if vRange, ok := mMatch["range"].([]interface{}); ok && len(vRange) > 0 && vRange[0] != nil { + mRange := vRange[0].(map[string]interface{}) + if v, ok := mRange["end"].(int); ok { + buf.WriteString(fmt.Sprintf("%d-", v)) + } + if v, ok := mRange["start"].(int); ok { + buf.WriteString(fmt.Sprintf("%d-", v)) + } + } + if v, ok := mMatch["regex"].(string); ok { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + if v, ok := mMatch["suffix"].(string); ok { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + } + if v, ok := mHttpRouteHeader["name"].(string); ok { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + return hashcode.String(buf.String()) +} + func appmeshWeightedTargetHash(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) diff --git a/website/docs/r/appmesh_route.html.markdown b/website/docs/r/appmesh_route.html.markdown index 73794e262f7..fd4293e5c29 100644 --- a/website/docs/r/appmesh_route.html.markdown +++ b/website/docs/r/appmesh_route.html.markdown @@ -108,7 +108,7 @@ The `weighted_target` object supports the following: The `header` object supports the following: * `name` - (Required) HTTP header name -* `invert` - (Optional) If `true`, the match is on the opposite of the match type and value. +* `invert` - (Optional) If `true`, the match is on the opposite of the match type and value. Default is `false`. * `match` - (Optional) The match type and value. The `match` object supports the following: From b34cf1c46a0fee2e760e64067008259949187958 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 26 Jul 2019 14:19:08 -0400 Subject: [PATCH 15/23] r/aws_appmesh_route: Acceptance tests for HTTP header routing. --- aws/resource_aws_appmesh_route_test.go | 347 ++++++++++++++++++------- aws/resource_aws_appmesh_test.go | 5 +- 2 files changed, 255 insertions(+), 97 deletions(-) diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index 64f968074ed..c91dfc92459 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "regexp" "testing" "github.com/aws/aws-sdk-go/aws" @@ -16,11 +15,11 @@ import ( func init() { resource.AddTestSweepers("aws_appmesh_route", &resource.Sweeper{ Name: "aws_appmesh_route", - F: testSweepAppmeshRoutes, + F: testSweepAwsAppmeshRoutes, }) } -func testSweepAppmeshRoutes(region string) error { +func testSweepAwsAppmeshRoutes(region string) error { client, err := sharedClientForRegion(region) if err != nil { return fmt.Errorf("error getting client: %s", err) @@ -102,57 +101,141 @@ func testSweepAppmeshRoutes(region string) error { func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { var r appmesh.RouteData - resourceName := "aws_appmesh_route.foo" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) - vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) + resourceName := "aws_appmesh_route.test" + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshRouteDestroy, + CheckDestroy: testAccCheckAwsAppmeshRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName), + Config: testAccAwsAppmeshRouteConfig_httpRoute(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), + testAccCheckAwsAppmeshRouteExists(resourceName, &r), resource.TestCheckResourceAttr(resourceName, "name", rName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", vrName), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.0.weighted_target.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", ""), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), ), }, { - Config: testAccAppmeshRouteConfig_httpRouteUpdated(meshName, vrName, vn1Name, vn2Name, rName), + Config: testAccAwsAppmeshRouteConfig_httpRouteUpdated(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), + testAccCheckAwsAppmeshRouteExists(resourceName, &r), resource.TestCheckResourceAttr(resourceName, "name", rName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", vrName), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.0.weighted_target.#", "2"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", ""), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/path"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), ), }, { ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), + ImportStateIdFunc: testAccAwsAppmeshRouteImportStateIdFunc(resourceName), + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccAwsAppmeshRoute_httpHeader(t *testing.T) { + var r appmesh.RouteData + resourceName := "aws_appmesh_route.test" + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsAppmeshRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsAppmeshRouteConfig_httpHeader(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAppmeshRouteExists(resourceName, &r), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.0.weighted_target.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.2366200004.invert", "false"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.2366200004.match.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.2366200004.name", "X-Testing1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", "POST"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", "http"), + resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + ), + }, + { + Config: testAccAwsAppmeshRouteConfig_httpHeaderUpdated(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAppmeshRouteExists(resourceName, &r), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.0.weighted_target.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.#", "2"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.2971741486.invert", "true"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.2971741486.match.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.2971741486.name", "X-Testing1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.invert", "false"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.match.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.match.0.exact", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.match.0.prefix", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.match.0.range.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.match.0.range.0.end", "7"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.match.0.range.0.start", "2"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.match.0.regex", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.match.0.suffix", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.3147536248.name", "X-Testing2"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", "PUT"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/path"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", "https"), + resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + ), + }, + { + ResourceName: resourceName, + ImportStateIdFunc: testAccAwsAppmeshRouteImportStateIdFunc(resourceName), ImportState: true, ImportStateVerify: true, }, @@ -162,53 +245,51 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { var r appmesh.RouteData - resourceName := "aws_appmesh_route.foo" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vrName := fmt.Sprintf("tf-test-router-%d", acctest.RandInt()) - vn1Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - vn2Name := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - rName := fmt.Sprintf("tf-test-route-%d", acctest.RandInt()) + resourceName := "aws_appmesh_route.test" + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckAppmeshRouteDestroy, + CheckDestroy: testAccCheckAwsAppmeshRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAppmeshRouteConfig_tcpRoute(meshName, vrName, vn1Name, vn2Name, rName), + Config: testAccAwsAppmeshRouteConfig_tcpRoute(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), + testAccCheckAwsAppmeshRouteExists(resourceName, &r), resource.TestCheckResourceAttr(resourceName, "name", rName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", vrName), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.0.weighted_target.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), ), }, { - Config: testAccAppmeshRouteConfig_tcpRouteUpdated(meshName, vrName, vn1Name, vn2Name, rName), + Config: testAccAwsAppmeshRouteConfig_tcpRouteUpdated(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAppmeshRouteExists(resourceName, &r), + testAccCheckAwsAppmeshRouteExists(resourceName, &r), resource.TestCheckResourceAttr(resourceName, "name", rName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", vrName), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.0.weighted_target.#", "2"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualRouter/%s/route/%s", meshName, vrName, rName))), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), ), }, { ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s/%s", meshName, vrName, rName), + ImportStateIdFunc: testAccAwsAppmeshRouteImportStateIdFunc(resourceName), ImportState: true, ImportStateVerify: true, }, @@ -272,7 +353,7 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { // }) // } -func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { +func testAccCheckAwsAppmeshRouteDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn for _, rs := range s.RootModule().Resources { @@ -297,7 +378,7 @@ func testAccCheckAppmeshRouteDestroy(s *terraform.State) error { return nil } -func testAccCheckAppmeshRouteExists(name string, v *appmesh.RouteData) resource.TestCheckFunc { +func testAccCheckAwsAppmeshRouteExists(name string, v *appmesh.RouteData) resource.TestCheckFunc { return func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).appmeshpreviewconn @@ -324,49 +405,54 @@ func testAccCheckAppmeshRouteExists(name string, v *appmesh.RouteData) resource. } } -func testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name string) string { - return fmt.Sprintf(` -resource "aws_appmesh_mesh" "foo" { - name = %[1]q -} - -resource "aws_appmesh_virtual_router" "foo" { - name = %[2]q - mesh_name = "${aws_appmesh_mesh.foo.id}" - - spec { - listener { - port_mapping { - port = 8080 - protocol = "http" - } +func testAccAwsAppmeshRouteImportStateIdFunc(resourceName string) resource.ImportStateIdFunc { + return func(s *terraform.State) (string, error) { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return "", fmt.Errorf("Not Found: %s", resourceName) } + + return fmt.Sprintf("%s/%s/%s", rs.Primary.Attributes["mesh_name"], rs.Primary.Attributes["virtual_router_name"], rs.Primary.Attributes["name"]), nil } } -resource "aws_appmesh_virtual_node" "foo" { - name = %[3]q - mesh_name = "${aws_appmesh_mesh.foo.id}" +func testAccAwsAppmeshRouteConfigBase(rName string) string { + return fmt.Sprintf(` +resource "aws_appmesh_mesh" "test" { + name = %[1]q +} + +resource "aws_appmesh_virtual_router" "test" { + name = %[1]q + mesh_name = "${aws_appmesh_mesh.test.id}" - spec {} + spec { + listener { + port_mapping { + port = 8080 + protocol = "http" + } + } + } } -resource "aws_appmesh_virtual_node" "bar" { - name = %[4]q - mesh_name = "${aws_appmesh_mesh.foo.id}" +resource "aws_appmesh_virtual_node" "test" { + count = 2 - spec {} + name = "%[1]s-${count.index}" + mesh_name = "${aws_appmesh_mesh.test.id}" + + spec {} } -`, meshName, vrName, vn1Name, vn2Name) +`, rName) } -func testAccAppmeshRouteConfig_httpRoute(meshName, vrName, vn1Name, vn2Name, rName string) string { - return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` - -resource "aws_appmesh_route" "foo" { +func testAccAwsAppmeshRouteConfig_httpRoute(rName string) string { + return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` +resource "aws_appmesh_route" "test" { name = %[1]q - mesh_name = "${aws_appmesh_mesh.foo.id}" - virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" + mesh_name = "${aws_appmesh_mesh.test.id}" + virtual_router_name = "${aws_appmesh_virtual_router.test.name}" spec { http_route { @@ -376,7 +462,7 @@ resource "aws_appmesh_route" "foo" { action { weighted_target { - virtual_node = "${aws_appmesh_virtual_node.foo.name}" + virtual_node = "${aws_appmesh_virtual_node.test.*.name[0]}" weight = 100 } } @@ -386,13 +472,12 @@ resource "aws_appmesh_route" "foo" { `, rName) } -func testAccAppmeshRouteConfig_httpRouteUpdated(meshName, vrName, vn1Name, vn2Name, rName string) string { - return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` - -resource "aws_appmesh_route" "foo" { +func testAccAwsAppmeshRouteConfig_httpRouteUpdated(rName string) string { + return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` +resource "aws_appmesh_route" "test" { name = %[1]q - mesh_name = "${aws_appmesh_mesh.foo.id}" - virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" + mesh_name = "${aws_appmesh_mesh.test.id}" + virtual_router_name = "${aws_appmesh_virtual_router.test.name}" spec { http_route { @@ -402,12 +487,12 @@ resource "aws_appmesh_route" "foo" { action { weighted_target { - virtual_node = "${aws_appmesh_virtual_node.foo.name}" + virtual_node = "${aws_appmesh_virtual_node.test.*.name[0]}" weight = 90 } weighted_target { - virtual_node = "${aws_appmesh_virtual_node.bar.name}" + virtual_node = "${aws_appmesh_virtual_node.test.*.name[1]}" weight = 10 } } @@ -417,19 +502,71 @@ resource "aws_appmesh_route" "foo" { `, rName) } -func testAccAppmeshRouteConfig_tcpRoute(meshName, vrName, vn1Name, vn2Name, rName string) string { - return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` +func testAccAwsAppmeshRouteConfig_httpHeader(rName string) string { + return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` +resource "aws_appmesh_route" "test" { + name = %[1]q + mesh_name = "${aws_appmesh_mesh.test.id}" + virtual_router_name = "${aws_appmesh_virtual_router.test.name}" + + spec { + http_route { + match { + prefix = "/" + method = "POST" + scheme = "http" + + header { + name = "X-Testing1" + } + } -resource "aws_appmesh_route" "foo" { + action { + weighted_target { + virtual_node = "${aws_appmesh_virtual_node.test.*.name[0]}" + weight = 100 + } + } + } + } +} +`, rName) +} + +func testAccAwsAppmeshRouteConfig_httpHeaderUpdated(rName string) string { + return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` +resource "aws_appmesh_route" "test" { name = %[1]q - mesh_name = "${aws_appmesh_mesh.foo.id}" - virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" + mesh_name = "${aws_appmesh_mesh.test.id}" + virtual_router_name = "${aws_appmesh_virtual_router.test.name}" spec { - tcp_route { + http_route { + match { + prefix = "/path" + method = "PUT" + scheme = "https" + + header { + name = "X-Testing1" + invert = true + } + header { + name = "X-Testing2" + invert = false + + match { + range { + start = 2 + end = 7 + } + } + } + } + action { weighted_target { - virtual_node = "${aws_appmesh_virtual_node.foo.name}" + virtual_node = "${aws_appmesh_virtual_node.test.*.name[0]}" weight = 100 } } @@ -439,24 +576,44 @@ resource "aws_appmesh_route" "foo" { `, rName) } -func testAccAppmeshRouteConfig_tcpRouteUpdated(meshName, vrName, vn1Name, vn2Name, rName string) string { - return testAccAppmeshRouteConfigBase(meshName, vrName, vn1Name, vn2Name) + fmt.Sprintf(` +func testAccAwsAppmeshRouteConfig_tcpRoute(rName string) string { + return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` +resource "aws_appmesh_route" "test" { + name = %[1]q + mesh_name = "${aws_appmesh_mesh.test.id}" + virtual_router_name = "${aws_appmesh_virtual_router.test.name}" + + spec { + tcp_route { + action { + weighted_target { + virtual_node = "${aws_appmesh_virtual_node.test.*.name[0]}" + weight = 100 + } + } + } + } +} +`, rName) +} -resource "aws_appmesh_route" "foo" { +func testAccAwsAppmeshRouteConfig_tcpRouteUpdated(rName string) string { + return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` +resource "aws_appmesh_route" "test" { name = %[1]q - mesh_name = "${aws_appmesh_mesh.foo.id}" - virtual_router_name = "${aws_appmesh_virtual_router.foo.name}" + mesh_name = "${aws_appmesh_mesh.test.id}" + virtual_router_name = "${aws_appmesh_virtual_router.test.name}" spec { tcp_route { action { weighted_target { - virtual_node = "${aws_appmesh_virtual_node.foo.name}" + virtual_node = "${aws_appmesh_virtual_node.test.*.name[0]}" weight = 90 } weighted_target { - virtual_node = "${aws_appmesh_virtual_node.bar.name}" + virtual_node = "${aws_appmesh_virtual_node.test.*.name[1]}" weight = 10 } } diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index d8636004608..42e0a0f8c3f 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -12,8 +12,9 @@ func TestAccAWSAppmesh(t *testing.T) { // "tags": testAccAwsAppmeshMesh_tags, }, "Route": { - "httpRoute": testAccAwsAppmeshRoute_httpRoute, - "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, + "httpHeader": testAccAwsAppmeshRoute_httpHeader, + "httpRoute": testAccAwsAppmeshRoute_httpRoute, + "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, // "tags": testAccAwsAppmeshRoute_tags, }, "VirtualNode": { From 7dc09b62556ff87f612e7a17f242fe3e21ce7a38 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 2 Aug 2019 17:16:55 -0400 Subject: [PATCH 16/23] Include 082019 AppMesh preview channel from 'https://github.com/ewbankkit/aws-sdk-go/tree/appmesh-preview-08-2019'. --- .../aws-sdk-go/service/appmeshpreview/api.go | 136 ++++++++++++++++-- 1 file changed, 127 insertions(+), 9 deletions(-) diff --git a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go index f1b71bdbba0..9c63f2494c5 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go @@ -4995,6 +4995,36 @@ func (s *DnsServiceDiscovery) SetHostname(v string) *DnsServiceDiscovery { return s } +type Duration struct { + _ struct{} `type:"structure"` + + Unit *string `locationName:"unit" type:"string" enum:"DurationUnit"` + + Value *int64 `locationName:"value" type:"long"` +} + +// String returns the string representation +func (s Duration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Duration) GoString() string { + return s.String() +} + +// SetUnit sets the Unit field's value. +func (s *Duration) SetUnit(v string) *Duration { + s.Unit = &v + return s +} + +// SetValue sets the Value field's value. +func (s *Duration) SetValue(v int64) *Duration { + s.Value = &v + return s +} + // An object representing the egress filter rules for a service mesh. type EgressFilter struct { _ struct{} `type:"structure"` @@ -5302,6 +5332,68 @@ func (s *HealthCheckPolicy) SetUnhealthyThreshold(v int64) *HealthCheckPolicy { return s } +type HttpRetryPolicy struct { + _ struct{} `type:"structure"` + + HttpRetryEvents []*string `locationName:"httpRetryEvents" min:"1" type:"list"` + + MaxRetries *int64 `locationName:"maxRetries" type:"long"` + + PerRetryTimeout *Duration `locationName:"perRetryTimeout" type:"structure"` + + TcpRetryEvents []*string `locationName:"tcpRetryEvents" min:"1" type:"list"` +} + +// String returns the string representation +func (s HttpRetryPolicy) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HttpRetryPolicy) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *HttpRetryPolicy) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "HttpRetryPolicy"} + if s.HttpRetryEvents != nil && len(s.HttpRetryEvents) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HttpRetryEvents", 1)) + } + if s.TcpRetryEvents != nil && len(s.TcpRetryEvents) < 1 { + invalidParams.Add(request.NewErrParamMinLen("TcpRetryEvents", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetHttpRetryEvents sets the HttpRetryEvents field's value. +func (s *HttpRetryPolicy) SetHttpRetryEvents(v []*string) *HttpRetryPolicy { + s.HttpRetryEvents = v + return s +} + +// SetMaxRetries sets the MaxRetries field's value. +func (s *HttpRetryPolicy) SetMaxRetries(v int64) *HttpRetryPolicy { + s.MaxRetries = &v + return s +} + +// SetPerRetryTimeout sets the PerRetryTimeout field's value. +func (s *HttpRetryPolicy) SetPerRetryTimeout(v *Duration) *HttpRetryPolicy { + s.PerRetryTimeout = v + return s +} + +// SetTcpRetryEvents sets the TcpRetryEvents field's value. +func (s *HttpRetryPolicy) SetTcpRetryEvents(v []*string) *HttpRetryPolicy { + s.TcpRetryEvents = v + return s +} + // An object representing the HTTP routing specification for a route. type HttpRoute struct { _ struct{} `type:"structure"` @@ -5315,6 +5407,8 @@ type HttpRoute struct { // // Match is a required field Match *HttpRouteMatch `locationName:"match" type:"structure" required:"true"` + + RetryPolicy *HttpRetryPolicy `locationName:"retryPolicy" type:"structure"` } // String returns the string representation @@ -5346,6 +5440,11 @@ func (s *HttpRoute) Validate() error { invalidParams.AddNested("Match", err.(request.ErrInvalidParams)) } } + if s.RetryPolicy != nil { + if err := s.RetryPolicy.Validate(); err != nil { + invalidParams.AddNested("RetryPolicy", err.(request.ErrInvalidParams)) + } + } if invalidParams.Len() > 0 { return invalidParams @@ -5365,6 +5464,12 @@ func (s *HttpRoute) SetMatch(v *HttpRouteMatch) *HttpRoute { return s } +// SetRetryPolicy sets the RetryPolicy field's value. +func (s *HttpRoute) SetRetryPolicy(v *HttpRetryPolicy) *HttpRoute { + s.RetryPolicy = v + return s +} + // An object representing the traffic distribution requirements for matched // HTTP requests. type HttpRouteAction struct { @@ -8670,6 +8775,14 @@ func (s *WeightedTarget) SetWeight(v int64) *WeightedTarget { return s } +const ( + // DurationUnitMs is a DurationUnit enum value + DurationUnitMs = "ms" + + // DurationUnitS is a DurationUnit enum value + DurationUnitS = "s" +) + const ( // EgressFilterTypeAllowAll is a EgressFilterType enum value EgressFilterTypeAllowAll = "ALLOW_ALL" @@ -8680,31 +8793,31 @@ const ( const ( // HttpMethodConnect is a HttpMethod enum value - HttpMethodConnect = "connect" + HttpMethodConnect = "CONNECT" // HttpMethodDelete is a HttpMethod enum value - HttpMethodDelete = "delete" + HttpMethodDelete = "DELETE" // HttpMethodGet is a HttpMethod enum value - HttpMethodGet = "get" + HttpMethodGet = "GET" // HttpMethodHead is a HttpMethod enum value - HttpMethodHead = "head" + HttpMethodHead = "HEAD" // HttpMethodOptions is a HttpMethod enum value - HttpMethodOptions = "options" + HttpMethodOptions = "OPTIONS" // HttpMethodPatch is a HttpMethod enum value - HttpMethodPatch = "patch" + HttpMethodPatch = "PATCH" // HttpMethodPost is a HttpMethod enum value - HttpMethodPost = "post" + HttpMethodPost = "POST" // HttpMethodPut is a HttpMethod enum value - HttpMethodPut = "put" + HttpMethodPut = "PUT" // HttpMethodTrace is a HttpMethod enum value - HttpMethodTrace = "trace" + HttpMethodTrace = "TRACE" ) const ( @@ -8745,6 +8858,11 @@ const ( RouteStatusCodeInactive = "INACTIVE" ) +const ( + // TcpRetryPolicyEventConnectionError is a TcpRetryPolicyEvent enum value + TcpRetryPolicyEventConnectionError = "connection-error" +) + const ( // VirtualNodeStatusCodeActive is a VirtualNodeStatusCode enum value VirtualNodeStatusCodeActive = "ACTIVE" From f5baa08017bd1fb869008a12ad8774a7e91f4e4d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 2 Aug 2019 17:27:06 -0400 Subject: [PATCH 17/23] Use SDK-provided constants for HTTP method names. --- aws/resource_aws_appmesh_route.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index 8235777cec3..32086c33c01 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -177,15 +177,15 @@ func resourceAwsAppmeshRoute() *schema.Resource { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - "CONNECT", - "DELETE", - "GET", - "HEAD", - "OPTIONS", - "PATCH", - "POST", - "PUT", - "TRACE", + appmesh.HttpMethodConnect, + appmesh.HttpMethodDelete, + appmesh.HttpMethodGet, + appmesh.HttpMethodHead, + appmesh.HttpMethodOptions, + appmesh.HttpMethodPatch, + appmesh.HttpMethodPost, + appmesh.HttpMethodPut, + appmesh.HttpMethodTrace, }, false), }, From 14a78aa9cb5bcbba5219030877320fbdafd137e4 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sat, 3 Aug 2019 18:42:53 -0400 Subject: [PATCH 18/23] r/aws_appmesh_route: Initial support for retry policy. --- aws/resource_aws_appmesh_route.go | 113 +++++++++++++++++++++ aws/resource_aws_appmesh_route_test.go | 4 + website/docs/r/appmesh_route.html.markdown | 15 +++ 3 files changed, 132 insertions(+) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index 32086c33c01..88c0fed1bee 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -206,6 +206,65 @@ func resourceAwsAppmeshRoute() *schema.Resource { }, }, }, + + "retry_policy": { + Type: schema.TypeList, + Optional: true, + MinItems: 0, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "http_retry_events": { + Type: schema.TypeSet, + Optional: true, + MinItems: 0, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + }, + + "max_retries": { + Type: schema.TypeInt, + Optional: true, + Default: 1, + }, + + // TODO The API default is 15000ms, but that cannot currently be expressed via 'Default:'. + // TODO The API always returns results as ms. Should the attribute be 'per_retry_timeout_millis'? + // TODO See https://github.com/aws/aws-app-mesh-roadmap/issues/7#issuecomment-518041427. + "per_retry_timeout": { + Type: schema.TypeList, + Optional: true, + MinItems: 0, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "unit": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + appmesh.DurationUnitMs, + appmesh.DurationUnitS, + }, false), + }, + + "value": { + Type: schema.TypeInt, + Required: true, + }, + }, + }, + }, + + "tcp_retry_events": { + Type: schema.TypeSet, + Optional: true, + MinItems: 0, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + }, + }, + }, + }, }, }, }, @@ -537,6 +596,41 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { spec.HttpRoute.Match = httpRouteMatch } + + if vHttpRetryPolicy, ok := mHttpRoute["retry_policy"].([]interface{}); ok && len(vHttpRetryPolicy) > 0 && vHttpRetryPolicy[0] != nil { + httpRetryPolicy := &appmesh.HttpRetryPolicy{} + + mHttpRetryPolicy := vHttpRetryPolicy[0].(map[string]interface{}) + + if vMaxRetries, ok := mHttpRetryPolicy["max_retries"].(int); ok && vMaxRetries > 0 { + httpRetryPolicy.MaxRetries = aws.Int64(int64(vMaxRetries)) + } + + if vHttpRetryEvents, ok := mHttpRetryPolicy["http_retry_events"].(*schema.Set); ok && vHttpRetryEvents.Len() > 0 { + httpRetryPolicy.HttpRetryEvents = expandStringSet(vHttpRetryEvents) + } + + if vPerRetryTimeout, ok := mHttpRetryPolicy["per_retry_timeout"].([]interface{}); ok && len(vPerRetryTimeout) > 0 && vPerRetryTimeout[0] != nil { + perRetryTimeout := &appmesh.Duration{} + + mPerRetryTimeout := vPerRetryTimeout[0].(map[string]interface{}) + + if vUnit, ok := mPerRetryTimeout["unit"].(string); ok && vUnit != "" { + perRetryTimeout.Unit = aws.String(vUnit) + } + if vValue, ok := mPerRetryTimeout["value"].(int); ok && vValue > 0 { + perRetryTimeout.Value = aws.Int64(int64(vValue)) + } + + httpRetryPolicy.PerRetryTimeout = perRetryTimeout + } + + if vTcpRetryEvents, ok := mHttpRetryPolicy["tcp_retry_events"].(*schema.Set); ok && vTcpRetryEvents.Len() > 0 { + httpRetryPolicy.TcpRetryEvents = expandStringSet(vTcpRetryEvents) + } + + spec.HttpRoute.RetryPolicy = httpRetryPolicy + } } if vTcpRoute, ok := mSpec["tcp_route"].([]interface{}); ok && len(vTcpRoute) > 0 && vTcpRoute[0] != nil { @@ -648,6 +742,25 @@ func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { } } + if httpRetryPolicy := httpRoute.RetryPolicy; httpRetryPolicy != nil { + mHttpRetryPolicy := map[string]interface{}{ + "http_retry_events": flattenStringSet(httpRetryPolicy.HttpRetryEvents), + "max_retries": int(aws.Int64Value(httpRetryPolicy.MaxRetries)), + "tcp_retry_events": flattenStringSet(httpRetryPolicy.TcpRetryEvents), + } + + if perRetryTimeout := httpRetryPolicy.PerRetryTimeout; perRetryTimeout != nil { + mPerRetryTimeout := map[string]interface{}{ + "unit": aws.StringValue(perRetryTimeout.Unit), + "value": int(aws.Int64Value(perRetryTimeout.Value)), + } + + mHttpRetryPolicy["per_retry_timeout"] = []interface{}{mPerRetryTimeout} + } + + mHttpRoute["retry_policy"] = []interface{}{mHttpRetryPolicy} + } + mSpec["http_route"] = []interface{}{mHttpRoute} } diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index c91dfc92459..564848f4bc4 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -125,6 +125,7 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", ""), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), @@ -147,6 +148,7 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", ""), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/path"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), @@ -192,6 +194,7 @@ func testAccAwsAppmeshRoute_httpHeader(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", "POST"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", "http"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), @@ -227,6 +230,7 @@ func testAccAwsAppmeshRoute_httpHeader(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", "PUT"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/path"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", "https"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), diff --git a/website/docs/r/appmesh_route.html.markdown b/website/docs/r/appmesh_route.html.markdown index fd4293e5c29..7bb8a0c46b0 100644 --- a/website/docs/r/appmesh_route.html.markdown +++ b/website/docs/r/appmesh_route.html.markdown @@ -82,6 +82,7 @@ The `http_route` object supports the following: * `action` - (Required) The action to take if a match is determined. * `match` - (Required) The criteria for determining an HTTP request match. +* `retry_policy` - (Optional) The retry policy. The `tcp_route` object supports the following: @@ -100,6 +101,20 @@ This parameter must always start with /, which by itself matches all requests to * `method` - (Optional) The HTTP method with which to match requests. Valid values: `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `CONNECT`, `OPTIONS`, `TRACE`, `PATCH`. * `scheme` - (Optional) The URL scheme with which to match requests. Valid values: `HTTP`, `HTTPS`. +The `retry_policy` object supports the following: + +* `http_retry_events` - (Optional) List of HTTP retry events. +* `max_retries` - (Optional) The maximum number of retries. Default is `1`. +* `per_retry_timeout` - (Optional) The per-retry timeout. Default is `15s`. +* `tcp_retry_events` - (Optional) List of TCP retry events. The only valid value is `connection-error`. + +You must specify at least one value for `http_retry_events`, or at least one value for `tcp_retry_events`. + +The `per_retry_timeout` object supports the following: + +* `unit` - (Required) Retry unit. Valid values: `ms`, `s`. +* `value` - (Required) Retry value. + The `weighted_target` object supports the following: * `virtual_node` - (Required) The virtual node to associate with the weighted target. From c9c10f7750eeb163bc11b23c60854852e4e18614 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 9 Aug 2019 16:49:23 -0400 Subject: [PATCH 19/23] 'per_retry_timeout' -> 'per_retry_timeout_millis' until the API correctly roundtrips. --- aws/resource_aws_appmesh_route.go | 55 ++++------------------ website/docs/r/appmesh_route.html.markdown | 1 + 2 files changed, 11 insertions(+), 45 deletions(-) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index 88c0fed1bee..5faa44f0aac 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -228,31 +228,10 @@ func resourceAwsAppmeshRoute() *schema.Resource { Default: 1, }, - // TODO The API default is 15000ms, but that cannot currently be expressed via 'Default:'. - // TODO The API always returns results as ms. Should the attribute be 'per_retry_timeout_millis'? - // TODO See https://github.com/aws/aws-app-mesh-roadmap/issues/7#issuecomment-518041427. - "per_retry_timeout": { - Type: schema.TypeList, + "per_retry_timeout_millis": { + Type: schema.TypeInt, Optional: true, - MinItems: 0, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "unit": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - appmesh.DurationUnitMs, - appmesh.DurationUnitS, - }, false), - }, - - "value": { - Type: schema.TypeInt, - Required: true, - }, - }, - }, + Default: 15000, }, "tcp_retry_events": { @@ -605,26 +584,17 @@ func expandAppmeshRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { if vMaxRetries, ok := mHttpRetryPolicy["max_retries"].(int); ok && vMaxRetries > 0 { httpRetryPolicy.MaxRetries = aws.Int64(int64(vMaxRetries)) } + if vPerRetryTimeoutMillis, ok := mHttpRetryPolicy["per_retry_timeout_millis"].(int); ok && vPerRetryTimeoutMillis > 0 { + httpRetryPolicy.PerRetryTimeout = &appmesh.Duration{ + Unit: aws.String(appmesh.DurationUnitMs), + Value: aws.Int64(int64(vPerRetryTimeoutMillis)), + } + } if vHttpRetryEvents, ok := mHttpRetryPolicy["http_retry_events"].(*schema.Set); ok && vHttpRetryEvents.Len() > 0 { httpRetryPolicy.HttpRetryEvents = expandStringSet(vHttpRetryEvents) } - if vPerRetryTimeout, ok := mHttpRetryPolicy["per_retry_timeout"].([]interface{}); ok && len(vPerRetryTimeout) > 0 && vPerRetryTimeout[0] != nil { - perRetryTimeout := &appmesh.Duration{} - - mPerRetryTimeout := vPerRetryTimeout[0].(map[string]interface{}) - - if vUnit, ok := mPerRetryTimeout["unit"].(string); ok && vUnit != "" { - perRetryTimeout.Unit = aws.String(vUnit) - } - if vValue, ok := mPerRetryTimeout["value"].(int); ok && vValue > 0 { - perRetryTimeout.Value = aws.Int64(int64(vValue)) - } - - httpRetryPolicy.PerRetryTimeout = perRetryTimeout - } - if vTcpRetryEvents, ok := mHttpRetryPolicy["tcp_retry_events"].(*schema.Set); ok && vTcpRetryEvents.Len() > 0 { httpRetryPolicy.TcpRetryEvents = expandStringSet(vTcpRetryEvents) } @@ -750,12 +720,7 @@ func flattenAppmeshRouteSpec(spec *appmesh.RouteSpec) []interface{} { } if perRetryTimeout := httpRetryPolicy.PerRetryTimeout; perRetryTimeout != nil { - mPerRetryTimeout := map[string]interface{}{ - "unit": aws.StringValue(perRetryTimeout.Unit), - "value": int(aws.Int64Value(perRetryTimeout.Value)), - } - - mHttpRetryPolicy["per_retry_timeout"] = []interface{}{mPerRetryTimeout} + mHttpRetryPolicy["per_retry_timeout_millis"] = int(aws.Int64Value(perRetryTimeout.Value)) } mHttpRoute["retry_policy"] = []interface{}{mHttpRetryPolicy} diff --git a/website/docs/r/appmesh_route.html.markdown b/website/docs/r/appmesh_route.html.markdown index 7bb8a0c46b0..f9b85dd3e10 100644 --- a/website/docs/r/appmesh_route.html.markdown +++ b/website/docs/r/appmesh_route.html.markdown @@ -105,6 +105,7 @@ The `retry_policy` object supports the following: * `http_retry_events` - (Optional) List of HTTP retry events. * `max_retries` - (Optional) The maximum number of retries. Default is `1`. +* `per_retry_timeout_millis` - (Optional) The per-retry timeout in milliseconds. Default is `15000`. * `per_retry_timeout` - (Optional) The per-retry timeout. Default is `15s`. * `tcp_retry_events` - (Optional) List of TCP retry events. The only valid value is `connection-error`. From cf4b1f5d05e7a43129635b7f5618eb3cdefe5bc9 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 9 Aug 2019 16:50:02 -0400 Subject: [PATCH 20/23] r/aws_appmesh_route: Acceptance tests for retry policy. --- aws/resource_aws_appmesh_route_test.go | 148 +++++++++++++++++++++++++ aws/resource_aws_appmesh_test.go | 7 +- 2 files changed, 152 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index 564848f4bc4..050b5733f41 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -247,6 +247,84 @@ func testAccAwsAppmeshRoute_httpHeader(t *testing.T) { }) } +func testAccAwsAppmeshRoute_httpRetryPolicy(t *testing.T) { + var r appmesh.RouteData + resourceName := "aws_appmesh_route.test" + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsAppmeshRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsAppmeshRouteConfig_httpRetryPolicy(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAppmeshRouteExists(resourceName, &r), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.0.weighted_target.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.http_retry_events.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.http_retry_events.3149296306", "server-error"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.max_retries", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.per_retry_timeout_millis", "15000"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.tcp_retry_events.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + ), + }, + { + Config: testAccAwsAppmeshRouteConfig_httpRetryPolicyUpdated(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsAppmeshRouteExists(resourceName, &r), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.0.weighted_target.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.header.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.method", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.prefix", "/"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", ""), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.http_retry_events.#", "2"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.http_retry_events.1737003747", "gateway-error"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.http_retry_events.3092941836", "client-error"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.max_retries", "3"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.per_retry_timeout_millis", "25000"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.tcp_retry_events.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.tcp_retry_events.3724400910", "connection-error"), + resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + ), + }, + { + ResourceName: resourceName, + ImportStateIdFunc: testAccAwsAppmeshRouteImportStateIdFunc(resourceName), + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { var r appmesh.RouteData resourceName := "aws_appmesh_route.test" @@ -580,6 +658,76 @@ resource "aws_appmesh_route" "test" { `, rName) } +func testAccAwsAppmeshRouteConfig_httpRetryPolicy(rName string) string { + return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` +resource "aws_appmesh_route" "test" { + name = %[1]q + mesh_name = "${aws_appmesh_mesh.test.id}" + virtual_router_name = "${aws_appmesh_virtual_router.test.name}" + + spec { + http_route { + match { + prefix = "/" + } + + retry_policy { + http_retry_events = [ + "server-error", + ] + } + + action { + weighted_target { + virtual_node = "${aws_appmesh_virtual_node.test.*.name[0]}" + weight = 100 + } + } + } + } +} +`, rName) +} + +func testAccAwsAppmeshRouteConfig_httpRetryPolicyUpdated(rName string) string { + return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` +resource "aws_appmesh_route" "test" { + name = %[1]q + mesh_name = "${aws_appmesh_mesh.test.id}" + virtual_router_name = "${aws_appmesh_virtual_router.test.name}" + + spec { + http_route { + match { + prefix = "/" + } + + retry_policy { + http_retry_events = [ + "client-error", + "gateway-error", + ] + + max_retries = 3 + per_retry_timeout_millis = 25000 + + tcp_retry_events = [ + "connection-error", + ] + } + + action { + weighted_target { + virtual_node = "${aws_appmesh_virtual_node.test.*.name[0]}" + weight = 100 + } + } + } + } +} +`, rName) +} + func testAccAwsAppmeshRouteConfig_tcpRoute(rName string) string { return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index 42e0a0f8c3f..325929669a6 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -12,9 +12,10 @@ func TestAccAWSAppmesh(t *testing.T) { // "tags": testAccAwsAppmeshMesh_tags, }, "Route": { - "httpHeader": testAccAwsAppmeshRoute_httpHeader, - "httpRoute": testAccAwsAppmeshRoute_httpRoute, - "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, + "httpHeader": testAccAwsAppmeshRoute_httpHeader, + "httpRetryPolicy": testAccAwsAppmeshRoute_httpRetryPolicy, + "httpRoute": testAccAwsAppmeshRoute_httpRoute, + "tcpRoute": testAccAwsAppmeshRoute_tcpRoute, // "tags": testAccAwsAppmeshRoute_tags, }, "VirtualNode": { From 085f67e800758c5062ef165d7add0178cc12973a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 9 Aug 2019 17:29:01 -0400 Subject: [PATCH 21/23] Update 082019 AppMesh preview channel from 'https://github.com/ewbankkit/aws-sdk-go/tree/appmesh-preview-08-2019'. --- .../aws-sdk-go/service/appmeshpreview/api.go | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) diff --git a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go index 9c63f2494c5..d78ec8812d7 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/appmeshpreview/api.go @@ -6326,6 +6326,8 @@ type Listener struct { // // PortMapping is a required field PortMapping *PortMapping `locationName:"portMapping" type:"structure" required:"true"` + + Tls *ListenerTls `locationName:"tls" type:"structure"` } // String returns the string representation @@ -6354,6 +6356,11 @@ func (s *Listener) Validate() error { invalidParams.AddNested("PortMapping", err.(request.ErrInvalidParams)) } } + if s.Tls != nil { + if err := s.Tls.Validate(); err != nil { + invalidParams.AddNested("Tls", err.(request.ErrInvalidParams)) + } + } if invalidParams.Len() > 0 { return invalidParams @@ -6373,6 +6380,138 @@ func (s *Listener) SetPortMapping(v *PortMapping) *Listener { return s } +// SetTls sets the Tls field's value. +func (s *Listener) SetTls(v *ListenerTls) *Listener { + s.Tls = v + return s +} + +type ListenerTls struct { + _ struct{} `type:"structure"` + + // Certificate is a required field + Certificate *ListenerTlsCertificate `locationName:"certificate" type:"structure" required:"true"` + + // Mode is a required field + Mode *string `locationName:"mode" type:"string" required:"true" enum:"ListenerTlsMode"` +} + +// String returns the string representation +func (s ListenerTls) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListenerTls) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListenerTls) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListenerTls"} + if s.Certificate == nil { + invalidParams.Add(request.NewErrParamRequired("Certificate")) + } + if s.Mode == nil { + invalidParams.Add(request.NewErrParamRequired("Mode")) + } + if s.Certificate != nil { + if err := s.Certificate.Validate(); err != nil { + invalidParams.AddNested("Certificate", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCertificate sets the Certificate field's value. +func (s *ListenerTls) SetCertificate(v *ListenerTlsCertificate) *ListenerTls { + s.Certificate = v + return s +} + +// SetMode sets the Mode field's value. +func (s *ListenerTls) SetMode(v string) *ListenerTls { + s.Mode = &v + return s +} + +type ListenerTlsAcmCertificate struct { + _ struct{} `type:"structure"` + + // CertificateArn is a required field + CertificateArn *string `locationName:"certificateArn" type:"string" required:"true"` +} + +// String returns the string representation +func (s ListenerTlsAcmCertificate) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListenerTlsAcmCertificate) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListenerTlsAcmCertificate) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListenerTlsAcmCertificate"} + if s.CertificateArn == nil { + invalidParams.Add(request.NewErrParamRequired("CertificateArn")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetCertificateArn sets the CertificateArn field's value. +func (s *ListenerTlsAcmCertificate) SetCertificateArn(v string) *ListenerTlsAcmCertificate { + s.CertificateArn = &v + return s +} + +type ListenerTlsCertificate struct { + _ struct{} `type:"structure"` + + Acm *ListenerTlsAcmCertificate `locationName:"acm" type:"structure"` +} + +// String returns the string representation +func (s ListenerTlsCertificate) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListenerTlsCertificate) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ListenerTlsCertificate) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ListenerTlsCertificate"} + if s.Acm != nil { + if err := s.Acm.Validate(); err != nil { + invalidParams.AddNested("Acm", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAcm sets the Acm field's value. +func (s *ListenerTlsCertificate) SetAcm(v *ListenerTlsAcmCertificate) *ListenerTlsCertificate { + s.Acm = v + return s +} + // An object representing the logging information for a virtual node. type Logging struct { _ struct{} `type:"structure"` @@ -8828,6 +8967,17 @@ const ( HttpSchemeHttps = "https" ) +const ( + // ListenerTlsModeDisabled is a ListenerTlsMode enum value + ListenerTlsModeDisabled = "DISABLED" + + // ListenerTlsModePermissive is a ListenerTlsMode enum value + ListenerTlsModePermissive = "PERMISSIVE" + + // ListenerTlsModeStrict is a ListenerTlsMode enum value + ListenerTlsModeStrict = "STRICT" +) + const ( // MeshStatusCodeActive is a MeshStatusCode enum value MeshStatusCodeActive = "ACTIVE" From 004331f7b7487cde7edb4e9dbd3743cea98440da Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 9 Aug 2019 17:58:33 -0400 Subject: [PATCH 22/23] Attributes in alphabetical order. --- aws/resource_aws_appmesh_route.go | 68 +++++++++---------- aws/resource_aws_appmesh_virtual_node.go | 86 ++++++++++++------------ 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/aws/resource_aws_appmesh_route.go b/aws/resource_aws_appmesh_route.go index 5faa44f0aac..d19d9074c9b 100644 --- a/aws/resource_aws_appmesh_route.go +++ b/aws/resource_aws_appmesh_route.go @@ -26,11 +26,19 @@ func resourceAwsAppmeshRoute() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringLenBetween(1, 255), + "arn": { + Type: schema.TypeString, + Computed: true, + }, + + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + + "last_updated_date": { + Type: schema.TypeString, + Computed: true, }, "mesh_name": { @@ -40,7 +48,7 @@ func resourceAwsAppmeshRoute() *schema.Resource { ValidateFunc: validation.StringLenBetween(1, 255), }, - "virtual_router_name": { + "name": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -295,22 +303,14 @@ func resourceAwsAppmeshRoute() *schema.Resource { }, }, - "arn": { - Type: schema.TypeString, - Computed: true, - }, - - "created_date": { - Type: schema.TypeString, - Computed: true, - }, + "tags": tagsSchema(), - "last_updated_date": { - Type: schema.TypeString, - Computed: true, + "virtual_router_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 255), }, - - "tags": tagsSchema(), }, } } @@ -319,14 +319,14 @@ func resourceAwsAppmeshRouteCreate(d *schema.ResourceData, meta interface{}) err conn := meta.(*AWSClient).appmeshpreviewconn req := &appmesh.CreateRouteInput{ - MeshName: aws.String(d.Get("mesh_name").(string)), - RouteName: aws.String(d.Get("name").(string)), - VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), - Spec: expandAppmeshRouteSpec(d.Get("spec").([]interface{})), + MeshName: aws.String(d.Get("mesh_name").(string)), + RouteName: aws.String(d.Get("name").(string)), + Spec: expandAppmeshRouteSpec(d.Get("spec").([]interface{})), // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), } - log.Printf("[DEBUG] Creating App Mesh route: %#v", req) + log.Printf("[DEBUG] Creating App Mesh route: %s", req) resp, err := conn.CreateRoute(req) if err != nil { return fmt.Errorf("error creating App Mesh route: %s", err) @@ -351,7 +351,7 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error return nil } if err != nil { - return fmt.Errorf("error reading App Mesh route: %s", err) + return fmt.Errorf("error reading App Mesh route (%s): %s", d.Id(), err) } if aws.StringValue(resp.Route.Status.Status) == appmesh.RouteStatusCodeDeleted { log.Printf("[WARN] App Mesh route (%s) not found, removing from state", d.Id()) @@ -359,16 +359,16 @@ func resourceAwsAppmeshRouteRead(d *schema.ResourceData, meta interface{}) error return nil } - d.Set("name", resp.Route.RouteName) - d.Set("mesh_name", resp.Route.MeshName) - d.Set("virtual_router_name", resp.Route.VirtualRouterName) d.Set("arn", resp.Route.Metadata.Arn) d.Set("created_date", resp.Route.Metadata.CreatedAt.Format(time.RFC3339)) d.Set("last_updated_date", resp.Route.Metadata.LastUpdatedAt.Format(time.RFC3339)) + d.Set("mesh_name", resp.Route.MeshName) + d.Set("name", resp.Route.RouteName) err = d.Set("spec", flattenAppmeshRouteSpec(resp.Route.Spec)) if err != nil { return fmt.Errorf("error setting spec: %s", err) } + d.Set("virtual_router_name", resp.Route.VirtualRouterName) // err = saveTagsAppmesh(conn, d, aws.StringValue(resp.Route.Metadata.Arn)) // if isAWSErr(err, appmesh.ErrCodeNotFoundException, "") { @@ -391,14 +391,14 @@ func resourceAwsAppmeshRouteUpdate(d *schema.ResourceData, meta interface{}) err req := &appmesh.UpdateRouteInput{ MeshName: aws.String(d.Get("mesh_name").(string)), RouteName: aws.String(d.Get("name").(string)), - VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), Spec: expandAppmeshRouteSpec(v.([]interface{})), + VirtualRouterName: aws.String(d.Get("virtual_router_name").(string)), } - log.Printf("[DEBUG] Updating App Mesh route: %#v", req) + log.Printf("[DEBUG] Updating App Mesh route: %s", req) _, err := conn.UpdateRoute(req) if err != nil { - return fmt.Errorf("error updating App Mesh route: %s", err) + return fmt.Errorf("error updating App Mesh route (%s): %s", d.Id(), err) } } @@ -428,7 +428,7 @@ func resourceAwsAppmeshRouteDelete(d *schema.ResourceData, meta interface{}) err return nil } if err != nil { - return fmt.Errorf("error deleting App Mesh route: %s", err) + return fmt.Errorf("error deleting App Mesh route (%s): %s", d.Id(), err) } return nil @@ -457,8 +457,8 @@ func resourceAwsAppmeshRouteImport(d *schema.ResourceData, meta interface{}) ([] } d.SetId(aws.StringValue(resp.Route.Metadata.Uid)) - d.Set("name", resp.Route.RouteName) d.Set("mesh_name", resp.Route.MeshName) + d.Set("name", resp.Route.RouteName) d.Set("virtual_router_name", resp.Route.VirtualRouterName) return []*schema.ResourceData{d}, nil diff --git a/aws/resource_aws_appmesh_virtual_node.go b/aws/resource_aws_appmesh_virtual_node.go index 3749f63c2bf..2ec61fca962 100644 --- a/aws/resource_aws_appmesh_virtual_node.go +++ b/aws/resource_aws_appmesh_virtual_node.go @@ -28,14 +28,29 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { MigrateState: resourceAwsAppmeshVirtualNodeMigrateState, Schema: map[string]*schema.Schema{ - "name": { + "arn": { + Type: schema.TypeString, + Computed: true, + }, + + "created_date": { + Type: schema.TypeString, + Computed: true, + }, + + "last_updated_date": { + Type: schema.TypeString, + Computed: true, + }, + + "mesh_name": { Type: schema.TypeString, Required: true, ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "mesh_name": { + "name": { Type: schema.TypeString, Required: true, ForceNew: true, @@ -49,14 +64,6 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "backends": { - Type: schema.TypeSet, - Removed: "Use `backend` configuration blocks instead", - Optional: true, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - }, - "backend": { Type: schema.TypeSet, Optional: true, @@ -84,6 +91,14 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { Set: appmeshBackendHash, }, + "backends": { + Type: schema.TypeSet, + Removed: "Use `backend` configuration blocks instead", + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "listener": { Type: schema.TypeSet, Optional: true, @@ -254,18 +269,18 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { ConflictsWith: []string{"spec.0.service_discovery.0.aws_cloud_map"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "hostname": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.NoZeroValues, + }, + "service_name": { Type: schema.TypeString, Removed: "Use `hostname` argument instead", Optional: true, Computed: true, }, - - "hostname": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.NoZeroValues, - }, }, }, }, @@ -276,21 +291,6 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { }, }, - "arn": { - Type: schema.TypeString, - Computed: true, - }, - - "created_date": { - Type: schema.TypeString, - Computed: true, - }, - - "last_updated_date": { - Type: schema.TypeString, - Computed: true, - }, - "tags": tagsSchema(), }, } @@ -300,13 +300,13 @@ func resourceAwsAppmeshVirtualNodeCreate(d *schema.ResourceData, meta interface{ conn := meta.(*AWSClient).appmeshpreviewconn req := &appmesh.CreateVirtualNodeInput{ - MeshName: aws.String(d.Get("mesh_name").(string)), - VirtualNodeName: aws.String(d.Get("name").(string)), - Spec: expandAppmeshVirtualNodeSpec(d.Get("spec").([]interface{})), + MeshName: aws.String(d.Get("mesh_name").(string)), + Spec: expandAppmeshVirtualNodeSpec(d.Get("spec").([]interface{})), // Tags: tagsFromMapAppmesh(d.Get("tags").(map[string]interface{})), + VirtualNodeName: aws.String(d.Get("name").(string)), } - log.Printf("[DEBUG] Creating App Mesh virtual node: %#v", req) + log.Printf("[DEBUG] Creating App Mesh virtual node: %s", req) resp, err := conn.CreateVirtualNode(req) if err != nil { return fmt.Errorf("error creating App Mesh virtual node: %s", err) @@ -330,7 +330,7 @@ func resourceAwsAppmeshVirtualNodeRead(d *schema.ResourceData, meta interface{}) return nil } if err != nil { - return fmt.Errorf("error reading App Mesh virtual node: %s", err) + return fmt.Errorf("error reading App Mesh virtual node (%s): %s", d.Id(), err) } if aws.StringValue(resp.VirtualNode.Status.Status) == appmesh.VirtualNodeStatusCodeDeleted { log.Printf("[WARN] App Mesh virtual node (%s) not found, removing from state", d.Id()) @@ -338,11 +338,11 @@ func resourceAwsAppmeshVirtualNodeRead(d *schema.ResourceData, meta interface{}) return nil } - d.Set("name", resp.VirtualNode.VirtualNodeName) - d.Set("mesh_name", resp.VirtualNode.MeshName) d.Set("arn", resp.VirtualNode.Metadata.Arn) d.Set("created_date", resp.VirtualNode.Metadata.CreatedAt.Format(time.RFC3339)) d.Set("last_updated_date", resp.VirtualNode.Metadata.LastUpdatedAt.Format(time.RFC3339)) + d.Set("mesh_name", resp.VirtualNode.MeshName) + d.Set("name", resp.VirtualNode.VirtualNodeName) err = d.Set("spec", flattenAppmeshVirtualNodeSpec(resp.VirtualNode.Spec)) if err != nil { return fmt.Errorf("error setting spec: %s", err) @@ -368,14 +368,14 @@ func resourceAwsAppmeshVirtualNodeUpdate(d *schema.ResourceData, meta interface{ _, v := d.GetChange("spec") req := &appmesh.UpdateVirtualNodeInput{ MeshName: aws.String(d.Get("mesh_name").(string)), - VirtualNodeName: aws.String(d.Get("name").(string)), Spec: expandAppmeshVirtualNodeSpec(v.([]interface{})), + VirtualNodeName: aws.String(d.Get("name").(string)), } - log.Printf("[DEBUG] Updating App Mesh virtual node: %#v", req) + log.Printf("[DEBUG] Updating App Mesh virtual node: %s", req) _, err := conn.UpdateVirtualNode(req) if err != nil { - return fmt.Errorf("error updating App Mesh virtual node: %s", err) + return fmt.Errorf("error updating App Mesh virtual node (%s): %s", d.Id(), err) } } @@ -404,7 +404,7 @@ func resourceAwsAppmeshVirtualNodeDelete(d *schema.ResourceData, meta interface{ return nil } if err != nil { - return fmt.Errorf("error deleting App Mesh virtual node: %s", err) + return fmt.Errorf("error deleting App Mesh virtual node (%s): %s", d.Id(), err) } return nil @@ -431,8 +431,8 @@ func resourceAwsAppmeshVirtualNodeImport(d *schema.ResourceData, meta interface{ } d.SetId(aws.StringValue(resp.VirtualNode.Metadata.Uid)) - d.Set("name", resp.VirtualNode.VirtualNodeName) d.Set("mesh_name", resp.VirtualNode.MeshName) + d.Set("name", resp.VirtualNode.VirtualNodeName) return []*schema.ResourceData{d}, nil } From 8e9c08188567e0d154d2b61331844bf27f3c8ff8 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 9 Aug 2019 19:39:51 -0400 Subject: [PATCH 23/23] r/aws_appmesh_virtual_node: Initial support for end-to-end encryption. --- aws/resource_aws_appmesh_route_test.go | 86 ++--- aws/resource_aws_appmesh_test.go | 1 + aws/resource_aws_appmesh_virtual_node.go | 242 +++++++++---- aws/resource_aws_appmesh_virtual_node_test.go | 317 ++++++++++++++---- .../docs/r/appmesh_virtual_node.html.markdown | 14 + 5 files changed, 502 insertions(+), 158 deletions(-) diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index 050b5733f41..a091e3be136 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -113,9 +113,11 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { Config: testAccAwsAppmeshRouteConfig_httpRoute(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), @@ -127,18 +129,19 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", ""), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "created_date"), - resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), ), }, { Config: testAccAwsAppmeshRouteConfig_httpRouteUpdated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), @@ -150,9 +153,8 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", ""), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "created_date"), - resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), ), }, { @@ -179,9 +181,11 @@ func testAccAwsAppmeshRoute_httpHeader(t *testing.T) { Config: testAccAwsAppmeshRouteConfig_httpHeader(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), @@ -196,18 +200,19 @@ func testAccAwsAppmeshRoute_httpHeader(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", "http"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "created_date"), - resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), ), }, { Config: testAccAwsAppmeshRouteConfig_httpHeaderUpdated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), @@ -232,9 +237,8 @@ func testAccAwsAppmeshRoute_httpHeader(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.match.0.scheme", "https"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "created_date"), - resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), ), }, { @@ -261,9 +265,11 @@ func testAccAwsAppmeshRoute_httpRetryPolicy(t *testing.T) { Config: testAccAwsAppmeshRouteConfig_httpRetryPolicy(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), @@ -280,18 +286,19 @@ func testAccAwsAppmeshRoute_httpRetryPolicy(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.per_retry_timeout_millis", "15000"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.tcp_retry_events.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "created_date"), - resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), ), }, { Config: testAccAwsAppmeshRouteConfig_httpRetryPolicyUpdated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsAppmeshRouteExists(resourceName, &r), - resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), - resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.action.#", "1"), @@ -310,9 +317,8 @@ func testAccAwsAppmeshRoute_httpRetryPolicy(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.tcp_retry_events.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.http_route.0.retry_policy.0.tcp_retry_events.3724400910", "connection-error"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "created_date"), - resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "virtual_router_name", rName), ), }, { @@ -347,6 +353,7 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.0.weighted_target.#", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), @@ -364,6 +371,7 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.tcp_route.0.action.0.weighted_target.#", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualRouter/%s/route/%s", rName, rName, rName)), @@ -498,7 +506,7 @@ func testAccAwsAppmeshRouteImportStateIdFunc(resourceName string) resource.Impor } } -func testAccAwsAppmeshRouteConfigBase(rName string) string { +func testAccAwsAppmeshRouteConfig_base(rName string) string { return fmt.Sprintf(` resource "aws_appmesh_mesh" "test" { name = %[1]q @@ -530,7 +538,7 @@ resource "aws_appmesh_virtual_node" "test" { } func testAccAwsAppmeshRouteConfig_httpRoute(rName string) string { - return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` + return testAccAwsAppmeshRouteConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -555,7 +563,7 @@ resource "aws_appmesh_route" "test" { } func testAccAwsAppmeshRouteConfig_httpRouteUpdated(rName string) string { - return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` + return testAccAwsAppmeshRouteConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -585,7 +593,7 @@ resource "aws_appmesh_route" "test" { } func testAccAwsAppmeshRouteConfig_httpHeader(rName string) string { - return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` + return testAccAwsAppmeshRouteConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -616,7 +624,7 @@ resource "aws_appmesh_route" "test" { } func testAccAwsAppmeshRouteConfig_httpHeaderUpdated(rName string) string { - return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` + return testAccAwsAppmeshRouteConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -659,7 +667,7 @@ resource "aws_appmesh_route" "test" { } func testAccAwsAppmeshRouteConfig_httpRetryPolicy(rName string) string { - return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` + return testAccAwsAppmeshRouteConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -690,7 +698,7 @@ resource "aws_appmesh_route" "test" { } func testAccAwsAppmeshRouteConfig_httpRetryPolicyUpdated(rName string) string { - return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` + return testAccAwsAppmeshRouteConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -729,7 +737,7 @@ resource "aws_appmesh_route" "test" { } func testAccAwsAppmeshRouteConfig_tcpRoute(rName string) string { - return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` + return testAccAwsAppmeshRouteConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -750,7 +758,7 @@ resource "aws_appmesh_route" "test" { } func testAccAwsAppmeshRouteConfig_tcpRouteUpdated(rName string) string { - return testAccAwsAppmeshRouteConfigBase(rName) + fmt.Sprintf(` + return testAccAwsAppmeshRouteConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_route" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" diff --git a/aws/resource_aws_appmesh_test.go b/aws/resource_aws_appmesh_test.go index 325929669a6..d9e950fff65 100644 --- a/aws/resource_aws_appmesh_test.go +++ b/aws/resource_aws_appmesh_test.go @@ -22,6 +22,7 @@ func TestAccAWSAppmesh(t *testing.T) { "basic": testAccAwsAppmeshVirtualNode_basic, "cloudMapServiceDiscovery": testAccAwsAppmeshVirtualNode_cloudMapServiceDiscovery, "listenerHealthChecks": testAccAwsAppmeshVirtualNode_listenerHealthChecks, + "listenerTls": testAccAwsAppmeshVirtualNode_listenerTls, "logging": testAccAwsAppmeshVirtualNode_logging, // "tags": testAccAwsAppmeshVirtualNode_tags, }, diff --git a/aws/resource_aws_appmesh_virtual_node.go b/aws/resource_aws_appmesh_virtual_node.go index 2ec61fca962..289b711c16e 100644 --- a/aws/resource_aws_appmesh_virtual_node.go +++ b/aws/resource_aws_appmesh_virtual_node.go @@ -185,6 +185,52 @@ func resourceAwsAppmeshVirtualNode() *schema.Resource { }, }, }, + + "tls": { + Type: schema.TypeList, + Optional: true, + MinItems: 0, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "certificate": { + Type: schema.TypeList, + Required: true, + MinItems: 1, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "acm": { + Type: schema.TypeList, + Optional: true, + MinItems: 0, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "certificate_arn": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validateArn, + }, + }, + }, + }, + }, + }, + }, + + "mode": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + appmesh.ListenerTlsModeDisabled, + appmesh.ListenerTlsModePermissive, + appmesh.ListenerTlsModeStrict, + }, false), + }, + }, + }, + }, }, }, Set: appmeshListenerHash, @@ -459,10 +505,11 @@ func expandAppmeshVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec backend.VirtualService = &appmesh.VirtualServiceBackend{} - if vVirtualServiceName, ok := mVirtualService["virtual_service_name"].(string); ok { + if vVirtualServiceName, ok := mVirtualService["virtual_service_name"].(string); ok && vVirtualServiceName != "" { backend.VirtualService.VirtualServiceName = aws.String(vVirtualServiceName) } } + backends = append(backends, backend) } @@ -480,42 +527,74 @@ func expandAppmeshVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec if vHealthCheck, ok := mListener["health_check"].([]interface{}); ok && len(vHealthCheck) > 0 && vHealthCheck[0] != nil { mHealthCheck := vHealthCheck[0].(map[string]interface{}) - listener.HealthCheck = &appmesh.HealthCheckPolicy{} + healthCheck := &appmesh.HealthCheckPolicy{} if vHealthyThreshold, ok := mHealthCheck["healthy_threshold"].(int); ok && vHealthyThreshold > 0 { - listener.HealthCheck.HealthyThreshold = aws.Int64(int64(vHealthyThreshold)) + healthCheck.HealthyThreshold = aws.Int64(int64(vHealthyThreshold)) } if vIntervalMillis, ok := mHealthCheck["interval_millis"].(int); ok && vIntervalMillis > 0 { - listener.HealthCheck.IntervalMillis = aws.Int64(int64(vIntervalMillis)) + healthCheck.IntervalMillis = aws.Int64(int64(vIntervalMillis)) } if vPath, ok := mHealthCheck["path"].(string); ok && vPath != "" { - listener.HealthCheck.Path = aws.String(vPath) + healthCheck.Path = aws.String(vPath) } if vPort, ok := mHealthCheck["port"].(int); ok && vPort > 0 { - listener.HealthCheck.Port = aws.Int64(int64(vPort)) + healthCheck.Port = aws.Int64(int64(vPort)) } if vProtocol, ok := mHealthCheck["protocol"].(string); ok && vProtocol != "" { - listener.HealthCheck.Protocol = aws.String(vProtocol) + healthCheck.Protocol = aws.String(vProtocol) } if vTimeoutMillis, ok := mHealthCheck["timeout_millis"].(int); ok && vTimeoutMillis > 0 { - listener.HealthCheck.TimeoutMillis = aws.Int64(int64(vTimeoutMillis)) + healthCheck.TimeoutMillis = aws.Int64(int64(vTimeoutMillis)) } if vUnhealthyThreshold, ok := mHealthCheck["unhealthy_threshold"].(int); ok && vUnhealthyThreshold > 0 { - listener.HealthCheck.UnhealthyThreshold = aws.Int64(int64(vUnhealthyThreshold)) + healthCheck.UnhealthyThreshold = aws.Int64(int64(vUnhealthyThreshold)) } + + listener.HealthCheck = healthCheck } if vPortMapping, ok := mListener["port_mapping"].([]interface{}); ok && len(vPortMapping) > 0 && vPortMapping[0] != nil { mPortMapping := vPortMapping[0].(map[string]interface{}) - listener.PortMapping = &appmesh.PortMapping{} + portMapping := &appmesh.PortMapping{} if vPort, ok := mPortMapping["port"].(int); ok && vPort > 0 { - listener.PortMapping.Port = aws.Int64(int64(vPort)) + portMapping.Port = aws.Int64(int64(vPort)) } if vProtocol, ok := mPortMapping["protocol"].(string); ok && vProtocol != "" { - listener.PortMapping.Protocol = aws.String(vProtocol) + portMapping.Protocol = aws.String(vProtocol) + } + + listener.PortMapping = portMapping + } + + if vTls, ok := mListener["tls"].([]interface{}); ok && len(vTls) > 0 && vTls[0] != nil { + mTls := vTls[0].(map[string]interface{}) + + tls := &appmesh.ListenerTls{} + + if vMode, ok := mTls["mode"].(string); ok && vMode != "" { + tls.Mode = aws.String(vMode) + } + + if vCertificate, ok := mTls["certificate"].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { + mCertificate := vCertificate[0].(map[string]interface{}) + + if vAcm, ok := mCertificate["acm"].([]interface{}); ok && len(vAcm) > 0 && vAcm[0] != nil { + mAcm := vAcm[0].(map[string]interface{}) + + if vCertificateArn, ok := mAcm["certificate_arn"].(string); ok && vCertificateArn != "" { + tls.Certificate = &appmesh.ListenerTlsCertificate{ + Acm: &appmesh.ListenerTlsAcmCertificate{ + CertificateArn: aws.String(vCertificateArn), + }, + } + } + } } + + listener.Tls = tls } listeners = append(listeners, listener) @@ -552,10 +631,17 @@ func expandAppmeshVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec mServiceDiscovery := vServiceDiscovery[0].(map[string]interface{}) if vAwsCloudMap, ok := mServiceDiscovery["aws_cloud_map"].([]interface{}); ok && len(vAwsCloudMap) > 0 && vAwsCloudMap[0] != nil { - spec.ServiceDiscovery.AwsCloudMap = &appmesh.AwsCloudMapServiceDiscovery{} + awsCloudMap := &appmesh.AwsCloudMapServiceDiscovery{} mAwsCloudMap := vAwsCloudMap[0].(map[string]interface{}) + if vNamespaceName, ok := mAwsCloudMap["namespace_name"].(string); ok && vNamespaceName != "" { + awsCloudMap.NamespaceName = aws.String(vNamespaceName) + } + if vServiceName, ok := mAwsCloudMap["service_name"].(string); ok && vServiceName != "" { + awsCloudMap.ServiceName = aws.String(vServiceName) + } + if vAttributes, ok := mAwsCloudMap["attributes"].(map[string]interface{}); ok && len(vAttributes) > 0 { attributes := []*appmesh.AwsCloudMapInstanceAttribute{} @@ -566,14 +652,10 @@ func expandAppmeshVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec }) } - spec.ServiceDiscovery.AwsCloudMap.Attributes = attributes - } - if vNamespaceName, ok := mAwsCloudMap["namespace_name"].(string); ok && vNamespaceName != "" { - spec.ServiceDiscovery.AwsCloudMap.NamespaceName = aws.String(vNamespaceName) - } - if vServiceName, ok := mAwsCloudMap["service_name"].(string); ok && vServiceName != "" { - spec.ServiceDiscovery.AwsCloudMap.ServiceName = aws.String(vServiceName) + awsCloudMap.Attributes = attributes } + + spec.ServiceDiscovery.AwsCloudMap = awsCloudMap } if vDns, ok := mServiceDiscovery["dns"].([]interface{}); ok && len(vDns) > 0 && vDns[0] != nil { @@ -597,17 +679,18 @@ func flattenAppmeshVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} mSpec := map[string]interface{}{} - if spec.Backends != nil { + if backends := spec.Backends; backends != nil { vBackends := []interface{}{} - for _, backend := range spec.Backends { + for _, backend := range backends { mBackend := map[string]interface{}{} - if backend.VirtualService != nil { - mVirtualService := map[string]interface{}{ - "virtual_service_name": aws.StringValue(backend.VirtualService.VirtualServiceName), + if virtualService := backend.VirtualService; virtualService != nil { + mBackend["virtual_service"] = []interface{}{ + map[string]interface{}{ + "virtual_service_name": aws.StringValue(virtualService.VirtualServiceName), + }, } - mBackend["virtual_service"] = []interface{}{mVirtualService} } vBackends = append(vBackends, mBackend) @@ -616,31 +699,55 @@ func flattenAppmeshVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} mSpec["backend"] = schema.NewSet(appmeshBackendHash, vBackends) } - if spec.Listeners != nil { + if listeners := spec.Listeners; listeners != nil { vListeners := []interface{}{} - for _, listener := range spec.Listeners { + for _, listener := range listeners { mListener := map[string]interface{}{} - if listener.HealthCheck != nil { - mHealthCheck := map[string]interface{}{ - "healthy_threshold": int(aws.Int64Value(listener.HealthCheck.HealthyThreshold)), - "interval_millis": int(aws.Int64Value(listener.HealthCheck.IntervalMillis)), - "path": aws.StringValue(listener.HealthCheck.Path), - "port": int(aws.Int64Value(listener.HealthCheck.Port)), - "protocol": aws.StringValue(listener.HealthCheck.Protocol), - "timeout_millis": int(aws.Int64Value(listener.HealthCheck.TimeoutMillis)), - "unhealthy_threshold": int(aws.Int64Value(listener.HealthCheck.UnhealthyThreshold)), + if healthCheck := listener.HealthCheck; healthCheck != nil { + mListener["health_check"] = []interface{}{ + map[string]interface{}{ + "healthy_threshold": int(aws.Int64Value(healthCheck.HealthyThreshold)), + "interval_millis": int(aws.Int64Value(healthCheck.IntervalMillis)), + "path": aws.StringValue(healthCheck.Path), + "port": int(aws.Int64Value(healthCheck.Port)), + "protocol": aws.StringValue(healthCheck.Protocol), + "timeout_millis": int(aws.Int64Value(healthCheck.TimeoutMillis)), + "unhealthy_threshold": int(aws.Int64Value(healthCheck.UnhealthyThreshold)), + }, } - mListener["health_check"] = []interface{}{mHealthCheck} } - if listener.PortMapping != nil { - mPortMapping := map[string]interface{}{ - "port": int(aws.Int64Value(listener.PortMapping.Port)), - "protocol": aws.StringValue(listener.PortMapping.Protocol), + if portMapping := listener.PortMapping; portMapping != nil { + mListener["port_mapping"] = []interface{}{ + map[string]interface{}{ + "port": int(aws.Int64Value(portMapping.Port)), + "protocol": aws.StringValue(portMapping.Protocol), + }, } - mListener["port_mapping"] = []interface{}{mPortMapping} + } + + if tls := listener.Tls; tls != nil { + mTls := map[string]interface{}{ + "mode": aws.StringValue(tls.Mode), + } + + if certificate := tls.Certificate; certificate != nil { + if acm := certificate.Acm; acm != nil { + mTls["certificate"] = []interface{}{ + map[string]interface{}{ + "acm": []interface{}{ + map[string]interface{}{ + "certificate_arn": aws.StringValue(acm.CertificateArn), + }, + }, + }, + } + } + } + + mListener["tls"] = []interface{}{mTls} } vListeners = append(vListeners, mListener) @@ -649,45 +756,49 @@ func flattenAppmeshVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} mSpec["listener"] = schema.NewSet(appmeshListenerHash, vListeners) } - if spec.Logging != nil && spec.Logging.AccessLog != nil && spec.Logging.AccessLog.File != nil { - mSpec["logging"] = []interface{}{ - map[string]interface{}{ - "access_log": []interface{}{ + if logging := spec.Logging; logging != nil { + if accessLog := logging.AccessLog; accessLog != nil { + if file := accessLog.File; file != nil { + mSpec["logging"] = []interface{}{ map[string]interface{}{ - "file": []interface{}{ + "access_log": []interface{}{ map[string]interface{}{ - "path": aws.StringValue(spec.Logging.AccessLog.File.Path), + "file": []interface{}{ + map[string]interface{}{ + "path": aws.StringValue(file.Path), + }, + }, }, }, }, - }, - }, + } + } } } - if spec.ServiceDiscovery != nil { + if serviceDiscovery := spec.ServiceDiscovery; serviceDiscovery != nil { mServiceDiscovery := map[string]interface{}{} - if spec.ServiceDiscovery.AwsCloudMap != nil { + if awsCloudMap := serviceDiscovery.AwsCloudMap; awsCloudMap != nil { vAttributes := map[string]interface{}{} - for _, attribute := range spec.ServiceDiscovery.AwsCloudMap.Attributes { + for _, attribute := range awsCloudMap.Attributes { vAttributes[aws.StringValue(attribute.Key)] = aws.StringValue(attribute.Value) } mServiceDiscovery["aws_cloud_map"] = []interface{}{ map[string]interface{}{ "attributes": vAttributes, - "namespace_name": aws.StringValue(spec.ServiceDiscovery.AwsCloudMap.NamespaceName), - "service_name": aws.StringValue(spec.ServiceDiscovery.AwsCloudMap.ServiceName), + "namespace_name": aws.StringValue(awsCloudMap.NamespaceName), + "service_name": aws.StringValue(awsCloudMap.ServiceName), }, } } - if spec.ServiceDiscovery.Dns != nil { + if dns := serviceDiscovery.Dns; dns != nil { mServiceDiscovery["dns"] = []interface{}{ map[string]interface{}{ - "hostname": aws.StringValue(spec.ServiceDiscovery.Dns.Hostname), + "hostname": aws.StringValue(dns.Hostname), }, } } @@ -745,5 +856,20 @@ func appmeshListenerHash(vListener interface{}) int { buf.WriteString(fmt.Sprintf("%s-", v)) } } + if vTls, ok := mListener["tls"].([]interface{}); ok && len(vTls) > 0 && vTls[0] != nil { + mTls := vTls[0].(map[string]interface{}) + if vCertificate, ok := mTls["certificate"].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { + mCertificate := vCertificate[0].(map[string]interface{}) + if vAcm, ok := mCertificate["acm"].([]interface{}); ok && len(vAcm) > 0 && vAcm[0] != nil { + mAcm := vAcm[0].(map[string]interface{}) + if v, ok := mAcm["certificate_arn"].(string); ok { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + } + } + if v, ok := mTls["mode"].(string); ok { + buf.WriteString(fmt.Sprintf("%s-", v)) + } + } return hashcode.String(buf.String()) } diff --git a/aws/resource_aws_appmesh_virtual_node_test.go b/aws/resource_aws_appmesh_virtual_node_test.go index e19bbedd21c..5a416b118a7 100644 --- a/aws/resource_aws_appmesh_virtual_node_test.go +++ b/aws/resource_aws_appmesh_virtual_node_test.go @@ -2,7 +2,6 @@ package aws import ( "fmt" - "regexp" "testing" "github.com/aws/aws-sdk-go/aws" @@ -15,8 +14,7 @@ import ( func testAccAwsAppmeshVirtualNode_basic(t *testing.T) { var vn appmesh.VirtualNodeData resourceName := "aws_appmesh_virtual_node.test" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vnName := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -24,24 +22,25 @@ func testAccAwsAppmeshVirtualNode_basic(t *testing.T) { CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ { - Config: testAccAppmeshVirtualNodeConfig_basic(meshName, vnName), + Config: testAccAppmeshVirtualNodeConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "name", vnName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.listener.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "created_date"), - resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s", meshName, vnName), + ImportStateIdFunc: testAccAwsAppmeshVirtualNodeImportStateIdFunc(resourceName), ImportState: true, ImportStateVerify: true, }, @@ -53,9 +52,7 @@ func testAccAwsAppmeshVirtualNode_cloudMapServiceDiscovery(t *testing.T) { var vn appmesh.VirtualNodeData resourceName := "aws_appmesh_virtual_node.test" nsResourceName := "aws_service_discovery_http_namespace.test" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vnName := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) - rName := fmt.Sprintf("tf-testacc-appmeshvn-%s", acctest.RandStringFromCharSet(11, acctest.CharSetAlphaNum)) + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -63,38 +60,66 @@ func testAccAwsAppmeshVirtualNode_cloudMapServiceDiscovery(t *testing.T) { CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ { - Config: testAccAppmeshVirtualNodeConfig_cloudMapServiceDiscovery(meshName, vnName, rName, "Key1", "Value1"), + Config: testAccAppmeshVirtualNodeConfig_cloudMapServiceDiscovery(rName, "Key1", "Value1"), Check: resource.ComposeTestCheckFunc( testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "name", vnName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.0.virtual_service_name", "servicea.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.health_check.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.0.port", "8080"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.0.protocol", "http"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.tls.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.aws_cloud_map.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.aws_cloud_map.0.attributes.%", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.aws_cloud_map.0.attributes.Key1", "Value1"), resource.TestCheckResourceAttrPair(resourceName, "spec.0.service_discovery.0.aws_cloud_map.0.namespace_name", nsResourceName, "name"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.aws_cloud_map.0.service_name", rName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { - Config: testAccAppmeshVirtualNodeConfig_cloudMapServiceDiscovery(meshName, vnName, rName, "Key1", "Value2"), + Config: testAccAppmeshVirtualNodeConfig_cloudMapServiceDiscovery(rName, "Key1", "Value2"), Check: resource.ComposeTestCheckFunc( testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "name", vnName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.0.virtual_service_name", "servicea.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.health_check.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.0.port", "8080"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.0.protocol", "http"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.tls.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.aws_cloud_map.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.aws_cloud_map.0.attributes.%", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.aws_cloud_map.0.attributes.Key1", "Value2"), resource.TestCheckResourceAttrPair(resourceName, "spec.0.service_discovery.0.aws_cloud_map.0.namespace_name", nsResourceName, "name"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.aws_cloud_map.0.service_name", rName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s", meshName, vnName), + ImportStateIdFunc: testAccAwsAppmeshVirtualNodeImportStateIdFunc(resourceName), ImportState: true, ImportStateVerify: true, }, @@ -105,8 +130,7 @@ func testAccAwsAppmeshVirtualNode_cloudMapServiceDiscovery(t *testing.T) { func testAccAwsAppmeshVirtualNode_listenerHealthChecks(t *testing.T) { var vn appmesh.VirtualNodeData resourceName := "aws_appmesh_virtual_node.test" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vnName := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -114,11 +138,14 @@ func testAccAwsAppmeshVirtualNode_listenerHealthChecks(t *testing.T) { CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ { - Config: testAccAppmeshVirtualNodeConfig_listenerHealthChecks(meshName, vnName), + Config: testAccAppmeshVirtualNodeConfig_listenerHealthChecks(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "name", vnName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.#", "1"), @@ -135,21 +162,23 @@ func testAccAwsAppmeshVirtualNode_listenerHealthChecks(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.listener.433446196.port_mapping.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.listener.433446196.port_mapping.0.port", "8080"), resource.TestCheckResourceAttr(resourceName, "spec.0.listener.433446196.port_mapping.0.protocol", "http"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.433446196.tls.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.0.hostname", "serviceb.simpleapp.local"), - resource.TestCheckResourceAttrSet(resourceName, "created_date"), - resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { - Config: testAccAppmeshVirtualNodeConfig_listenerHealthChecksUpdated(meshName, vnName), + Config: testAccAppmeshVirtualNodeConfig_listenerHealthChecksUpdated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "name", vnName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "2"), resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2576932631.virtual_service.#", "1"), @@ -167,18 +196,77 @@ func testAccAwsAppmeshVirtualNode_listenerHealthChecks(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "spec.0.listener.3446683576.port_mapping.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.listener.3446683576.port_mapping.0.port", "8081"), resource.TestCheckResourceAttr(resourceName, "spec.0.listener.3446683576.port_mapping.0.protocol", "http"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.3446683576.tls.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.0.hostname", "serviceb1.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + ResourceName: resourceName, + ImportStateIdFunc: testAccAwsAppmeshVirtualNodeImportStateIdFunc(resourceName), + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccAwsAppmeshVirtualNode_listenerTls(t *testing.T) { + var vn appmesh.VirtualNodeData + resourceName := "aws_appmesh_virtual_node.test" + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProvidersWithTLS, + CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAppmeshVirtualNodeConfig_listenerTls(rName, "PERMISSIVE"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.0.virtual_service_name", "servicea.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.0.hostname", "serviceb.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + Config: testAccAppmeshVirtualNodeConfig_listenerTls(rName, "STRICT"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), resource.TestCheckResourceAttrSet(resourceName, "created_date"), resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), - resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:appmesh-preview:[^:]+:\\d{12}:mesh/%s/virtualNode/%s", meshName, vnName))), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.0.virtual_service_name", "servicea.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.0.hostname", "serviceb.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s", meshName, vnName), + ImportStateIdFunc: testAccAwsAppmeshVirtualNodeImportStateIdFunc(resourceName), ImportState: true, ImportStateVerify: true, }, @@ -189,8 +277,7 @@ func testAccAwsAppmeshVirtualNode_listenerHealthChecks(t *testing.T) { func testAccAwsAppmeshVirtualNode_logging(t *testing.T) { var vn appmesh.VirtualNodeData resourceName := "aws_appmesh_virtual_node.test" - meshName := fmt.Sprintf("tf-test-mesh-%d", acctest.RandInt()) - vnName := fmt.Sprintf("tf-test-node-%d", acctest.RandInt()) + rName := fmt.Sprintf("tf-testacc-appmesh-%s", acctest.RandStringFromCharSet(13, acctest.CharSetAlphaNum)) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -198,33 +285,63 @@ func testAccAwsAppmeshVirtualNode_logging(t *testing.T) { CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ { - Config: testAccAppmeshVirtualNodeConfig_logging(meshName, vnName, "/dev/stdout"), + Config: testAccAppmeshVirtualNodeConfig_logging(rName, "/dev/stdout"), Check: resource.ComposeTestCheckFunc( testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "name", vnName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "spec.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.0.virtual_service_name", "servicea.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.health_check.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.0.port", "8080"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.0.protocol", "http"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.tls.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.0.access_log.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.0.access_log.0.file.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.0.access_log.0.file.0.path", "/dev/stdout"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.0.hostname", "serviceb.simpleapp.local"), ), }, { - Config: testAccAppmeshVirtualNodeConfig_logging(meshName, vnName, "/tmp/access.log"), + Config: testAccAppmeshVirtualNodeConfig_logging(rName, "/tmp/access.log"), Check: resource.ComposeTestCheckFunc( testAccCheckAppmeshVirtualNodeExists(resourceName, &vn), - resource.TestCheckResourceAttr(resourceName, "name", vnName), - resource.TestCheckResourceAttr(resourceName, "mesh_name", meshName), + testAccCheckResourceAttrRegionalARN(resourceName, "arn", "appmesh-preview", fmt.Sprintf("mesh/%s/virtualNode/%s", rName, rName)), + resource.TestCheckResourceAttrSet(resourceName, "created_date"), + resource.TestCheckResourceAttrSet(resourceName, "last_updated_date"), + resource.TestCheckResourceAttr(resourceName, "mesh_name", rName), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.backend.2622272660.virtual_service.0.virtual_service_name", "servicea.simpleapp.local"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.health_check.#", "0"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.0.port", "8080"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.port_mapping.0.protocol", "http"), + resource.TestCheckResourceAttr(resourceName, "spec.0.listener.2279702354.tls.#", "0"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.0.access_log.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.0.access_log.0.file.#", "1"), resource.TestCheckResourceAttr(resourceName, "spec.0.logging.0.access_log.0.file.0.path", "/tmp/access.log"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.#", "1"), + resource.TestCheckResourceAttr(resourceName, "spec.0.service_discovery.0.dns.0.hostname", "serviceb.simpleapp.local"), ), }, { ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/%s", meshName, vnName), + ImportStateIdFunc: testAccAwsAppmeshVirtualNodeImportStateIdFunc(resourceName), ImportState: true, ImportStateVerify: true, }, @@ -328,7 +445,18 @@ func testAccCheckAppmeshVirtualNodeExists(name string, v *appmesh.VirtualNodeDat } } -func testAccAppmeshVirtualNodeConfig_mesh(rName string) string { +func testAccAwsAppmeshVirtualNodeImportStateIdFunc(resourceName string) resource.ImportStateIdFunc { + return func(s *terraform.State) (string, error) { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return "", fmt.Errorf("Not Found: %s", resourceName) + } + + return fmt.Sprintf("%s/%s", rs.Primary.Attributes["mesh_name"], rs.Primary.Attributes["name"]), nil + } +} + +func testAccAppmeshVirtualNodeConfig_base(rName string) string { return fmt.Sprintf(` resource "aws_appmesh_mesh" "test" { name = %[1]q @@ -336,21 +464,21 @@ resource "aws_appmesh_mesh" "test" { `, rName) } -func testAccAppmeshVirtualNodeConfig_basic(meshName, vnName string) string { - return testAccAppmeshVirtualNodeConfig_mesh(meshName) + fmt.Sprintf(` +func testAccAppmeshVirtualNodeConfig_basic(rName string) string { + return testAccAppmeshVirtualNodeConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_virtual_node" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" spec {} } -`, vnName) +`, rName) } -func testAccAppmeshVirtualNodeConfig_cloudMapServiceDiscovery(meshName, vnName, rName, attrKey, attrValue string) string { - return testAccAppmeshVirtualNodeConfig_mesh(meshName) + fmt.Sprintf(` +func testAccAppmeshVirtualNodeConfig_cloudMapServiceDiscovery(rName, attrKey, attrValue string) string { + return testAccAppmeshVirtualNodeConfig_base(rName) + fmt.Sprintf(` resource "aws_service_discovery_http_namespace" "test" { - name = %[2]q + name = %[1]q } resource "aws_appmesh_virtual_node" "test" { @@ -374,20 +502,20 @@ resource "aws_appmesh_virtual_node" "test" { service_discovery { aws_cloud_map { attributes = { - %[3]s = %[4]q + %[2]s = %[3]q } - service_name = %[2]q + service_name = %[1]q namespace_name = "${aws_service_discovery_http_namespace.test.name}" } } } } -`, vnName, rName, attrKey, attrValue) +`, rName, attrKey, attrValue) } -func testAccAppmeshVirtualNodeConfig_listenerHealthChecks(meshName, vnName string) string { - return testAccAppmeshVirtualNodeConfig_mesh(meshName) + fmt.Sprintf(` +func testAccAppmeshVirtualNodeConfig_listenerHealthChecks(rName string) string { + return testAccAppmeshVirtualNodeConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_virtual_node" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -422,11 +550,11 @@ resource "aws_appmesh_virtual_node" "test" { } } } -`, vnName) +`, rName) } -func testAccAppmeshVirtualNodeConfig_listenerHealthChecksUpdated(meshName, vnName string) string { - return testAccAppmeshVirtualNodeConfig_mesh(meshName) + fmt.Sprintf(` +func testAccAppmeshVirtualNodeConfig_listenerHealthChecksUpdated(rName string) string { + return testAccAppmeshVirtualNodeConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_virtual_node" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -467,11 +595,78 @@ resource "aws_appmesh_virtual_node" "test" { } } } -`, vnName) +`, rName) +} + +func testAccAppmeshVirtualNodeConfig_listenerTls(rName, mode string) string { + return testAccAppmeshVirtualNodeConfig_base(rName) + fmt.Sprintf(` +resource "tls_private_key" "test" { + algorithm = "RSA" +} + +resource "tls_self_signed_cert" "test" { + key_algorithm = "RSA" + private_key_pem = "${tls_private_key.test.private_key_pem}" + + subject { + common_name = "test.example.com" + organization = "ACME Examples, Inc" + } + + validity_period_hours = 12 + + allowed_uses = [ + "key_encipherment", + "digital_signature", + "server_auth", + ] +} + +resource "aws_acm_certificate" "test" { + private_key = "${tls_private_key.test.private_key_pem}" + certificate_body = "${tls_self_signed_cert.test.cert_pem}" +} + +resource "aws_appmesh_virtual_node" "test" { + name = %[1]q + mesh_name = "${aws_appmesh_mesh.test.id}" + + spec { + backend { + virtual_service { + virtual_service_name = "servicea.simpleapp.local" + } + } + + listener { + port_mapping { + port = 8080 + protocol = "http" + } + + tls { + mode = %[2]q + + certificate { + acm { + certificate_arn = "${aws_acm_certificate.test.arn}" + } + } + } + } + + service_discovery { + dns { + hostname = "serviceb.simpleapp.local" + } + } + } +} +`, rName, mode) } -func testAccAppmeshVirtualNodeConfig_logging(meshName, vnName, path string) string { - return testAccAppmeshVirtualNodeConfig_mesh(meshName) + fmt.Sprintf(` +func testAccAppmeshVirtualNodeConfig_logging(rName, path string) string { + return testAccAppmeshVirtualNodeConfig_base(rName) + fmt.Sprintf(` resource "aws_appmesh_virtual_node" "test" { name = %[1]q mesh_name = "${aws_appmesh_mesh.test.id}" @@ -505,7 +700,7 @@ resource "aws_appmesh_virtual_node" "test" { } } } -`, vnName, path) +`, rName, path) } // func testAccAppmeshVirtualNodeConfig_tags(meshName, vnName, tagKey1, tagValue1, tagKey2, tagValue2 string) string { diff --git a/website/docs/r/appmesh_virtual_node.html.markdown b/website/docs/r/appmesh_virtual_node.html.markdown index c7f9759805a..a6c0238f6e7 100644 --- a/website/docs/r/appmesh_virtual_node.html.markdown +++ b/website/docs/r/appmesh_virtual_node.html.markdown @@ -197,6 +197,7 @@ The `listener` object supports the following: * `port_mapping` - (Required) The port mapping information for the listener. * `health_check` - (Optional) The health check information for the listener. +* `tls` - (Optional) The TLS information for the listener. The `logging` object supports the following: @@ -241,6 +242,19 @@ The `health_check` object supports the following: * `path` - (Optional) The destination path for the health check request. This is only required if the specified protocol is `http`. * `port` - (Optional) The destination port for the health check request. This port must match the port defined in the `port_mapping` for the listener. +The `tls` object supports the following: + +* `certificate` - (Required) The certificate. +* `mode` - (Required) The TLS mode. Valid values are `DISABLED`, `PERMISSIVE` and `STRICT`. + +The `certificate` object supports the following: + +* `acm` - (Optional) [AWS Certificate Manager](https://aws.amazon.com/certificate-manager/) certificate configuration. + +The `acm` object supports the following: + +* `certificate_arn` - (Required) The [ACM certificate](/docs/providers/aws/r/acm_certificate.html) ARN. + ## Attributes Reference In addition to all arguments above, the following attributes are exported: