github.com/aavshr/aws-sdk-go@v1.41.3/service/sagemakerruntime/api.go (about)

     1  // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
     2  
     3  package sagemakerruntime
     4  
     5  import (
     6  	"fmt"
     7  
     8  	"github.com/aavshr/aws-sdk-go/aws"
     9  	"github.com/aavshr/aws-sdk-go/aws/awsutil"
    10  	"github.com/aavshr/aws-sdk-go/aws/request"
    11  	"github.com/aavshr/aws-sdk-go/private/protocol"
    12  )
    13  
    14  const opInvokeEndpoint = "InvokeEndpoint"
    15  
    16  // InvokeEndpointRequest generates a "aws/request.Request" representing the
    17  // client's request for the InvokeEndpoint operation. The "output" return
    18  // value will be populated with the request's response once the request completes
    19  // successfully.
    20  //
    21  // Use "Send" method on the returned Request to send the API call to the service.
    22  // the "output" return value is not valid until after Send returns without error.
    23  //
    24  // See InvokeEndpoint for more information on using the InvokeEndpoint
    25  // API call, and error handling.
    26  //
    27  // This method is useful when you want to inject custom logic or configuration
    28  // into the SDK's request lifecycle. Such as custom headers, or retry logic.
    29  //
    30  //
    31  //    // Example sending a request using the InvokeEndpointRequest method.
    32  //    req, resp := client.InvokeEndpointRequest(params)
    33  //
    34  //    err := req.Send()
    35  //    if err == nil { // resp is now filled
    36  //        fmt.Println(resp)
    37  //    }
    38  //
    39  // See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/InvokeEndpoint
    40  func (c *SageMakerRuntime) InvokeEndpointRequest(input *InvokeEndpointInput) (req *request.Request, output *InvokeEndpointOutput) {
    41  	op := &request.Operation{
    42  		Name:       opInvokeEndpoint,
    43  		HTTPMethod: "POST",
    44  		HTTPPath:   "/endpoints/{EndpointName}/invocations",
    45  	}
    46  
    47  	if input == nil {
    48  		input = &InvokeEndpointInput{}
    49  	}
    50  
    51  	output = &InvokeEndpointOutput{}
    52  	req = c.newRequest(op, input, output)
    53  	return
    54  }
    55  
    56  // InvokeEndpoint API operation for Amazon SageMaker Runtime.
    57  //
    58  // After you deploy a model into production using Amazon SageMaker hosting services,
    59  // your client applications use this API to get inferences from the model hosted
    60  // at the specified endpoint.
    61  //
    62  // For an overview of Amazon SageMaker, see How It Works (https://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works.html).
    63  //
    64  // Amazon SageMaker strips all POST headers except those supported by the API.
    65  // Amazon SageMaker might add additional headers. You should not rely on the
    66  // behavior of headers outside those enumerated in the request syntax.
    67  //
    68  // Calls to InvokeEndpoint are authenticated by using AWS Signature Version
    69  // 4. For information, see Authenticating Requests (AWS Signature Version 4)
    70  // (https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html)
    71  // in the Amazon S3 API Reference.
    72  //
    73  // A customer's model containers must respond to requests within 60 seconds.
    74  // The model itself can have a maximum processing time of 60 seconds before
    75  // responding to invocations. If your model is going to take 50-60 seconds of
    76  // processing time, the SDK socket timeout should be set to be 70 seconds.
    77  //
    78  // Endpoints are scoped to an individual account, and are not public. The URL
    79  // does not contain the account ID, but Amazon SageMaker determines the account
    80  // ID from the authentication token that is supplied by the caller.
    81  //
    82  // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
    83  // with awserr.Error's Code and Message methods to get detailed information about
    84  // the error.
    85  //
    86  // See the AWS API reference guide for Amazon SageMaker Runtime's
    87  // API operation InvokeEndpoint for usage and error information.
    88  //
    89  // Returned Error Types:
    90  //   * InternalFailure
    91  //   An internal failure occurred.
    92  //
    93  //   * ServiceUnavailable
    94  //   The service is unavailable. Try your call again.
    95  //
    96  //   * ValidationError
    97  //   Inspect your request and try again.
    98  //
    99  //   * ModelError
   100  //   Model (owned by the customer in the container) returned 4xx or 5xx error
   101  //   code.
   102  //
   103  // See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/InvokeEndpoint
   104  func (c *SageMakerRuntime) InvokeEndpoint(input *InvokeEndpointInput) (*InvokeEndpointOutput, error) {
   105  	req, out := c.InvokeEndpointRequest(input)
   106  	return out, req.Send()
   107  }
   108  
   109  // InvokeEndpointWithContext is the same as InvokeEndpoint with the addition of
   110  // the ability to pass a context and additional request options.
   111  //
   112  // See InvokeEndpoint for details on how to use this API operation.
   113  //
   114  // The context must be non-nil and will be used for request cancellation. If
   115  // the context is nil a panic will occur. In the future the SDK may create
   116  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   117  // for more information on using Contexts.
   118  func (c *SageMakerRuntime) InvokeEndpointWithContext(ctx aws.Context, input *InvokeEndpointInput, opts ...request.Option) (*InvokeEndpointOutput, error) {
   119  	req, out := c.InvokeEndpointRequest(input)
   120  	req.SetContext(ctx)
   121  	req.ApplyOptions(opts...)
   122  	return out, req.Send()
   123  }
   124  
   125  const opInvokeEndpointAsync = "InvokeEndpointAsync"
   126  
   127  // InvokeEndpointAsyncRequest generates a "aws/request.Request" representing the
   128  // client's request for the InvokeEndpointAsync operation. The "output" return
   129  // value will be populated with the request's response once the request completes
   130  // successfully.
   131  //
   132  // Use "Send" method on the returned Request to send the API call to the service.
   133  // the "output" return value is not valid until after Send returns without error.
   134  //
   135  // See InvokeEndpointAsync for more information on using the InvokeEndpointAsync
   136  // API call, and error handling.
   137  //
   138  // This method is useful when you want to inject custom logic or configuration
   139  // into the SDK's request lifecycle. Such as custom headers, or retry logic.
   140  //
   141  //
   142  //    // Example sending a request using the InvokeEndpointAsyncRequest method.
   143  //    req, resp := client.InvokeEndpointAsyncRequest(params)
   144  //
   145  //    err := req.Send()
   146  //    if err == nil { // resp is now filled
   147  //        fmt.Println(resp)
   148  //    }
   149  //
   150  // See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/InvokeEndpointAsync
   151  func (c *SageMakerRuntime) InvokeEndpointAsyncRequest(input *InvokeEndpointAsyncInput) (req *request.Request, output *InvokeEndpointAsyncOutput) {
   152  	op := &request.Operation{
   153  		Name:       opInvokeEndpointAsync,
   154  		HTTPMethod: "POST",
   155  		HTTPPath:   "/endpoints/{EndpointName}/async-invocations",
   156  	}
   157  
   158  	if input == nil {
   159  		input = &InvokeEndpointAsyncInput{}
   160  	}
   161  
   162  	output = &InvokeEndpointAsyncOutput{}
   163  	req = c.newRequest(op, input, output)
   164  	return
   165  }
   166  
   167  // InvokeEndpointAsync API operation for Amazon SageMaker Runtime.
   168  //
   169  // After you deploy a model into production using Amazon SageMaker hosting services,
   170  // your client applications use this API to get inferences from the model hosted
   171  // at the specified endpoint in an asynchronous manner.
   172  //
   173  // Inference requests sent to this API are enqueued for asynchronous processing.
   174  // The processing of the inference request may or may not complete before the
   175  // you receive a response from this API. The response from this API will not
   176  // contain the result of the inference request but contain information about
   177  // where you can locate it.
   178  //
   179  // Amazon SageMaker strips all POST headers except those supported by the API.
   180  // Amazon SageMaker might add additional headers. You should not rely on the
   181  // behavior of headers outside those enumerated in the request syntax.
   182  //
   183  // Calls to InvokeEndpointAsync are authenticated by using AWS Signature Version
   184  // 4. For information, see Authenticating Requests (AWS Signature Version 4)
   185  // (https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html)
   186  // in the Amazon S3 API Reference.
   187  //
   188  // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
   189  // with awserr.Error's Code and Message methods to get detailed information about
   190  // the error.
   191  //
   192  // See the AWS API reference guide for Amazon SageMaker Runtime's
   193  // API operation InvokeEndpointAsync for usage and error information.
   194  //
   195  // Returned Error Types:
   196  //   * InternalFailure
   197  //   An internal failure occurred.
   198  //
   199  //   * ServiceUnavailable
   200  //   The service is unavailable. Try your call again.
   201  //
   202  //   * ValidationError
   203  //   Inspect your request and try again.
   204  //
   205  // See also, https://docs.aws.amazon.com/goto/WebAPI/runtime.sagemaker-2017-05-13/InvokeEndpointAsync
   206  func (c *SageMakerRuntime) InvokeEndpointAsync(input *InvokeEndpointAsyncInput) (*InvokeEndpointAsyncOutput, error) {
   207  	req, out := c.InvokeEndpointAsyncRequest(input)
   208  	return out, req.Send()
   209  }
   210  
   211  // InvokeEndpointAsyncWithContext is the same as InvokeEndpointAsync with the addition of
   212  // the ability to pass a context and additional request options.
   213  //
   214  // See InvokeEndpointAsync for details on how to use this API operation.
   215  //
   216  // The context must be non-nil and will be used for request cancellation. If
   217  // the context is nil a panic will occur. In the future the SDK may create
   218  // sub-contexts for http.Requests. See https://golang.org/pkg/context/
   219  // for more information on using Contexts.
   220  func (c *SageMakerRuntime) InvokeEndpointAsyncWithContext(ctx aws.Context, input *InvokeEndpointAsyncInput, opts ...request.Option) (*InvokeEndpointAsyncOutput, error) {
   221  	req, out := c.InvokeEndpointAsyncRequest(input)
   222  	req.SetContext(ctx)
   223  	req.ApplyOptions(opts...)
   224  	return out, req.Send()
   225  }
   226  
   227  // An internal failure occurred.
   228  type InternalFailure struct {
   229  	_            struct{}                  `type:"structure"`
   230  	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
   231  
   232  	Message_ *string `locationName:"Message" type:"string"`
   233  }
   234  
   235  // String returns the string representation.
   236  //
   237  // API parameter values that are decorated as "sensitive" in the API will not
   238  // be included in the string output. The member name will be present, but the
   239  // value will be replaced with "sensitive".
   240  func (s InternalFailure) String() string {
   241  	return awsutil.Prettify(s)
   242  }
   243  
   244  // GoString returns the string representation.
   245  //
   246  // API parameter values that are decorated as "sensitive" in the API will not
   247  // be included in the string output. The member name will be present, but the
   248  // value will be replaced with "sensitive".
   249  func (s InternalFailure) GoString() string {
   250  	return s.String()
   251  }
   252  
   253  func newErrorInternalFailure(v protocol.ResponseMetadata) error {
   254  	return &InternalFailure{
   255  		RespMetadata: v,
   256  	}
   257  }
   258  
   259  // Code returns the exception type name.
   260  func (s *InternalFailure) Code() string {
   261  	return "InternalFailure"
   262  }
   263  
   264  // Message returns the exception's message.
   265  func (s *InternalFailure) Message() string {
   266  	if s.Message_ != nil {
   267  		return *s.Message_
   268  	}
   269  	return ""
   270  }
   271  
   272  // OrigErr always returns nil, satisfies awserr.Error interface.
   273  func (s *InternalFailure) OrigErr() error {
   274  	return nil
   275  }
   276  
   277  func (s *InternalFailure) Error() string {
   278  	return fmt.Sprintf("%s: %s", s.Code(), s.Message())
   279  }
   280  
   281  // Status code returns the HTTP status code for the request's response error.
   282  func (s *InternalFailure) StatusCode() int {
   283  	return s.RespMetadata.StatusCode
   284  }
   285  
   286  // RequestID returns the service's response RequestID for request.
   287  func (s *InternalFailure) RequestID() string {
   288  	return s.RespMetadata.RequestID
   289  }
   290  
   291  type InvokeEndpointAsyncInput struct {
   292  	_ struct{} `type:"structure" nopayload:"true"`
   293  
   294  	// The desired MIME type of the inference in the response.
   295  	Accept *string `location:"header" locationName:"X-Amzn-SageMaker-Accept" type:"string"`
   296  
   297  	// The MIME type of the input data in the request body.
   298  	ContentType *string `location:"header" locationName:"X-Amzn-SageMaker-Content-Type" type:"string"`
   299  
   300  	// Provides additional information about a request for an inference submitted
   301  	// to a model hosted at an Amazon SageMaker endpoint. The information is an
   302  	// opaque value that is forwarded verbatim. You could use this value, for example,
   303  	// to provide an ID that you can use to track a request or to provide other
   304  	// metadata that a service endpoint was programmed to process. The value must
   305  	// consist of no more than 1024 visible US-ASCII characters as specified in
   306  	// Section 3.3.6. Field Value Components (https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6)
   307  	// of the Hypertext Transfer Protocol (HTTP/1.1).
   308  	//
   309  	// The code in your model is responsible for setting or updating any custom
   310  	// attributes in the response. If your code does not set this value in the response,
   311  	// an empty value is returned. For example, if a custom attribute represents
   312  	// the trace ID, your model can prepend the custom attribute with Trace ID:
   313  	// in your post-processing function.
   314  	//
   315  	// This feature is currently supported in the AWS SDKs but not in the Amazon
   316  	// SageMaker Python SDK.
   317  	//
   318  	// CustomAttributes is a sensitive parameter and its value will be
   319  	// replaced with "sensitive" in string returned by InvokeEndpointAsyncInput's
   320  	// String and GoString methods.
   321  	CustomAttributes *string `location:"header" locationName:"X-Amzn-SageMaker-Custom-Attributes" type:"string" sensitive:"true"`
   322  
   323  	// The name of the endpoint that you specified when you created the endpoint
   324  	// using the CreateEndpoint (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html)
   325  	// API.
   326  	//
   327  	// EndpointName is a required field
   328  	EndpointName *string `location:"uri" locationName:"EndpointName" type:"string" required:"true"`
   329  
   330  	// The identifier for the inference request. Amazon SageMaker will generate
   331  	// an identifier for you if none is specified.
   332  	InferenceId *string `location:"header" locationName:"X-Amzn-SageMaker-Inference-Id" min:"1" type:"string"`
   333  
   334  	// The Amazon S3 URI where the inference request payload is stored.
   335  	//
   336  	// InputLocation is a required field
   337  	InputLocation *string `location:"header" locationName:"X-Amzn-SageMaker-InputLocation" min:"1" type:"string" required:"true"`
   338  
   339  	// Maximum age in seconds a request can be in the queue before it is marked
   340  	// as expired.
   341  	RequestTTLSeconds *int64 `location:"header" locationName:"X-Amzn-SageMaker-RequestTTLSeconds" min:"60" type:"integer"`
   342  }
   343  
   344  // String returns the string representation.
   345  //
   346  // API parameter values that are decorated as "sensitive" in the API will not
   347  // be included in the string output. The member name will be present, but the
   348  // value will be replaced with "sensitive".
   349  func (s InvokeEndpointAsyncInput) String() string {
   350  	return awsutil.Prettify(s)
   351  }
   352  
   353  // GoString returns the string representation.
   354  //
   355  // API parameter values that are decorated as "sensitive" in the API will not
   356  // be included in the string output. The member name will be present, but the
   357  // value will be replaced with "sensitive".
   358  func (s InvokeEndpointAsyncInput) GoString() string {
   359  	return s.String()
   360  }
   361  
   362  // Validate inspects the fields of the type to determine if they are valid.
   363  func (s *InvokeEndpointAsyncInput) Validate() error {
   364  	invalidParams := request.ErrInvalidParams{Context: "InvokeEndpointAsyncInput"}
   365  	if s.EndpointName == nil {
   366  		invalidParams.Add(request.NewErrParamRequired("EndpointName"))
   367  	}
   368  	if s.EndpointName != nil && len(*s.EndpointName) < 1 {
   369  		invalidParams.Add(request.NewErrParamMinLen("EndpointName", 1))
   370  	}
   371  	if s.InferenceId != nil && len(*s.InferenceId) < 1 {
   372  		invalidParams.Add(request.NewErrParamMinLen("InferenceId", 1))
   373  	}
   374  	if s.InputLocation == nil {
   375  		invalidParams.Add(request.NewErrParamRequired("InputLocation"))
   376  	}
   377  	if s.InputLocation != nil && len(*s.InputLocation) < 1 {
   378  		invalidParams.Add(request.NewErrParamMinLen("InputLocation", 1))
   379  	}
   380  	if s.RequestTTLSeconds != nil && *s.RequestTTLSeconds < 60 {
   381  		invalidParams.Add(request.NewErrParamMinValue("RequestTTLSeconds", 60))
   382  	}
   383  
   384  	if invalidParams.Len() > 0 {
   385  		return invalidParams
   386  	}
   387  	return nil
   388  }
   389  
   390  // SetAccept sets the Accept field's value.
   391  func (s *InvokeEndpointAsyncInput) SetAccept(v string) *InvokeEndpointAsyncInput {
   392  	s.Accept = &v
   393  	return s
   394  }
   395  
   396  // SetContentType sets the ContentType field's value.
   397  func (s *InvokeEndpointAsyncInput) SetContentType(v string) *InvokeEndpointAsyncInput {
   398  	s.ContentType = &v
   399  	return s
   400  }
   401  
   402  // SetCustomAttributes sets the CustomAttributes field's value.
   403  func (s *InvokeEndpointAsyncInput) SetCustomAttributes(v string) *InvokeEndpointAsyncInput {
   404  	s.CustomAttributes = &v
   405  	return s
   406  }
   407  
   408  // SetEndpointName sets the EndpointName field's value.
   409  func (s *InvokeEndpointAsyncInput) SetEndpointName(v string) *InvokeEndpointAsyncInput {
   410  	s.EndpointName = &v
   411  	return s
   412  }
   413  
   414  // SetInferenceId sets the InferenceId field's value.
   415  func (s *InvokeEndpointAsyncInput) SetInferenceId(v string) *InvokeEndpointAsyncInput {
   416  	s.InferenceId = &v
   417  	return s
   418  }
   419  
   420  // SetInputLocation sets the InputLocation field's value.
   421  func (s *InvokeEndpointAsyncInput) SetInputLocation(v string) *InvokeEndpointAsyncInput {
   422  	s.InputLocation = &v
   423  	return s
   424  }
   425  
   426  // SetRequestTTLSeconds sets the RequestTTLSeconds field's value.
   427  func (s *InvokeEndpointAsyncInput) SetRequestTTLSeconds(v int64) *InvokeEndpointAsyncInput {
   428  	s.RequestTTLSeconds = &v
   429  	return s
   430  }
   431  
   432  type InvokeEndpointAsyncOutput struct {
   433  	_ struct{} `type:"structure"`
   434  
   435  	// Identifier for an inference request. This will be the same as the InferenceId
   436  	// specified in the input. Amazon SageMaker will generate an identifier for
   437  	// you if you do not specify one.
   438  	InferenceId *string `type:"string"`
   439  
   440  	// The Amazon S3 URI where the inference response payload is stored.
   441  	OutputLocation *string `location:"header" locationName:"X-Amzn-SageMaker-OutputLocation" type:"string"`
   442  }
   443  
   444  // String returns the string representation.
   445  //
   446  // API parameter values that are decorated as "sensitive" in the API will not
   447  // be included in the string output. The member name will be present, but the
   448  // value will be replaced with "sensitive".
   449  func (s InvokeEndpointAsyncOutput) String() string {
   450  	return awsutil.Prettify(s)
   451  }
   452  
   453  // GoString returns the string representation.
   454  //
   455  // API parameter values that are decorated as "sensitive" in the API will not
   456  // be included in the string output. The member name will be present, but the
   457  // value will be replaced with "sensitive".
   458  func (s InvokeEndpointAsyncOutput) GoString() string {
   459  	return s.String()
   460  }
   461  
   462  // SetInferenceId sets the InferenceId field's value.
   463  func (s *InvokeEndpointAsyncOutput) SetInferenceId(v string) *InvokeEndpointAsyncOutput {
   464  	s.InferenceId = &v
   465  	return s
   466  }
   467  
   468  // SetOutputLocation sets the OutputLocation field's value.
   469  func (s *InvokeEndpointAsyncOutput) SetOutputLocation(v string) *InvokeEndpointAsyncOutput {
   470  	s.OutputLocation = &v
   471  	return s
   472  }
   473  
   474  type InvokeEndpointInput struct {
   475  	_ struct{} `type:"structure" payload:"Body"`
   476  
   477  	// The desired MIME type of the inference in the response.
   478  	Accept *string `location:"header" locationName:"Accept" type:"string"`
   479  
   480  	// Provides input data, in the format specified in the ContentType request header.
   481  	// Amazon SageMaker passes all of the data in the body to the model.
   482  	//
   483  	// For information about the format of the request body, see Common Data Formats-Inference
   484  	// (https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html).
   485  	//
   486  	// Body is a sensitive parameter and its value will be
   487  	// replaced with "sensitive" in string returned by InvokeEndpointInput's
   488  	// String and GoString methods.
   489  	//
   490  	// Body is a required field
   491  	Body []byte `type:"blob" required:"true" sensitive:"true"`
   492  
   493  	// The MIME type of the input data in the request body.
   494  	ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
   495  
   496  	// Provides additional information about a request for an inference submitted
   497  	// to a model hosted at an Amazon SageMaker endpoint. The information is an
   498  	// opaque value that is forwarded verbatim. You could use this value, for example,
   499  	// to provide an ID that you can use to track a request or to provide other
   500  	// metadata that a service endpoint was programmed to process. The value must
   501  	// consist of no more than 1024 visible US-ASCII characters as specified in
   502  	// Section 3.3.6. Field Value Components (https://tools.ietf.org/html/rfc7230#section-3.2.6)
   503  	// of the Hypertext Transfer Protocol (HTTP/1.1).
   504  	//
   505  	// The code in your model is responsible for setting or updating any custom
   506  	// attributes in the response. If your code does not set this value in the response,
   507  	// an empty value is returned. For example, if a custom attribute represents
   508  	// the trace ID, your model can prepend the custom attribute with Trace ID:
   509  	// in your post-processing function.
   510  	//
   511  	// This feature is currently supported in the AWS SDKs but not in the Amazon
   512  	// SageMaker Python SDK.
   513  	//
   514  	// CustomAttributes is a sensitive parameter and its value will be
   515  	// replaced with "sensitive" in string returned by InvokeEndpointInput's
   516  	// String and GoString methods.
   517  	CustomAttributes *string `location:"header" locationName:"X-Amzn-SageMaker-Custom-Attributes" type:"string" sensitive:"true"`
   518  
   519  	// The name of the endpoint that you specified when you created the endpoint
   520  	// using the CreateEndpoint (https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html)
   521  	// API.
   522  	//
   523  	// EndpointName is a required field
   524  	EndpointName *string `location:"uri" locationName:"EndpointName" type:"string" required:"true"`
   525  
   526  	// If you provide a value, it is added to the captured data when you enable
   527  	// data capture on the endpoint. For information about data capture, see Capture
   528  	// Data (https://docs.aws.amazon.com/sagemaker/latest/dg/model-monitor-data-capture.html).
   529  	InferenceId *string `location:"header" locationName:"X-Amzn-SageMaker-Inference-Id" min:"1" type:"string"`
   530  
   531  	// If the endpoint hosts multiple containers and is configured to use direct
   532  	// invocation, this parameter specifies the host name of the container to invoke.
   533  	TargetContainerHostname *string `location:"header" locationName:"X-Amzn-SageMaker-Target-Container-Hostname" type:"string"`
   534  
   535  	// The model to request for inference when invoking a multi-model endpoint.
   536  	TargetModel *string `location:"header" locationName:"X-Amzn-SageMaker-Target-Model" min:"1" type:"string"`
   537  
   538  	// Specify the production variant to send the inference request to when invoking
   539  	// an endpoint that is running two or more variants. Note that this parameter
   540  	// overrides the default behavior for the endpoint, which is to distribute the
   541  	// invocation traffic based on the variant weights.
   542  	//
   543  	// For information about how to use variant targeting to perform a/b testing,
   544  	// see Test models in production (https://docs.aws.amazon.com/sagemaker/latest/dg/model-ab-testing.html)
   545  	TargetVariant *string `location:"header" locationName:"X-Amzn-SageMaker-Target-Variant" type:"string"`
   546  }
   547  
   548  // String returns the string representation.
   549  //
   550  // API parameter values that are decorated as "sensitive" in the API will not
   551  // be included in the string output. The member name will be present, but the
   552  // value will be replaced with "sensitive".
   553  func (s InvokeEndpointInput) String() string {
   554  	return awsutil.Prettify(s)
   555  }
   556  
   557  // GoString returns the string representation.
   558  //
   559  // API parameter values that are decorated as "sensitive" in the API will not
   560  // be included in the string output. The member name will be present, but the
   561  // value will be replaced with "sensitive".
   562  func (s InvokeEndpointInput) GoString() string {
   563  	return s.String()
   564  }
   565  
   566  // Validate inspects the fields of the type to determine if they are valid.
   567  func (s *InvokeEndpointInput) Validate() error {
   568  	invalidParams := request.ErrInvalidParams{Context: "InvokeEndpointInput"}
   569  	if s.Body == nil {
   570  		invalidParams.Add(request.NewErrParamRequired("Body"))
   571  	}
   572  	if s.EndpointName == nil {
   573  		invalidParams.Add(request.NewErrParamRequired("EndpointName"))
   574  	}
   575  	if s.EndpointName != nil && len(*s.EndpointName) < 1 {
   576  		invalidParams.Add(request.NewErrParamMinLen("EndpointName", 1))
   577  	}
   578  	if s.InferenceId != nil && len(*s.InferenceId) < 1 {
   579  		invalidParams.Add(request.NewErrParamMinLen("InferenceId", 1))
   580  	}
   581  	if s.TargetModel != nil && len(*s.TargetModel) < 1 {
   582  		invalidParams.Add(request.NewErrParamMinLen("TargetModel", 1))
   583  	}
   584  
   585  	if invalidParams.Len() > 0 {
   586  		return invalidParams
   587  	}
   588  	return nil
   589  }
   590  
   591  // SetAccept sets the Accept field's value.
   592  func (s *InvokeEndpointInput) SetAccept(v string) *InvokeEndpointInput {
   593  	s.Accept = &v
   594  	return s
   595  }
   596  
   597  // SetBody sets the Body field's value.
   598  func (s *InvokeEndpointInput) SetBody(v []byte) *InvokeEndpointInput {
   599  	s.Body = v
   600  	return s
   601  }
   602  
   603  // SetContentType sets the ContentType field's value.
   604  func (s *InvokeEndpointInput) SetContentType(v string) *InvokeEndpointInput {
   605  	s.ContentType = &v
   606  	return s
   607  }
   608  
   609  // SetCustomAttributes sets the CustomAttributes field's value.
   610  func (s *InvokeEndpointInput) SetCustomAttributes(v string) *InvokeEndpointInput {
   611  	s.CustomAttributes = &v
   612  	return s
   613  }
   614  
   615  // SetEndpointName sets the EndpointName field's value.
   616  func (s *InvokeEndpointInput) SetEndpointName(v string) *InvokeEndpointInput {
   617  	s.EndpointName = &v
   618  	return s
   619  }
   620  
   621  // SetInferenceId sets the InferenceId field's value.
   622  func (s *InvokeEndpointInput) SetInferenceId(v string) *InvokeEndpointInput {
   623  	s.InferenceId = &v
   624  	return s
   625  }
   626  
   627  // SetTargetContainerHostname sets the TargetContainerHostname field's value.
   628  func (s *InvokeEndpointInput) SetTargetContainerHostname(v string) *InvokeEndpointInput {
   629  	s.TargetContainerHostname = &v
   630  	return s
   631  }
   632  
   633  // SetTargetModel sets the TargetModel field's value.
   634  func (s *InvokeEndpointInput) SetTargetModel(v string) *InvokeEndpointInput {
   635  	s.TargetModel = &v
   636  	return s
   637  }
   638  
   639  // SetTargetVariant sets the TargetVariant field's value.
   640  func (s *InvokeEndpointInput) SetTargetVariant(v string) *InvokeEndpointInput {
   641  	s.TargetVariant = &v
   642  	return s
   643  }
   644  
   645  type InvokeEndpointOutput struct {
   646  	_ struct{} `type:"structure" payload:"Body"`
   647  
   648  	// Includes the inference provided by the model.
   649  	//
   650  	// For information about the format of the response body, see Common Data Formats-Inference
   651  	// (https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html).
   652  	//
   653  	// Body is a sensitive parameter and its value will be
   654  	// replaced with "sensitive" in string returned by InvokeEndpointOutput's
   655  	// String and GoString methods.
   656  	//
   657  	// Body is a required field
   658  	Body []byte `type:"blob" required:"true" sensitive:"true"`
   659  
   660  	// The MIME type of the inference returned in the response body.
   661  	ContentType *string `location:"header" locationName:"Content-Type" type:"string"`
   662  
   663  	// Provides additional information in the response about the inference returned
   664  	// by a model hosted at an Amazon SageMaker endpoint. The information is an
   665  	// opaque value that is forwarded verbatim. You could use this value, for example,
   666  	// to return an ID received in the CustomAttributes header of a request or other
   667  	// metadata that a service endpoint was programmed to produce. The value must
   668  	// consist of no more than 1024 visible US-ASCII characters as specified in
   669  	// Section 3.3.6. Field Value Components (https://tools.ietf.org/html/rfc7230#section-3.2.6)
   670  	// of the Hypertext Transfer Protocol (HTTP/1.1). If the customer wants the
   671  	// custom attribute returned, the model must set the custom attribute to be
   672  	// included on the way back.
   673  	//
   674  	// The code in your model is responsible for setting or updating any custom
   675  	// attributes in the response. If your code does not set this value in the response,
   676  	// an empty value is returned. For example, if a custom attribute represents
   677  	// the trace ID, your model can prepend the custom attribute with Trace ID:
   678  	// in your post-processing function.
   679  	//
   680  	// This feature is currently supported in the AWS SDKs but not in the Amazon
   681  	// SageMaker Python SDK.
   682  	//
   683  	// CustomAttributes is a sensitive parameter and its value will be
   684  	// replaced with "sensitive" in string returned by InvokeEndpointOutput's
   685  	// String and GoString methods.
   686  	CustomAttributes *string `location:"header" locationName:"X-Amzn-SageMaker-Custom-Attributes" type:"string" sensitive:"true"`
   687  
   688  	// Identifies the production variant that was invoked.
   689  	InvokedProductionVariant *string `location:"header" locationName:"x-Amzn-Invoked-Production-Variant" type:"string"`
   690  }
   691  
   692  // String returns the string representation.
   693  //
   694  // API parameter values that are decorated as "sensitive" in the API will not
   695  // be included in the string output. The member name will be present, but the
   696  // value will be replaced with "sensitive".
   697  func (s InvokeEndpointOutput) String() string {
   698  	return awsutil.Prettify(s)
   699  }
   700  
   701  // GoString returns the string representation.
   702  //
   703  // API parameter values that are decorated as "sensitive" in the API will not
   704  // be included in the string output. The member name will be present, but the
   705  // value will be replaced with "sensitive".
   706  func (s InvokeEndpointOutput) GoString() string {
   707  	return s.String()
   708  }
   709  
   710  // SetBody sets the Body field's value.
   711  func (s *InvokeEndpointOutput) SetBody(v []byte) *InvokeEndpointOutput {
   712  	s.Body = v
   713  	return s
   714  }
   715  
   716  // SetContentType sets the ContentType field's value.
   717  func (s *InvokeEndpointOutput) SetContentType(v string) *InvokeEndpointOutput {
   718  	s.ContentType = &v
   719  	return s
   720  }
   721  
   722  // SetCustomAttributes sets the CustomAttributes field's value.
   723  func (s *InvokeEndpointOutput) SetCustomAttributes(v string) *InvokeEndpointOutput {
   724  	s.CustomAttributes = &v
   725  	return s
   726  }
   727  
   728  // SetInvokedProductionVariant sets the InvokedProductionVariant field's value.
   729  func (s *InvokeEndpointOutput) SetInvokedProductionVariant(v string) *InvokeEndpointOutput {
   730  	s.InvokedProductionVariant = &v
   731  	return s
   732  }
   733  
   734  // Model (owned by the customer in the container) returned 4xx or 5xx error
   735  // code.
   736  type ModelError struct {
   737  	_            struct{}                  `type:"structure"`
   738  	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
   739  
   740  	// The Amazon Resource Name (ARN) of the log stream.
   741  	LogStreamArn *string `type:"string"`
   742  
   743  	Message_ *string `locationName:"Message" type:"string"`
   744  
   745  	// Original message.
   746  	OriginalMessage *string `type:"string"`
   747  
   748  	// Original status code.
   749  	OriginalStatusCode *int64 `type:"integer"`
   750  }
   751  
   752  // String returns the string representation.
   753  //
   754  // API parameter values that are decorated as "sensitive" in the API will not
   755  // be included in the string output. The member name will be present, but the
   756  // value will be replaced with "sensitive".
   757  func (s ModelError) String() string {
   758  	return awsutil.Prettify(s)
   759  }
   760  
   761  // GoString returns the string representation.
   762  //
   763  // API parameter values that are decorated as "sensitive" in the API will not
   764  // be included in the string output. The member name will be present, but the
   765  // value will be replaced with "sensitive".
   766  func (s ModelError) GoString() string {
   767  	return s.String()
   768  }
   769  
   770  func newErrorModelError(v protocol.ResponseMetadata) error {
   771  	return &ModelError{
   772  		RespMetadata: v,
   773  	}
   774  }
   775  
   776  // Code returns the exception type name.
   777  func (s *ModelError) Code() string {
   778  	return "ModelError"
   779  }
   780  
   781  // Message returns the exception's message.
   782  func (s *ModelError) Message() string {
   783  	if s.Message_ != nil {
   784  		return *s.Message_
   785  	}
   786  	return ""
   787  }
   788  
   789  // OrigErr always returns nil, satisfies awserr.Error interface.
   790  func (s *ModelError) OrigErr() error {
   791  	return nil
   792  }
   793  
   794  func (s *ModelError) Error() string {
   795  	return fmt.Sprintf("%s: %s\n%s", s.Code(), s.Message(), s.String())
   796  }
   797  
   798  // Status code returns the HTTP status code for the request's response error.
   799  func (s *ModelError) StatusCode() int {
   800  	return s.RespMetadata.StatusCode
   801  }
   802  
   803  // RequestID returns the service's response RequestID for request.
   804  func (s *ModelError) RequestID() string {
   805  	return s.RespMetadata.RequestID
   806  }
   807  
   808  // The service is unavailable. Try your call again.
   809  type ServiceUnavailable struct {
   810  	_            struct{}                  `type:"structure"`
   811  	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
   812  
   813  	Message_ *string `locationName:"Message" type:"string"`
   814  }
   815  
   816  // String returns the string representation.
   817  //
   818  // API parameter values that are decorated as "sensitive" in the API will not
   819  // be included in the string output. The member name will be present, but the
   820  // value will be replaced with "sensitive".
   821  func (s ServiceUnavailable) String() string {
   822  	return awsutil.Prettify(s)
   823  }
   824  
   825  // GoString returns the string representation.
   826  //
   827  // API parameter values that are decorated as "sensitive" in the API will not
   828  // be included in the string output. The member name will be present, but the
   829  // value will be replaced with "sensitive".
   830  func (s ServiceUnavailable) GoString() string {
   831  	return s.String()
   832  }
   833  
   834  func newErrorServiceUnavailable(v protocol.ResponseMetadata) error {
   835  	return &ServiceUnavailable{
   836  		RespMetadata: v,
   837  	}
   838  }
   839  
   840  // Code returns the exception type name.
   841  func (s *ServiceUnavailable) Code() string {
   842  	return "ServiceUnavailable"
   843  }
   844  
   845  // Message returns the exception's message.
   846  func (s *ServiceUnavailable) Message() string {
   847  	if s.Message_ != nil {
   848  		return *s.Message_
   849  	}
   850  	return ""
   851  }
   852  
   853  // OrigErr always returns nil, satisfies awserr.Error interface.
   854  func (s *ServiceUnavailable) OrigErr() error {
   855  	return nil
   856  }
   857  
   858  func (s *ServiceUnavailable) Error() string {
   859  	return fmt.Sprintf("%s: %s", s.Code(), s.Message())
   860  }
   861  
   862  // Status code returns the HTTP status code for the request's response error.
   863  func (s *ServiceUnavailable) StatusCode() int {
   864  	return s.RespMetadata.StatusCode
   865  }
   866  
   867  // RequestID returns the service's response RequestID for request.
   868  func (s *ServiceUnavailable) RequestID() string {
   869  	return s.RespMetadata.RequestID
   870  }
   871  
   872  // Inspect your request and try again.
   873  type ValidationError struct {
   874  	_            struct{}                  `type:"structure"`
   875  	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
   876  
   877  	Message_ *string `locationName:"Message" type:"string"`
   878  }
   879  
   880  // String returns the string representation.
   881  //
   882  // API parameter values that are decorated as "sensitive" in the API will not
   883  // be included in the string output. The member name will be present, but the
   884  // value will be replaced with "sensitive".
   885  func (s ValidationError) String() string {
   886  	return awsutil.Prettify(s)
   887  }
   888  
   889  // GoString returns the string representation.
   890  //
   891  // API parameter values that are decorated as "sensitive" in the API will not
   892  // be included in the string output. The member name will be present, but the
   893  // value will be replaced with "sensitive".
   894  func (s ValidationError) GoString() string {
   895  	return s.String()
   896  }
   897  
   898  func newErrorValidationError(v protocol.ResponseMetadata) error {
   899  	return &ValidationError{
   900  		RespMetadata: v,
   901  	}
   902  }
   903  
   904  // Code returns the exception type name.
   905  func (s *ValidationError) Code() string {
   906  	return "ValidationError"
   907  }
   908  
   909  // Message returns the exception's message.
   910  func (s *ValidationError) Message() string {
   911  	if s.Message_ != nil {
   912  		return *s.Message_
   913  	}
   914  	return ""
   915  }
   916  
   917  // OrigErr always returns nil, satisfies awserr.Error interface.
   918  func (s *ValidationError) OrigErr() error {
   919  	return nil
   920  }
   921  
   922  func (s *ValidationError) Error() string {
   923  	return fmt.Sprintf("%s: %s", s.Code(), s.Message())
   924  }
   925  
   926  // Status code returns the HTTP status code for the request's response error.
   927  func (s *ValidationError) StatusCode() int {
   928  	return s.RespMetadata.StatusCode
   929  }
   930  
   931  // RequestID returns the service's response RequestID for request.
   932  func (s *ValidationError) RequestID() string {
   933  	return s.RespMetadata.RequestID
   934  }