-
Notifications
You must be signed in to change notification settings - Fork 597
/
api_op_CreateEndpoint.go
230 lines (212 loc) · 9.06 KB
/
api_op_CreateEndpoint.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
// Code generated by smithy-go-codegen DO NOT EDIT.
package sagemaker
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/service/sagemaker/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an endpoint using the endpoint configuration specified in the request.
// SageMaker uses the endpoint to provision resources and deploy models. You create
// the endpoint configuration with the [CreateEndpointConfig]API.
//
// Use this API to deploy models using SageMaker hosting services.
//
// You must not delete an EndpointConfig that is in use by an endpoint that is
// live or while the UpdateEndpoint or CreateEndpoint operations are being
// performed on the endpoint. To update an endpoint, you must create a new
// EndpointConfig .
//
// The endpoint name must be unique within an Amazon Web Services Region in your
// Amazon Web Services account.
//
// When it receives the request, SageMaker creates the endpoint, launches the
// resources (ML compute instances), and deploys the model(s) on them.
//
// When you call [CreateEndpoint], a load call is made to DynamoDB to verify that your endpoint
// configuration exists. When you read data from a DynamoDB table supporting [Eventually Consistent Reads]
// Eventually Consistent Reads , the response might not reflect the results of a
// recently completed write operation. The response might include some stale data.
// If the dependent entities are not yet in DynamoDB, this causes a validation
// error. If you repeat your read request after a short time, the response should
// return the latest data. So retry logic is recommended to handle these possible
// issues. We also recommend that customers call [DescribeEndpointConfig]before calling [CreateEndpoint] to minimize the
// potential impact of a DynamoDB eventually consistent read.
//
// When SageMaker receives the request, it sets the endpoint status to Creating .
// After it creates the endpoint, it sets the status to InService . SageMaker can
// then process incoming requests for inferences. To check the status of an
// endpoint, use the [DescribeEndpoint]API.
//
// If any of the models hosted at this endpoint get model data from an Amazon S3
// location, SageMaker uses Amazon Web Services Security Token Service to download
// model artifacts from the S3 path you provided. Amazon Web Services STS is
// activated in your Amazon Web Services account by default. If you previously
// deactivated Amazon Web Services STS for a region, you need to reactivate Amazon
// Web Services STS for that region. For more information, see [Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region]in the Amazon Web
// Services Identity and Access Management User Guide.
//
// To add the IAM role policies for using this API operation, go to the [IAM console], and
// choose Roles in the left navigation pane. Search the IAM role that you want to
// grant access to use the [CreateEndpoint]and [CreateEndpointConfig] API operations, add the following policies to the
// role.
//
// - Option 1: For a full SageMaker access, search and attach the
// AmazonSageMakerFullAccess policy.
//
// - Option 2: For granting a limited access to an IAM role, paste the following
// Action elements manually into the JSON file of the IAM role:
//
// "Action": ["sagemaker:CreateEndpoint", "sagemaker:CreateEndpointConfig"]
//
// "Resource": [
//
// "arn:aws:sagemaker:region:account-id:endpoint/endpointName"
//
// "arn:aws:sagemaker:region:account-id:endpoint-config/endpointConfigName"
//
// ]
//
// For more information, see [SageMaker API Permissions: Actions, Permissions, and Resources Reference].
//
// [Eventually Consistent Reads]: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html
// [IAM console]: https://console.aws.amazon.com/iam/
// [DescribeEndpoint]: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeEndpoint.html
// [CreateEndpoint]: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html
// [CreateEndpointConfig]: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html
// [DescribeEndpointConfig]: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeEndpointConfig.html
// [Activating and Deactivating Amazon Web Services STS in an Amazon Web Services Region]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html
// [SageMaker API Permissions: Actions, Permissions, and Resources Reference]: https://docs.aws.amazon.com/sagemaker/latest/dg/api-permissions-reference.html
func (c *Client) CreateEndpoint(ctx context.Context, params *CreateEndpointInput, optFns ...func(*Options)) (*CreateEndpointOutput, error) {
if params == nil {
params = &CreateEndpointInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateEndpoint", params, optFns, c.addOperationCreateEndpointMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateEndpointOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateEndpointInput struct {
// The name of an endpoint configuration. For more information, see [CreateEndpointConfig].
//
// [CreateEndpointConfig]: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html
//
// This member is required.
EndpointConfigName *string
// The name of the endpoint.The name must be unique within an Amazon Web Services
// Region in your Amazon Web Services account. The name is case-insensitive in
// CreateEndpoint , but the case is preserved and must be matched in [InvokeEndpoint].
//
// [InvokeEndpoint]: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html
//
// This member is required.
EndpointName *string
// The deployment configuration for an endpoint, which contains the desired
// deployment strategy and rollback configurations.
DeploymentConfig *types.DeploymentConfig
// An array of key-value pairs. You can use tags to categorize your Amazon Web
// Services resources in different ways, for example, by purpose, owner, or
// environment. For more information, see [Tagging Amazon Web Services Resources].
//
// [Tagging Amazon Web Services Resources]: https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateEndpointOutput struct {
// The Amazon Resource Name (ARN) of the endpoint.
//
// This member is required.
EndpointArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateEndpoint{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateEndpoint{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateEndpoint"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = addClientRequestID(stack); err != nil {
return err
}
if err = addComputeContentLength(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = addComputePayloadSHA256(stack); err != nil {
return err
}
if err = addRetry(stack, options); err != nil {
return err
}
if err = addRawResponseToMetadata(stack); err != nil {
return err
}
if err = addRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addOpCreateEndpointValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEndpoint(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateEndpoint(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "CreateEndpoint",
}
}