1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package appmesh
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/appmesh/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a virtual gateway. A virtual gateway allows resources outside your mesh
15// to communicate to resources that are inside your mesh. The virtual gateway
16// represents an Envoy proxy running in an Amazon ECS task, in a Kubernetes
17// service, or on an Amazon EC2 instance. Unlike a virtual node, which represents
18// an Envoy running with an application, a virtual gateway represents Envoy
19// deployed by itself. For more information about virtual gateways, see Virtual
20// gateways
21// (https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_gateways.html).
22func (c *Client) CreateVirtualGateway(ctx context.Context, params *CreateVirtualGatewayInput, optFns ...func(*Options)) (*CreateVirtualGatewayOutput, error) {
23	if params == nil {
24		params = &CreateVirtualGatewayInput{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "CreateVirtualGateway", params, optFns, c.addOperationCreateVirtualGatewayMiddlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*CreateVirtualGatewayOutput)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37type CreateVirtualGatewayInput struct {
38
39	// The name of the service mesh to create the virtual gateway in.
40	//
41	// This member is required.
42	MeshName *string
43
44	// The virtual gateway specification to apply.
45	//
46	// This member is required.
47	Spec *types.VirtualGatewaySpec
48
49	// The name to use for the virtual gateway.
50	//
51	// This member is required.
52	VirtualGatewayName *string
53
54	// Unique, case-sensitive identifier that you provide to ensure the idempotency of
55	// the request. Up to 36 letters, numbers, hyphens, and underscores are allowed.
56	ClientToken *string
57
58	// The AWS IAM account ID of the service mesh owner. If the account ID is not your
59	// own, then the account that you specify must share the mesh with your account
60	// before you can create the resource in the service mesh. For more information
61	// about mesh sharing, see Working with shared meshes
62	// (https://docs.aws.amazon.com/app-mesh/latest/userguide/sharing.html).
63	MeshOwner *string
64
65	// Optional metadata that you can apply to the virtual gateway to assist with
66	// categorization and organization. Each tag consists of a key and an optional
67	// value, both of which you define. Tag keys can have a maximum character length of
68	// 128 characters, and tag values can have a maximum length of 256 characters.
69	Tags []types.TagRef
70
71	noSmithyDocumentSerde
72}
73
74type CreateVirtualGatewayOutput struct {
75
76	// The full description of your virtual gateway following the create call.
77	//
78	// This member is required.
79	VirtualGateway *types.VirtualGatewayData
80
81	// Metadata pertaining to the operation's result.
82	ResultMetadata middleware.Metadata
83
84	noSmithyDocumentSerde
85}
86
87func (c *Client) addOperationCreateVirtualGatewayMiddlewares(stack *middleware.Stack, options Options) (err error) {
88	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateVirtualGateway{}, middleware.After)
89	if err != nil {
90		return err
91	}
92	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateVirtualGateway{}, middleware.After)
93	if err != nil {
94		return err
95	}
96	if err = addSetLoggerMiddleware(stack, options); err != nil {
97		return err
98	}
99	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
100		return err
101	}
102	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
103		return err
104	}
105	if err = addResolveEndpointMiddleware(stack, options); err != nil {
106		return err
107	}
108	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
109		return err
110	}
111	if err = addRetryMiddlewares(stack, options); err != nil {
112		return err
113	}
114	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
115		return err
116	}
117	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
118		return err
119	}
120	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
121		return err
122	}
123	if err = addClientUserAgent(stack); err != nil {
124		return err
125	}
126	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
127		return err
128	}
129	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addOpCreateVirtualGatewayValidationMiddleware(stack); err != nil {
133		return err
134	}
135	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateVirtualGateway(options.Region), middleware.Before); err != nil {
136		return err
137	}
138	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addResponseErrorMiddleware(stack); err != nil {
142		return err
143	}
144	if err = addRequestResponseLogging(stack, options); err != nil {
145		return err
146	}
147	return nil
148}
149
150func newServiceMetadataMiddleware_opCreateVirtualGateway(region string) *awsmiddleware.RegisterServiceMetadata {
151	return &awsmiddleware.RegisterServiceMetadata{
152		Region:        region,
153		ServiceID:     ServiceID,
154		SigningName:   "appmesh",
155		OperationName: "CreateVirtualGateway",
156	}
157}
158