1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3package mediatailor 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/restjson" 12) 13 14// MediaTailor provides the API operation methods for making requests to 15// AWS MediaTailor. See this package's package overview docs 16// for details on the service. 17// 18// MediaTailor methods are safe to use concurrently. It is not safe to 19// modify mutate any of the struct's properties though. 20type MediaTailor 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 = "api.mediatailor" // Name of service. 33 EndpointsID = ServiceName // ID to lookup a service endpoint with. 34 ServiceID = "MediaTailor" // ServiceID is a unique identifer of a specific service. 35) 36 37// New creates a new instance of the MediaTailor 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 MediaTailor client from just a session. 43// svc := mediatailor.New(mySession) 44// 45// // Create a MediaTailor client with additional configuration 46// svc := mediatailor.New(mySession, aws.NewConfig().WithRegion("us-west-2")) 47func New(p client.ConfigProvider, cfgs ...*aws.Config) *MediaTailor { 48 c := p.ClientConfig(EndpointsID, cfgs...) 49 if c.SigningNameDerived || len(c.SigningName) == 0 { 50 c.SigningName = "mediatailor" 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) *MediaTailor { 57 svc := &MediaTailor{ 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: "2018-04-23", 67 JSONVersion: "1.1", 68 }, 69 handlers, 70 ), 71 } 72 73 // Handlers 74 svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) 75 svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) 76 svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) 77 svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) 78 svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler) 79 80 // Run custom client initialization if present 81 if initClient != nil { 82 initClient(svc.Client) 83 } 84 85 return svc 86} 87 88// newRequest creates a new request for a MediaTailor operation and runs any 89// custom request initialization. 90func (c *MediaTailor) newRequest(op *request.Operation, params, data interface{}) *request.Request { 91 req := c.NewRequest(op, params, data) 92 93 // Run custom request initialization if present 94 if initRequest != nil { 95 initRequest(req) 96 } 97 98 return req 99} 100