-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command to set parameters with option to overwrite existing ones. Update README.md. Bump version to 1.5.0.
- Loading branch information
Showing
14 changed files
with
129 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/willjcj/param/pkg/param" | ||
) | ||
|
||
var force bool | ||
|
||
var setCmd = &cobra.Command{ | ||
Use: "set name value", | ||
Short: "Set a paramter in Parameter Store.", | ||
Long: "Add a SecureString paramter to Parameter Store.", | ||
Args: cobra.ExactArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
param.Set(args[0], args[1], force) | ||
}, | ||
} | ||
|
||
func init() { | ||
RootCmd.AddCommand(setCmd) | ||
setCmd.Flags().BoolVarP(&force, "force", "f", false, "Overwrite the parameter if it exists.") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## param set | ||
|
||
Set a paramter in Parameter Store. | ||
|
||
### Synopsis | ||
|
||
Add a SecureString paramter to Parameter Store. | ||
|
||
``` | ||
param set name value [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-f, --force Overwrite the parameter if it exists. | ||
-h, --help help for set | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
--config string config file (default is $HOME/.param.yaml) | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [param](param.md) - Tools to improve Parameter Store on the command line. | ||
|
||
###### Auto generated by spf13/cobra on 15-Jul-2018 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package param | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/service/ssm" | ||
) | ||
|
||
func Set(name string, value string, force bool) { | ||
putSecureStringParameter(name, value, force) | ||
} | ||
|
||
func putSecureStringParameter(name string, value string, overwrite bool) { | ||
_, err := service.PutParameter(&ssm.PutParameterInput{ | ||
Name: aws.String(name), | ||
Type: aws.String("SecureString"), | ||
Value: aws.String(value), | ||
Overwrite: aws.Bool(overwrite), | ||
}) | ||
|
||
if err != nil { | ||
exitErrorf("Unable to set parameter, %v", err) | ||
} | ||
} |