1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package eks 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/eks/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Updates an Amazon EKS cluster configuration. Your cluster continues to function 16// during the update. The response output includes an update ID that you can use to 17// track the status of your cluster update with the DescribeUpdate API operation. 18// You can use this API operation to enable or disable exporting the Kubernetes 19// control plane logs for your cluster to CloudWatch Logs. By default, cluster 20// control plane logs aren't exported to CloudWatch Logs. For more information, see 21// Amazon EKS Cluster Control Plane Logs 22// (https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html) in 23// the Amazon EKS User Guide . CloudWatch Logs ingestion, archive storage, and data 24// scanning rates apply to exported control plane logs. For more information, see 25// Amazon CloudWatch Pricing (http://aws.amazon.com/cloudwatch/pricing/). You can 26// also use this API operation to enable or disable public and private access to 27// your cluster's Kubernetes API server endpoint. By default, public access is 28// enabled, and private access is disabled. For more information, see Amazon EKS 29// Cluster Endpoint Access Control 30// (https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html) in the 31// Amazon EKS User Guide . At this time, you can not update the subnets or security 32// group IDs for an existing cluster. Cluster updates are asynchronous, and they 33// should finish within a few minutes. During an update, the cluster status moves 34// to UPDATING (this status transition is eventually consistent). When the update 35// is complete (either Failed or Successful), the cluster status moves to Active. 36func (c *Client) UpdateClusterConfig(ctx context.Context, params *UpdateClusterConfigInput, optFns ...func(*Options)) (*UpdateClusterConfigOutput, error) { 37 if params == nil { 38 params = &UpdateClusterConfigInput{} 39 } 40 41 result, metadata, err := c.invokeOperation(ctx, "UpdateClusterConfig", params, optFns, addOperationUpdateClusterConfigMiddlewares) 42 if err != nil { 43 return nil, err 44 } 45 46 out := result.(*UpdateClusterConfigOutput) 47 out.ResultMetadata = metadata 48 return out, nil 49} 50 51type UpdateClusterConfigInput struct { 52 53 // The name of the Amazon EKS cluster to update. 54 // 55 // This member is required. 56 Name *string 57 58 // Unique, case-sensitive identifier that you provide to ensure the idempotency of 59 // the request. 60 ClientRequestToken *string 61 62 // Enable or disable exporting the Kubernetes control plane logs for your cluster 63 // to CloudWatch Logs. By default, cluster control plane logs aren't exported to 64 // CloudWatch Logs. For more information, see Amazon EKS Cluster Control Plane Logs 65 // (https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html) in 66 // the Amazon EKS User Guide . CloudWatch Logs ingestion, archive storage, and data 67 // scanning rates apply to exported control plane logs. For more information, see 68 // Amazon CloudWatch Pricing (http://aws.amazon.com/cloudwatch/pricing/). 69 Logging *types.Logging 70 71 // An object representing the VPC configuration to use for an Amazon EKS cluster. 72 ResourcesVpcConfig *types.VpcConfigRequest 73} 74 75type UpdateClusterConfigOutput struct { 76 77 // An object representing an asynchronous update. 78 Update *types.Update 79 80 // Metadata pertaining to the operation's result. 81 ResultMetadata middleware.Metadata 82} 83 84func addOperationUpdateClusterConfigMiddlewares(stack *middleware.Stack, options Options) (err error) { 85 err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateClusterConfig{}, middleware.After) 86 if err != nil { 87 return err 88 } 89 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateClusterConfig{}, middleware.After) 90 if err != nil { 91 return err 92 } 93 if err = addSetLoggerMiddleware(stack, options); err != nil { 94 return err 95 } 96 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 97 return err 98 } 99 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 100 return err 101 } 102 if err = addResolveEndpointMiddleware(stack, options); err != nil { 103 return err 104 } 105 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 106 return err 107 } 108 if err = addRetryMiddlewares(stack, options); err != nil { 109 return err 110 } 111 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 112 return err 113 } 114 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 115 return err 116 } 117 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 118 return err 119 } 120 if err = addClientUserAgent(stack); err != nil { 121 return err 122 } 123 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 124 return err 125 } 126 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 127 return err 128 } 129 if err = addIdempotencyToken_opUpdateClusterConfigMiddleware(stack, options); err != nil { 130 return err 131 } 132 if err = addOpUpdateClusterConfigValidationMiddleware(stack); err != nil { 133 return err 134 } 135 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateClusterConfig(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 150type idempotencyToken_initializeOpUpdateClusterConfig struct { 151 tokenProvider IdempotencyTokenProvider 152} 153 154func (*idempotencyToken_initializeOpUpdateClusterConfig) ID() string { 155 return "OperationIdempotencyTokenAutoFill" 156} 157 158func (m *idempotencyToken_initializeOpUpdateClusterConfig) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 159 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 160) { 161 if m.tokenProvider == nil { 162 return next.HandleInitialize(ctx, in) 163 } 164 165 input, ok := in.Parameters.(*UpdateClusterConfigInput) 166 if !ok { 167 return out, metadata, fmt.Errorf("expected middleware input to be of type *UpdateClusterConfigInput ") 168 } 169 170 if input.ClientRequestToken == nil { 171 t, err := m.tokenProvider.GetIdempotencyToken() 172 if err != nil { 173 return out, metadata, err 174 } 175 input.ClientRequestToken = &t 176 } 177 return next.HandleInitialize(ctx, in) 178} 179func addIdempotencyToken_opUpdateClusterConfigMiddleware(stack *middleware.Stack, cfg Options) error { 180 return stack.Initialize.Add(&idempotencyToken_initializeOpUpdateClusterConfig{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) 181} 182 183func newServiceMetadataMiddleware_opUpdateClusterConfig(region string) *awsmiddleware.RegisterServiceMetadata { 184 return &awsmiddleware.RegisterServiceMetadata{ 185 Region: region, 186 ServiceID: ServiceID, 187 SigningName: "eks", 188 OperationName: "UpdateClusterConfig", 189 } 190} 191