Skip to content

Commit 6f715d5

Browse files
authored
Move API package from aws-sdk-go repo to this repository (#563)
Description of changes: Since the aws-sdk-go repository will not be supported starting July 2025, we are moving it under our repository. Doing so will also make it easy to make any changes if needed, when we support aws-sdk-go-v2. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 631aeb1 commit 6f715d5

File tree

105 files changed

+23783
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+23783
-39
lines changed

pkg/api/api.go

Lines changed: 1187 additions & 0 deletions
Large diffs are not rendered by default.

pkg/api/api_test.go

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
package api
3+
4+
import (
5+
"strings"
6+
"testing"
7+
)
8+
9+
func TestAPI_StructName(t *testing.T) {
10+
origAliases := serviceAliaseNames
11+
defer func() { serviceAliaseNames = origAliases }()
12+
13+
cases := map[string]struct {
14+
Aliases map[string]string
15+
Metadata Metadata
16+
StructName string
17+
}{
18+
"FullName": {
19+
Metadata: Metadata{
20+
ServiceFullName: "Amazon Service Name-100",
21+
},
22+
StructName: "ServiceName100",
23+
},
24+
"Abbreviation": {
25+
Metadata: Metadata{
26+
ServiceFullName: "Amazon Service Name-100",
27+
ServiceAbbreviation: "AWS SN100",
28+
},
29+
StructName: "SN100",
30+
},
31+
"Lowercase Name": {
32+
Metadata: Metadata{
33+
EndpointPrefix: "other",
34+
ServiceFullName: "AWS Lowercase service",
35+
ServiceAbbreviation: "lowercase",
36+
},
37+
StructName: "Lowercase",
38+
},
39+
"Lowercase Name Mixed": {
40+
Metadata: Metadata{
41+
EndpointPrefix: "other",
42+
ServiceFullName: "AWS Lowercase service",
43+
ServiceAbbreviation: "lowercase name Goes heRe",
44+
},
45+
StructName: "LowercaseNameGoesHeRe",
46+
},
47+
"Alias": {
48+
Aliases: map[string]string{
49+
"elasticloadbalancing": "ELB",
50+
},
51+
Metadata: Metadata{
52+
ServiceFullName: "Elastic Load Balancing",
53+
},
54+
StructName: "ELB",
55+
},
56+
}
57+
58+
for k, c := range cases {
59+
t.Run(k, func(t *testing.T) {
60+
serviceAliaseNames = c.Aliases
61+
62+
a := API{
63+
Metadata: c.Metadata,
64+
}
65+
66+
a.Setup()
67+
68+
if e, o := c.StructName, a.StructName(); e != o {
69+
t.Errorf("expect %v structName, got %v", e, o)
70+
}
71+
})
72+
}
73+
}
74+
75+
func TestAPI_Setup_documentShapes(t *testing.T) {
76+
api := API{
77+
Shapes: map[string]*Shape{
78+
"Document": {
79+
Type: "structure",
80+
Document: true,
81+
},
82+
},
83+
}
84+
85+
err := api.Setup()
86+
if err == nil {
87+
t.Fatalf("expect error, but got nil")
88+
}
89+
expect := "model contains document shapes"
90+
if !strings.Contains(err.Error(), expect) {
91+
t.Errorf("expect %s, got %v", expect, err)
92+
}
93+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
{
3+
"version":"2.0",
4+
"metadata":{
5+
"apiVersion":"2012-11-05",
6+
"awsQueryCompatible": {
7+
8+
},
9+
"endpointPrefix":"awsqc-exampleendpoint",
10+
"jsonVersion":"1.1",
11+
"protocol":"json",
12+
"serviceAbbreviation":"AwsQueryCompatible",
13+
"serviceFullName":"AWSQuery Compatible Service",
14+
"serviceId":"AWSQueryCompatible",
15+
"signatureVersion":"v4",
16+
"uid":"awsquerycompatible-2012-11-05",
17+
"xmlNamespace":"http://queue.amazonaws.com/doc/2012-11-05/"
18+
},
19+
"operations":{
20+
"CreateQueue":{
21+
"name":"CreateQueue",
22+
"http":{
23+
"method":"POST",
24+
"requestUri":"/"
25+
},
26+
"input":{"shape":"CreateQueueRequest"},
27+
"output":{
28+
"shape":"CreateQueueResult",
29+
"resultWrapper":"CreateQueueResult"
30+
},
31+
"errors":[
32+
{"shape":"QueueDeletedRecently"},
33+
{"shape":"QueueNameExists"}
34+
]
35+
}
36+
},
37+
"shapes":{
38+
"CreateQueueRequest":{
39+
"type":"structure",
40+
"required":["QueueName"],
41+
"members":{
42+
"QueueName":{"shape":"String"}
43+
}
44+
},
45+
"CreateQueueResult":{
46+
"type":"structure",
47+
"members":{
48+
"QueueUrl":{"shape":"String"}
49+
}
50+
},
51+
"QueueDeletedRecently":{
52+
"type":"structure",
53+
"members":{
54+
},
55+
"error":{
56+
"code":"AWS.SimpleQueueService.QueueDeletedRecently",
57+
"httpStatusCode":400,
58+
"senderFault":true
59+
},
60+
"exception":true
61+
},
62+
"QueueNameExists":{
63+
"type":"structure",
64+
"members":{
65+
},
66+
"error":{
67+
"code":"QueueAlreadyExists",
68+
"httpStatusCode":400,
69+
"senderFault":true
70+
},
71+
"exception":true
72+
},
73+
"String":{"type":"string"}
74+
}
75+
}
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
{
2+
"version":"2.0",
3+
"metadata":{
4+
"apiVersion":"2018-08-31",
5+
"endpointPrefix":"awsendpointdiscoverytestservice",
6+
"jsonVersion":"1.1",
7+
"protocol":"json",
8+
"serviceAbbreviation":"AwsEndpointDiscoveryTest",
9+
"serviceFullName":"AwsEndpointDiscoveryTest",
10+
"signatureVersion":"v4",
11+
"signingName":"awsendpointdiscoverytestservice",
12+
"targetPrefix":"AwsEndpointDiscoveryTestService"
13+
},
14+
"operations":{
15+
"DescribeEndpoints":{
16+
"name":"DescribeEndpoints",
17+
"http":{
18+
"method":"POST",
19+
"requestUri":"/"
20+
},
21+
"input":{"shape":"DescribeEndpointsRequest"},
22+
"output":{"shape":"DescribeEndpointsResponse"},
23+
"endpointoperation":true
24+
},
25+
"TestDiscoveryIdentifiersRequired":{
26+
"name":"TestDiscoveryIdentifiersRequired",
27+
"http":{
28+
"method":"POST",
29+
"requestUri":"/"
30+
},
31+
"input":{"shape":"TestDiscoveryIdentifiersRequiredRequest"},
32+
"output":{"shape":"TestDiscoveryIdentifiersRequiredResponse"},
33+
"endpointdiscovery":{"required":true}
34+
},
35+
"TestDiscoveryOptional":{
36+
"name":"TestDiscoveryOptional",
37+
"http":{
38+
"method":"POST",
39+
"requestUri":"/"
40+
},
41+
"input":{"shape":"TestDiscoveryOptionalRequest"},
42+
"output":{"shape":"TestDiscoveryOptionalResponse"},
43+
"endpointdiscovery":{
44+
}
45+
},
46+
"TestDiscoveryRequired":{
47+
"name":"TestDiscoveryRequired",
48+
"http":{
49+
"method":"POST",
50+
"requestUri":"/"
51+
},
52+
"input":{"shape":"TestDiscoveryRequiredRequest"},
53+
"output":{"shape":"TestDiscoveryRequiredResponse"},
54+
"endpointdiscovery":{
55+
}
56+
}
57+
},
58+
"shapes":{
59+
"Boolean":{"type":"boolean"},
60+
"DescribeEndpointsRequest":{
61+
"type":"structure",
62+
"members":{
63+
"Operation": {"shape":"String"}
64+
}
65+
},
66+
"DescribeEndpointsResponse":{
67+
"type":"structure",
68+
"required":["Endpoints"],
69+
"members":{
70+
"Endpoints":{"shape":"Endpoints"}
71+
}
72+
},
73+
"Endpoint":{
74+
"type":"structure",
75+
"required":[
76+
"Address",
77+
"CachePeriodInMinutes"
78+
],
79+
"members":{
80+
"Address":{"shape":"String"},
81+
"CachePeriodInMinutes":{"shape":"Long"}
82+
}
83+
},
84+
"Endpoints":{
85+
"type":"list",
86+
"member":{"shape":"Endpoint"}
87+
},
88+
"Long":{"type":"long"},
89+
"String":{"type":"string"},
90+
"TestDiscoveryIdentifiersRequiredRequest":{
91+
"type":"structure",
92+
"required":["Sdk"],
93+
"members":{
94+
"Sdk":{
95+
"shape":"String",
96+
"endpointdiscoveryid":true
97+
}
98+
}
99+
},
100+
"TestDiscoveryIdentifiersRequiredResponse":{
101+
"type":"structure",
102+
"members":{
103+
"RequestSuccessful":{"shape":"Boolean"}
104+
}
105+
},
106+
"TestDiscoveryOptionalRequest":{
107+
"type":"structure",
108+
"members":{
109+
"Sdk":{"shape":"String"}
110+
}
111+
},
112+
"TestDiscoveryOptionalResponse":{
113+
"type":"structure",
114+
"members":{
115+
"RequestSuccessful":{"shape":"Boolean"}
116+
}
117+
},
118+
"TestDiscoveryRequiredRequest":{
119+
"type":"structure",
120+
"members":{
121+
"Sdk":{"shape":"String"}
122+
}
123+
},
124+
"TestDiscoveryRequiredResponse":{
125+
"type":"structure",
126+
"members":{
127+
"RequestSuccessful":{"shape":"Boolean"}
128+
}
129+
}
130+
}
131+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"version": "2.0",
3+
"service": null,
4+
"operations": {
5+
},
6+
"shapes":{}
7+
}

0 commit comments

Comments
 (0)