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