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