github.com/aavshr/aws-sdk-go@v1.41.3/service/sagemaker/service.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package sagemaker 4 5 import ( 6 "github.com/aavshr/aws-sdk-go/aws" 7 "github.com/aavshr/aws-sdk-go/aws/client" 8 "github.com/aavshr/aws-sdk-go/aws/client/metadata" 9 "github.com/aavshr/aws-sdk-go/aws/request" 10 "github.com/aavshr/aws-sdk-go/aws/signer/v4" 11 "github.com/aavshr/aws-sdk-go/private/protocol" 12 "github.com/aavshr/aws-sdk-go/private/protocol/jsonrpc" 13 ) 14 15 // SageMaker provides the API operation methods for making requests to 16 // Amazon SageMaker Service. See this package's package overview docs 17 // for details on the service. 18 // 19 // SageMaker methods are safe to use concurrently. It is not safe to 20 // modify mutate any of the struct's properties though. 21 type SageMaker struct { 22 *client.Client 23 } 24 25 // Used for custom client initialization logic 26 var initClient func(*client.Client) 27 28 // Used for custom request initialization logic 29 var initRequest func(*request.Request) 30 31 // Service information constants 32 const ( 33 ServiceName = "sagemaker" // Name of service. 34 EndpointsID = "api.sagemaker" // ID to lookup a service endpoint with. 35 ServiceID = "SageMaker" // ServiceID is a unique identifier of a specific service. 36 ) 37 38 // New creates a new instance of the SageMaker client with a session. 39 // If additional configuration is needed for the client instance use the optional 40 // aws.Config parameter to add your extra config. 41 // 42 // Example: 43 // mySession := session.Must(session.NewSession()) 44 // 45 // // Create a SageMaker client from just a session. 46 // svc := sagemaker.New(mySession) 47 // 48 // // Create a SageMaker client with additional configuration 49 // svc := sagemaker.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 50 func New(p client.ConfigProvider, cfgs ...*aws.Config) *SageMaker { 51 c := p.ClientConfig(EndpointsID, cfgs...) 52 if c.SigningNameDerived || len(c.SigningName) == 0 { 53 c.SigningName = "sagemaker" 54 } 55 return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName) 56 } 57 58 // newClient creates, initializes and returns a new service client instance. 59 func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *SageMaker { 60 svc := &SageMaker{ 61 Client: client.New( 62 cfg, 63 metadata.ClientInfo{ 64 ServiceName: ServiceName, 65 ServiceID: ServiceID, 66 SigningName: signingName, 67 SigningRegion: signingRegion, 68 PartitionID: partitionID, 69 Endpoint: endpoint, 70 APIVersion: "2017-07-24", 71 JSONVersion: "1.1", 72 TargetPrefix: "SageMaker", 73 }, 74 handlers, 75 ), 76 } 77 78 // Handlers 79 svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 80 svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) 81 svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) 82 svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) 83 svc.Handlers.UnmarshalError.PushBackNamed( 84 protocol.NewUnmarshalErrorHandler(jsonrpc.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(), 85 ) 86 87 // Run custom client initialization if present 88 if initClient != nil { 89 initClient(svc.Client) 90 } 91 92 return svc 93 } 94 95 // newRequest creates a new request for a SageMaker operation and runs any 96 // custom request initialization. 97 func (c *SageMaker) newRequest(op *request.Operation, params, data interface{}) *request.Request { 98 req := c.NewRequest(op, params, data) 99 100 // Run custom request initialization if present 101 if initRequest != nil { 102 initRequest(req) 103 } 104 105 return req 106 }