1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package sagemaker
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/sagemaker/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Deploys the new EndpointConfig specified in the request, switches to using newly
15// created endpoint, and then deletes resources provisioned for the endpoint using
16// the previous EndpointConfig (there is no availability loss). When Amazon
17// SageMaker receives the request, it sets the endpoint status to Updating. After
18// updating the endpoint, it sets the status to InService. To check the status of
19// an endpoint, use the DescribeEndpoint API. You must not delete an EndpointConfig
20// in use by an endpoint that is live or while the UpdateEndpoint or CreateEndpoint
21// operations are being performed on the endpoint. To update an endpoint, you must
22// create a new EndpointConfig. If you delete the EndpointConfig of an endpoint
23// that is active or being created or updated you may lose visibility into the
24// instance type the endpoint is using. The endpoint must be deleted in order to
25// stop incurring charges.
26func (c *Client) UpdateEndpoint(ctx context.Context, params *UpdateEndpointInput, optFns ...func(*Options)) (*UpdateEndpointOutput, error) {
27	if params == nil {
28		params = &UpdateEndpointInput{}
29	}
30
31	result, metadata, err := c.invokeOperation(ctx, "UpdateEndpoint", params, optFns, addOperationUpdateEndpointMiddlewares)
32	if err != nil {
33		return nil, err
34	}
35
36	out := result.(*UpdateEndpointOutput)
37	out.ResultMetadata = metadata
38	return out, nil
39}
40
41type UpdateEndpointInput struct {
42
43	// The name of the new endpoint configuration.
44	//
45	// This member is required.
46	EndpointConfigName *string
47
48	// The name of the endpoint whose configuration you want to update.
49	//
50	// This member is required.
51	EndpointName *string
52
53	// The deployment configuration for the endpoint to be updated.
54	DeploymentConfig *types.DeploymentConfig
55
56	// When you are updating endpoint resources with
57	// UpdateEndpointInput$RetainAllVariantProperties, whose value is set to true,
58	// ExcludeRetainedVariantProperties specifies the list of type VariantProperty to
59	// override with the values provided by EndpointConfig. If you don't specify a
60	// value for ExcludeAllVariantProperties, no variant properties are overridden.
61	ExcludeRetainedVariantProperties []types.VariantProperty
62
63	// When updating endpoint resources, enables or disables the retention of variant
64	// properties
65	// (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_VariantProperty.html),
66	// such as the instance count or the variant weight. To retain the variant
67	// properties of an endpoint when updating it, set RetainAllVariantProperties to
68	// true. To use the variant properties specified in a new EndpointConfig call when
69	// updating an endpoint, set RetainAllVariantProperties to false. The default is
70	// false.
71	RetainAllVariantProperties bool
72}
73
74type UpdateEndpointOutput struct {
75
76	// The Amazon Resource Name (ARN) of the endpoint.
77	//
78	// This member is required.
79	EndpointArn *string
80
81	// Metadata pertaining to the operation's result.
82	ResultMetadata middleware.Metadata
83}
84
85func addOperationUpdateEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) {
86	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateEndpoint{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateEndpoint{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	if err = addSetLoggerMiddleware(stack, options); err != nil {
95		return err
96	}
97	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
98		return err
99	}
100	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
101		return err
102	}
103	if err = addResolveEndpointMiddleware(stack, options); err != nil {
104		return err
105	}
106	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
107		return err
108	}
109	if err = addRetryMiddlewares(stack, options); err != nil {
110		return err
111	}
112	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
113		return err
114	}
115	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
116		return err
117	}
118	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
119		return err
120	}
121	if err = addClientUserAgent(stack); err != nil {
122		return err
123	}
124	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
125		return err
126	}
127	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addOpUpdateEndpointValidationMiddleware(stack); err != nil {
131		return err
132	}
133	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateEndpoint(options.Region), middleware.Before); err != nil {
134		return err
135	}
136	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
137		return err
138	}
139	if err = addResponseErrorMiddleware(stack); err != nil {
140		return err
141	}
142	if err = addRequestResponseLogging(stack, options); err != nil {
143		return err
144	}
145	return nil
146}
147
148func newServiceMetadataMiddleware_opUpdateEndpoint(region string) *awsmiddleware.RegisterServiceMetadata {
149	return &awsmiddleware.RegisterServiceMetadata{
150		Region:        region,
151		ServiceID:     ServiceID,
152		SigningName:   "sagemaker",
153		OperationName: "UpdateEndpoint",
154	}
155}
156