Skip to content

Commit ea1222d

Browse files
authored
Update AMI entry to prevent replacement in Family, Dynamic, Camila and others (#169)
Issue N/A Description of changes: - Update AMI entry to prevent replacement in `Family`, `Dynamic`, `Camila` and others By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 14ebb07 commit ea1222d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pkg/names/names.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ var (
6767
{"MD5Of", "MD5Of", "md5Of", regexp.MustCompile("M[dD]5Of", regexp.None)},
6868
// Prevent "MultipartUpload" from becoming "MultIPartUpload"
6969
{"Ip", "IP", "ip", regexp.MustCompile("Ip(?!art)", regexp.None)},
70-
// Prevent "Family" from becoming "FAMIly"
71-
{"Ami", "AMI", "ami", regexp.MustCompile("(?!f)ami(?!ly)|(Ami)", regexp.None)},
70+
// Model fields containing AMI will always capitalize the 'A' hence we don't
71+
// have to look for words starting with a lowercase 'A'
72+
{"Amis", "AMIs", "amis", regexp.MustCompile("Amis", regexp.None)},
73+
{"Ami", "AMI", "ami", regexp.MustCompile("Ami", regexp.None)},
7274
// Easy find-and-replacements...
7375
{"Acl", "ACL", "acl", nil},
7476
{"Acp", "ACP", "acp", nil},

pkg/names/names_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ func TestNames(t *testing.T) {
3636
{"Id", "ID", "id", "id"},
3737
{"ID", "ID", "id", "id"},
3838
{"Family", "Family", "family", "family"},
39+
{"Examine", "Examine", "examine", "examine"},
40+
{"Dynamic", "Dynamic", "dynamic", "dynamic"},
41+
{"Camila", "Camila", "camila", "camila"},
42+
{"Amis", "AMIs", "amis", "amis"},
43+
{"AmiType", "AMIType", "amiType", "ami_type"},
44+
{"AmiLaunchIndex", "AMILaunchIndex", "amiLaunchIndex", "ami_launch_index"},
45+
{"NumberOfAmiToKeep", "NumberOfAMIToKeep", "numberOfAMIToKeep", "number_of_ami_to_keep"},
46+
{"RequestedAmiVersion", "RequestedAMIVersion", "requestedAMIVersion", "requested_ami_version"},
3947
{"KeyIdentifier", "KeyIdentifier", "keyIdentifier", "key_identifier"},
4048
{"KeyId", "KeyID", "keyID", "key_id"},
4149
{"KeyID", "KeyID", "keyID", "key_id"},

0 commit comments

Comments
 (0)