@@ -2,12 +2,14 @@ package cmd
22
33import (
44 "bufio"
5+ "context"
56 "errors"
67 "fmt"
78 "os"
89 "strings"
910
10- ssm "github.com/aws/aws-sdk-go/service/ssm"
11+ "github.com/aws/aws-sdk-go-v2/service/ssm"
12+ "github.com/aws/aws-sdk-go-v2/service/ssm/types"
1113 "github.com/jedib0t/go-pretty/text"
1214 "github.com/spf13/cobra"
1315)
@@ -37,13 +39,13 @@ var putCmd = &cobra.Command{
3739 },
3840}
3941
40- func runPutCmdContext (cmd * cobra.Command , args []string , context string ) {
42+ func runPutCmdContext (cmd * cobra.Command , args []string , ctx string ) {
4143 overwrite , _ := cmd .Flags ().GetBool ("overwrite" )
4244 valueType , _ := cmd .Flags ().GetString ("type" )
4345
44- client := ssm .New ( session )
46+ client := ssm .NewFromConfig ( awsConfig )
4547
46- ctxMessage := fmt .Sprintf ("context = /%s" , context )
48+ ctxMessage := fmt .Sprintf ("context = /%s" , ctx )
4749 kvMessage := fmt .Sprintf ("enter key/value pairs to put in the format of \" key value\" ." )
4850
4951 fmt .Printf ("%v\n " , text .FgYellow .Sprint (ctxMessage ))
@@ -75,13 +77,13 @@ func runPutCmdContext(cmd *cobra.Command, args []string, context string) {
7577 continue
7678 }
7779
78- path := fmt .Sprintf ("/%s/%s" , context , param )
80+ path := fmt .Sprintf ("/%s/%s" , ctx , param )
7981
80- _ , err := client .PutParameter (& ssm.PutParameterInput {
82+ _ , err := client .PutParameter (context . TODO (), & ssm.PutParameterInput {
8183 Name : & path ,
8284 Value : & value ,
83- Type : & valueType ,
84- Overwrite : & overwrite ,
85+ Type : types . ParameterType ( valueType ) ,
86+ Overwrite : overwrite ,
8587 })
8688
8789 if err != nil {
@@ -100,13 +102,13 @@ func runPutCmd(cmd *cobra.Command, args []string) {
100102 overwrite , _ := cmd .Flags ().GetBool ("overwrite" )
101103 valueType , _ := cmd .Flags ().GetString ("type" )
102104
103- client := ssm .New ( session )
105+ client := ssm .NewFromConfig ( awsConfig )
104106
105- _ , err := client .PutParameter (& ssm.PutParameterInput {
107+ _ , err := client .PutParameter (context . TODO (), & ssm.PutParameterInput {
106108 Name : & path ,
107109 Value : & value ,
108- Type : & valueType ,
109- Overwrite : & overwrite ,
110+ Type : types . ParameterType ( valueType ) ,
111+ Overwrite : overwrite ,
110112 })
111113
112114 if err != nil {
0 commit comments