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 231 232 233 234 235 236 237 238 239 240 241
|
// 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/aws/signer/v4"
"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 configuration that SageMaker hosting services uses to
// deploy models. In the configuration, you identify one or more models, created
// using the CreateModel API, to deploy and the resources that you want SageMaker
// to provision. Then you call the CreateEndpoint (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html)
// API. Use this API if you want to use SageMaker hosting services to deploy models
// into production. In the request, you define a ProductionVariant , for each model
// that you want to deploy. Each ProductionVariant parameter also describes the
// resources that you want SageMaker to provision. This includes the number and
// type of ML compute instances to deploy. If you are hosting multiple models, you
// also assign a VariantWeight to specify how much traffic you want to allocate to
// each model. For example, suppose that you want to host two models, A and B, and
// you assign traffic weight 2 for model A and 1 for model B. SageMaker distributes
// two-thirds of the traffic to Model A, and one-third to model B. When you call
// CreateEndpoint (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html)
// , 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 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html)
// , 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 (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeEndpointConfig.html)
// before calling CreateEndpoint (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html)
// to minimize the potential impact of a DynamoDB eventually consistent read.
func (c *Client) CreateEndpointConfig(ctx context.Context, params *CreateEndpointConfigInput, optFns ...func(*Options)) (*CreateEndpointConfigOutput, error) {
if params == nil {
params = &CreateEndpointConfigInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateEndpointConfig", params, optFns, c.addOperationCreateEndpointConfigMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateEndpointConfigOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateEndpointConfigInput struct {
// The name of the endpoint configuration. You specify this name in a
// CreateEndpoint (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html)
// request.
//
// This member is required.
EndpointConfigName *string
// An array of ProductionVariant objects, one for each model that you want to host
// at this endpoint.
//
// This member is required.
ProductionVariants []types.ProductionVariant
// Specifies configuration for how an endpoint performs asynchronous inference.
// This is a required field in order for your Endpoint to be invoked using
// InvokeEndpointAsync (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpointAsync.html)
// .
AsyncInferenceConfig *types.AsyncInferenceConfig
// Configuration to control how SageMaker captures inference data.
DataCaptureConfig *types.DataCaptureConfig
// Sets whether all model containers deployed to the endpoint are isolated. If
// they are, no inbound or outbound network calls can be made to or from the model
// containers.
EnableNetworkIsolation *bool
// The Amazon Resource Name (ARN) of an IAM role that Amazon SageMaker can assume
// to perform actions on your behalf. For more information, see SageMaker Roles (https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html)
// . To be able to pass this role to Amazon SageMaker, the caller of this action
// must have the iam:PassRole permission.
ExecutionRoleArn *string
// A member of CreateEndpointConfig that enables explainers.
ExplainerConfig *types.ExplainerConfig
// The Amazon Resource Name (ARN) of a Amazon Web Services Key Management Service
// key that SageMaker uses to encrypt data on the storage volume attached to the ML
// compute instance that hosts the endpoint. The KmsKeyId can be any of the
// following formats:
// - Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
// - Key ARN:
// arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
// - Alias name: alias/ExampleAlias
// - Alias name ARN: arn:aws:kms:us-west-2:111122223333:alias/ExampleAlias
// The KMS key policy must grant permission to the IAM role that you specify in
// your CreateEndpoint , UpdateEndpoint requests. For more information, refer to
// the Amazon Web Services Key Management Service section Using Key Policies in
// Amazon Web Services KMS (https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)
// Certain Nitro-based instances include local storage, dependent on the instance
// type. Local storage volumes are encrypted using a hardware module on the
// instance. You can't request a KmsKeyId when using an instance type with local
// storage. If any of the models that you specify in the ProductionVariants
// parameter use nitro-based instances with local storage, do not specify a value
// for the KmsKeyId parameter. If you specify a value for KmsKeyId when using any
// nitro-based instances with local storage, the call to CreateEndpointConfig
// fails. For a list of instance types that support local instance storage, see
// Instance Store Volumes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes)
// . For more information about local instance storage encryption, see SSD
// Instance Store Volumes (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssd-instance-store.html)
// .
KmsKeyId *string
// An array of ProductionVariant objects, one for each model that you want to host
// at this endpoint in shadow mode with production traffic replicated from the
// model specified on ProductionVariants . If you use this field, you can only
// specify one variant for ProductionVariants and one variant for
// ShadowProductionVariants .
ShadowProductionVariants []types.ProductionVariant
// 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 (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)
// .
Tags []types.Tag
// Specifies an Amazon Virtual Private Cloud (VPC) that your SageMaker jobs,
// hosted models, and compute resources have access to. You can control access to
// and from your resources by configuring a VPC. For more information, see Give
// SageMaker Access to Resources in your Amazon VPC (https://docs.aws.amazon.com/sagemaker/latest/dg/infrastructure-give-access.html)
// .
VpcConfig *types.VpcConfig
noSmithyDocumentSerde
}
type CreateEndpointConfigOutput struct {
// The Amazon Resource Name (ARN) of the endpoint configuration.
//
// This member is required.
EndpointConfigArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateEndpointConfigMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateEndpointConfig{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateEndpointConfig{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateEndpointConfig"); 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 = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
return err
}
if err = addRetryMiddlewares(stack, options); err != nil {
return err
}
if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
return err
}
if err = awsmiddleware.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 = addOpCreateEndpointConfigValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEndpointConfig(options.Region), middleware.Before); err != nil {
return err
}
if err = awsmiddleware.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_opCreateEndpointConfig(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "CreateEndpointConfig",
}
}
|