forked from ks3sdklib/aws-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
customization_passes.go
executable file
·40 lines (35 loc) · 1.02 KB
/
customization_passes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package api
var svcCustomizations = map[string]func(*API){
"s3": s3Customizations,
"cloudfront": cloudfrontCustomizations,
}
// customizationPasses Executes customization logic for the API by package name.
func (a *API) customizationPasses() {
if fn := svcCustomizations[a.PackageName()]; fn != nil {
fn(a)
}
}
// s3Customizations customizes the API generation to replace values specific to S3.
func s3Customizations(a *API) {
// Remove ContentMD5 members
for _, s := range a.Shapes {
if _, ok := s.MemberRefs["ContentMD5"]; ok {
delete(s.MemberRefs, "ContentMD5")
}
}
// Rename "Rule" to "LifecycleRule"
if s, ok := a.Shapes["Rule"]; ok {
s.Rename("LifecycleRule")
}
}
// cloudfrontCustomizations customized the API generation to replace values
// specific to CloudFront.
func cloudfrontCustomizations(a *API) {
// MaxItems members should always be integers
for _, s := range a.Shapes {
if ref, ok := s.MemberRefs["MaxItems"]; ok {
ref.ShapeName = "Integer"
ref.Shape = a.Shapes["Integer"]
}
}
}