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// Modifies an account setting. Account settings are set on a per-Region basis. If
15// you change the account setting for the root user, the default settings for all
16// of the IAM users and roles for which no individual account setting has been
17// specified are reset. For more information, see Account Settings
18// (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html)
19// in the Amazon Elastic Container Service Developer Guide. When
20// serviceLongArnFormat, taskLongArnFormat, or containerInstanceLongArnFormat are
21// specified, the Amazon Resource Name (ARN) and resource ID format of the resource
22// type for a specified IAM user, IAM role, or the root user for an account is
23// affected. The opt-in and opt-out account setting must be set for each Amazon ECS
24// resource separately. The ARN and resource ID format of a resource will be
25// defined by the opt-in status of the IAM user or role that created the resource.
26// You must enable this setting to use Amazon ECS features such as resource
27// tagging. When awsvpcTrunking is specified, the elastic network interface (ENI)
28// limit for any new container instances that support the feature is changed. If
29// awsvpcTrunking is enabled, any new container instances that support the feature
30// are launched have the increased ENI limits available to them. For more
31// information, see Elastic Network Interface Trunking
32// (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-eni.html)
33// in the Amazon Elastic Container Service Developer Guide. When containerInsights
34// is specified, the default setting indicating whether CloudWatch Container
35// Insights is enabled for your clusters is changed. If containerInsights is
36// enabled, any new clusters that are created will have Container Insights enabled
37// unless you disable it during cluster creation. For more information, see
38// CloudWatch Container Insights
39// (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch-container-insights.html)
40// in the Amazon Elastic Container Service Developer Guide.
41func (c *Client) PutAccountSetting(ctx context.Context, params *PutAccountSettingInput, optFns ...func(*Options)) (*PutAccountSettingOutput, error) {
42	if params == nil {
43		params = &PutAccountSettingInput{}
44	}
45
46	result, metadata, err := c.invokeOperation(ctx, "PutAccountSetting", params, optFns, addOperationPutAccountSettingMiddlewares)
47	if err != nil {
48		return nil, err
49	}
50
51	out := result.(*PutAccountSettingOutput)
52	out.ResultMetadata = metadata
53	return out, nil
54}
55
56type PutAccountSettingInput struct {
57
58	// The Amazon ECS resource name for which to modify the account setting. If
59	// serviceLongArnFormat is specified, the ARN for your Amazon ECS services is
60	// affected. If taskLongArnFormat is specified, the ARN and resource ID for your
61	// Amazon ECS tasks is affected. If containerInstanceLongArnFormat is specified,
62	// the ARN and resource ID for your Amazon ECS container instances is affected. If
63	// awsvpcTrunking is specified, the elastic network interface (ENI) limit for your
64	// Amazon ECS container instances is affected. If containerInsights is specified,
65	// the default setting for CloudWatch Container Insights for your clusters is
66	// affected.
67	//
68	// This member is required.
69	Name types.SettingName
70
71	// The account setting value for the specified principal ARN. Accepted values are
72	// enabled and disabled.
73	//
74	// This member is required.
75	Value *string
76
77	// The ARN of the principal, which can be an IAM user, IAM role, or the root user.
78	// If you specify the root user, it modifies the account setting for all IAM users,
79	// IAM roles, and the root user of the account unless an IAM user or role
80	// explicitly overrides these settings. If this field is omitted, the setting is
81	// changed only for the authenticated user.
82	PrincipalArn *string
83}
84
85type PutAccountSettingOutput struct {
86
87	// The current account setting for a resource.
88	Setting *types.Setting
89
90	// Metadata pertaining to the operation's result.
91	ResultMetadata middleware.Metadata
92}
93
94func addOperationPutAccountSettingMiddlewares(stack *middleware.Stack, options Options) (err error) {
95	err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutAccountSetting{}, middleware.After)
96	if err != nil {
97		return err
98	}
99	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutAccountSetting{}, middleware.After)
100	if err != nil {
101		return err
102	}
103	if err = addSetLoggerMiddleware(stack, options); err != nil {
104		return err
105	}
106	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
107		return err
108	}
109	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
110		return err
111	}
112	if err = addResolveEndpointMiddleware(stack, options); err != nil {
113		return err
114	}
115	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
116		return err
117	}
118	if err = addRetryMiddlewares(stack, options); err != nil {
119		return err
120	}
121	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
122		return err
123	}
124	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
125		return err
126	}
127	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
128		return err
129	}
130	if err = addClientUserAgent(stack); err != nil {
131		return err
132	}
133	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
134		return err
135	}
136	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addOpPutAccountSettingValidationMiddleware(stack); err != nil {
140		return err
141	}
142	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutAccountSetting(options.Region), middleware.Before); err != nil {
143		return err
144	}
145	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
146		return err
147	}
148	if err = addResponseErrorMiddleware(stack); err != nil {
149		return err
150	}
151	if err = addRequestResponseLogging(stack, options); err != nil {
152		return err
153	}
154	return nil
155}
156
157func newServiceMetadataMiddleware_opPutAccountSetting(region string) *awsmiddleware.RegisterServiceMetadata {
158	return &awsmiddleware.RegisterServiceMetadata{
159		Region:        region,
160		ServiceID:     ServiceID,
161		SigningName:   "ecs",
162		OperationName: "PutAccountSetting",
163	}
164}
165