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