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, 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
72type CreateVirtualGatewayOutput struct {
73
74	// The full description of your virtual gateway following the create call.
75	//
76	// This member is required.
77	VirtualGateway *types.VirtualGatewayData
78
79	// Metadata pertaining to the operation's result.
80	ResultMetadata middleware.Metadata
81}
82
83func addOperationCreateVirtualGatewayMiddlewares(stack *middleware.Stack, options Options) (err error) {
84	err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateVirtualGateway{}, middleware.After)
85	if err != nil {
86		return err
87	}
88	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateVirtualGateway{}, middleware.After)
89	if err != nil {
90		return err
91	}
92	if err = addSetLoggerMiddleware(stack, options); err != nil {
93		return err
94	}
95	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
96		return err
97	}
98	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
99		return err
100	}
101	if err = addResolveEndpointMiddleware(stack, options); err != nil {
102		return err
103	}
104	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
105		return err
106	}
107	if err = addRetryMiddlewares(stack, options); err != nil {
108		return err
109	}
110	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
111		return err
112	}
113	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
114		return err
115	}
116	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
117		return err
118	}
119	if err = addClientUserAgent(stack); err != nil {
120		return err
121	}
122	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
123		return err
124	}
125	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
126		return err
127	}
128	if err = addOpCreateVirtualGatewayValidationMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addResponseErrorMiddleware(stack); err != nil {
135		return err
136	}
137	if err = addRequestResponseLogging(stack, options); err != nil {
138		return err
139	}
140	return nil
141}
142