Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PartitionID to endpoints.ResolvedEndpoint and metadata.ClientInfo #2902

Merged
merged 4 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
### SDK Features

### SDK Enhancements
* `aws/client`: Add PartitionID to Config ([#2902](https://github.com/aws/aws-sdk-go/pull/2902))
* `aws/client/metadata`: Add PartitionID to ClientInfo ([#2902](https://github.com/aws/aws-sdk-go/pull/2902))
* `aws/endpoints`: Add PartitionID to ResolvedEndpoint ([#2902](https://github.com/aws/aws-sdk-go/pull/2902))

### SDK Bugs
1 change: 1 addition & 0 deletions aws/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
type Config struct {
Config *aws.Config
Handlers request.Handlers
PartitionID string
Endpoint string
SigningRegion string
SigningName string
Expand Down
1 change: 1 addition & 0 deletions aws/client/metadata/client_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type ClientInfo struct {
ServiceName string
ServiceID string
APIVersion string
PartitionID string
Endpoint string
SigningName string
SigningRegion string
Expand Down
3 changes: 3 additions & 0 deletions aws/endpoints/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ type ResolvedEndpoint struct {
// The endpoint URL
URL string

// The endpoint partition
PartitionID string

// The region that should be used for signing requests.
SigningRegion string

Expand Down
5 changes: 3 additions & 2 deletions aws/endpoints/v3model.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (p partition) EndpointFor(service, region string, opts ...func(*Options)) (

defs := []endpoint{p.Defaults, s.Defaults}

return e.resolve(service, region, p.DNSSuffix, defs, opt), nil
return e.resolve(service, p.ID, region, p.DNSSuffix, defs, opt), nil
}

func serviceList(ss services) []string {
Expand Down Expand Up @@ -208,7 +208,7 @@ func getByPriority(s []string, p []string, def string) string {
return s[0]
}

func (e endpoint) resolve(service, region, dnsSuffix string, defs []endpoint, opts Options) ResolvedEndpoint {
func (e endpoint) resolve(service, partitionID, region, dnsSuffix string, defs []endpoint, opts Options) ResolvedEndpoint {
var merged endpoint
for _, def := range defs {
merged.mergeIn(def)
Expand Down Expand Up @@ -244,6 +244,7 @@ func (e endpoint) resolve(service, region, dnsSuffix string, defs []endpoint, op

return ResolvedEndpoint{
URL: u,
PartitionID: partitionID,
SigningRegion: signingRegion,
SigningName: signingName,
SigningNameDerived: signingNameDerived,
Expand Down
2 changes: 1 addition & 1 deletion aws/endpoints/v3model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func TestEndpointResolve(t *testing.T) {
SSLCommonName: "new sslCommonName",
}

resolved := e.resolve("service", "region", "dnsSuffix",
resolved := e.resolve("service", "partitionID", "region", "dnsSuffix",
defs, Options{},
)

Expand Down
5 changes: 3 additions & 2 deletions private/model/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,11 @@ func New(p client.ConfigProvider, cfgs ...*aws.Config) *{{ .StructName }} {
c.SigningName = "{{ .Metadata.SigningName }}"
}
{{- end }}
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *{{ .StructName }} {
func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *{{ .StructName }} {
svc := &{{ .StructName }}{
Client: client.New(
cfg,
Expand All @@ -552,6 +552,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio
ServiceID : {{ ServiceIDVar . }},
SigningName: signingName,
SigningRegion: signingRegion,
PartitionID: partitionID,
Endpoint: endpoint,
APIVersion: "{{ .Metadata.APIVersion }}",
{{ if and (.Metadata.JSONVersion) (eq .Metadata.Protocol "json") -}}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions private/model/api/codegentest/service/rpcservice/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading