| 1 |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. |
| 2 |
|
| 3 |
package privatenetworks |
| 4 |
|
| 5 |
import ( |
| 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/restjson" |
| 13 |
) |
| 14 |
|
| 15 |
// PrivateNetworks provides the API operation methods for making requests to |
| 16 |
// AWS Private 5G. See this package's package overview docs |
| 17 |
// for details on the service. |
| 18 |
// |
| 19 |
// PrivateNetworks methods are safe to use concurrently. It is not safe to |
| 20 |
// modify mutate any of the struct's properties though. |
| 21 |
type PrivateNetworks 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 = "PrivateNetworks" // Name of service. |
| 34 |
EndpointsID = "private-networks" // ID to lookup a service endpoint with. |
| 35 |
ServiceID = "PrivateNetworks" // ServiceID is a unique identifier of a specific service. |
| 36 |
) |
| 37 |
|
| 38 |
// New creates a new instance of the PrivateNetworks 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 |
// |
| 44 |
// mySession := session.Must(session.NewSession()) |
| 45 |
// |
| 46 |
// // Create a PrivateNetworks client from just a session. |
| 47 |
// svc := privatenetworks.New(mySession) |
| 48 |
// |
| 49 |
// // Create a PrivateNetworks client with additional configuration |
| 50 |
// svc := privatenetworks.New(mySession, aws.NewConfig().WithRegion("us-west-2")) |
| 51 |
func New(p client.ConfigProvider, cfgs ...*aws.Config) *PrivateNetworks { |
| 52 |
c := p.ClientConfig(EndpointsID, cfgs...) |
| 53 |
if c.SigningNameDerived || len(c.SigningName) == 0 { |
| 54 |
c.SigningName = "private-networks" |
| 55 |
} |
| 56 |
return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName, c.ResolvedRegion) |
| 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, resolvedRegion string) *PrivateNetworks { |
| 61 |
svc := &PrivateNetworks{ |
| 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: "2021-12-03", |
| 72 |
ResolvedRegion: resolvedRegion, |
| 73 |
}, |
| 74 |
handlers, |
| 75 |
), |
| 76 |
} |
| 77 |
|
| 78 |
// Handlers |
| 79 |
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) |
| 80 |
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler) |
| 81 |
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler) |
| 82 |
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler) |
| 83 |
svc.Handlers.UnmarshalError.PushBackNamed( |
| 84 |
protocol.NewUnmarshalErrorHandler(restjson.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 PrivateNetworks operation and runs any |
| 96 |
// custom request initialization. |
| 97 |
func (c *PrivateNetworks) 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 |
} |