Skip to content

Commit

Permalink
feat: add aws serverlessrepo create-cloud-formation-change-set
Browse files Browse the repository at this point in the history
  • Loading branch information
mokele committed Nov 2, 2020
1 parent 524abbb commit 1eca6f1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ $ rain deploy ...
override template configuration file values
* [ ] test / add support for parameters with quoted values
* [ ] support `UsePreviousValue`
* [ ] `tc help --help -h`
* [ ] support `StackPolicy` for those commands that support it, and maybe do
2nd api call if needed for those where it is not
# Arguments
Expand Down
9 changes: 9 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ const keyNameValueNameJoinedCommand = {
formatTag: (key, value) => `${key}=${value}`,
formatTags: tags => [tags.join(',')]
}
const nameValue = {
formatParameter: (key, value) => `Name=${key},Value=${value}`,
formatParameters: identity,
formatTag: (key, value) => `Key=${key},Value=${value}`,
formatTags: identity
}

const helpCommands = {
aws: ['help'],
Expand All @@ -45,6 +51,9 @@ const parameterTypes = {
'update-stack': [parameters, keyNameValueName],
'update-stack-instances': [parameterOverrides, keyNameValueNameNoTags],
'update-stack-set': [parameters, keyNameValueName]
},
serverlessrepo: {
'create-cloud-formation-change-set': [parameterOverrides, nameValue]
}
},
sam: {
Expand Down
3 changes: 2 additions & 1 deletion template-configuration/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"Key": "Value"
},
"Tags": {
"TagKey": "TagValue"
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
},
"StackPolicy": {
"Statement": [
Expand Down
14 changes: 14 additions & 0 deletions test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@ Array [
]
`;

exports[`with readConfigution function aws serverlessrepo create-cloud-formation-change-set generates command with parameters 1`] = `
Array [
"aws",
"serverlessrepo",
"create-cloud-formation-change-set",
"--parameter-overrides",
"Name=key1,Value=value1",
"Name=key2,Value=value2",
"--tags",
"Key=tagKey1,Value=tagValue1",
"Key=tagKey2,Value=tagValue2",
]
`;

exports[`with readConfigution function rain deploy generates command with parameters 1`] = `
Array [
"rain",
Expand Down
16 changes: 16 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,22 @@ describe('with readConfigution function', () => {
})
})
})

describe('serverlessrepo', () => {
beforeEach(() => {
cmd.pushArgument('serverlessrepo')
})

describe('create-cloud-formation-change-set', () => {
beforeEach(() => {
cmd.pushArgument('create-cloud-formation-change-set')
})

test('generates command with parameters', () => {
expect(cmd.getArguments()).toMatchSnapshot()
})
})
})
})

describe('sam', () => {
Expand Down

0 comments on commit 1eca6f1

Please sign in to comment.