1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package ecs
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/ecs/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// This action is only used by the Amazon ECS agent, and it is not intended for use
15// outside of the agent. Registers an EC2 instance into the specified cluster. This
16// instance becomes available to place containers on.
17func (c *Client) RegisterContainerInstance(ctx context.Context, params *RegisterContainerInstanceInput, optFns ...func(*Options)) (*RegisterContainerInstanceOutput, error) {
18	if params == nil {
19		params = &RegisterContainerInstanceInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "RegisterContainerInstance", params, optFns, addOperationRegisterContainerInstanceMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*RegisterContainerInstanceOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32type RegisterContainerInstanceInput struct {
33
34	// The container instance attributes that this container instance supports.
35	Attributes []types.Attribute
36
37	// The short name or full Amazon Resource Name (ARN) of the cluster with which to
38	// register your container instance. If you do not specify a cluster, the default
39	// cluster is assumed.
40	Cluster *string
41
42	// The ARN of the container instance (if it was previously registered).
43	ContainerInstanceArn *string
44
45	// The instance identity document for the EC2 instance to register. This document
46	// can be found by running the following command from the instance: curl
47	// http://169.254.169.254/latest/dynamic/instance-identity/document/
48	InstanceIdentityDocument *string
49
50	// The instance identity document signature for the EC2 instance to register. This
51	// signature can be found by running the following command from the instance: curl
52	// http://169.254.169.254/latest/dynamic/instance-identity/signature/
53	InstanceIdentityDocumentSignature *string
54
55	// The devices that are available on the container instance. The only supported
56	// device type is a GPU.
57	PlatformDevices []types.PlatformDevice
58
59	// The metadata that you apply to the container instance to help you categorize and
60	// organize them. Each tag consists of a key and an optional value, both of which
61	// you define. The following basic restrictions apply to tags:
62	//
63	// * Maximum number of
64	// tags per resource - 50
65	//
66	// * For each resource, each tag key must be unique, and
67	// each tag key can have only one value.
68	//
69	// * Maximum key length - 128 Unicode
70	// characters in UTF-8
71	//
72	// * Maximum value length - 256 Unicode characters in UTF-8
73	//
74	// *
75	// If your tagging schema is used across multiple services and resources, remember
76	// that other services may have restrictions on allowed characters. Generally
77	// allowed characters are: letters, numbers, and spaces representable in UTF-8, and
78	// the following characters: + - = . _ : / @.
79	//
80	// * Tag keys and values are
81	// case-sensitive.
82	//
83	// * Do not use aws:, AWS:, or any upper or lowercase combination
84	// of such as a prefix for either keys or values as it is reserved for AWS use. You
85	// cannot edit or delete tag keys or values with this prefix. Tags with this prefix
86	// do not count against your tags per resource limit.
87	Tags []types.Tag
88
89	// The resources available on the instance.
90	TotalResources []types.Resource
91
92	// The version information for the Amazon ECS container agent and Docker daemon
93	// running on the container instance.
94	VersionInfo *types.VersionInfo
95}
96
97type RegisterContainerInstanceOutput struct {
98
99	// The container instance that was registered.
100	ContainerInstance *types.ContainerInstance
101
102	// Metadata pertaining to the operation's result.
103	ResultMetadata middleware.Metadata
104}
105
106func addOperationRegisterContainerInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) {
107	err = stack.Serialize.Add(&awsAwsjson11_serializeOpRegisterContainerInstance{}, middleware.After)
108	if err != nil {
109		return err
110	}
111	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpRegisterContainerInstance{}, middleware.After)
112	if err != nil {
113		return err
114	}
115	if err = addSetLoggerMiddleware(stack, options); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
122		return err
123	}
124	if err = addResolveEndpointMiddleware(stack, options); err != nil {
125		return err
126	}
127	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
128		return err
129	}
130	if err = addRetryMiddlewares(stack, options); err != nil {
131		return err
132	}
133	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
134		return err
135	}
136	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
137		return err
138	}
139	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
140		return err
141	}
142	if err = addClientUserAgent(stack); err != nil {
143		return err
144	}
145	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
146		return err
147	}
148	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
149		return err
150	}
151	if err = addOpRegisterContainerInstanceValidationMiddleware(stack); err != nil {
152		return err
153	}
154	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRegisterContainerInstance(options.Region), middleware.Before); err != nil {
155		return err
156	}
157	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
158		return err
159	}
160	if err = addResponseErrorMiddleware(stack); err != nil {
161		return err
162	}
163	if err = addRequestResponseLogging(stack, options); err != nil {
164		return err
165	}
166	return nil
167}
168
169func newServiceMetadataMiddleware_opRegisterContainerInstance(region string) *awsmiddleware.RegisterServiceMetadata {
170	return &awsmiddleware.RegisterServiceMetadata{
171		Region:        region,
172		ServiceID:     ServiceID,
173		SigningName:   "ecs",
174		OperationName: "RegisterContainerInstance",
175	}
176}
177