File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,8 @@ const (
140
140
OutputDirFlag = "output-dir"
141
141
142
142
DesiredTaskStatus = "desired-status"
143
+
144
+ ResourceTagsFlag = "tags"
143
145
)
144
146
145
147
// OptionalRegionAndProfileFlags provides these flags:
@@ -251,7 +253,7 @@ func DebugFlag() []cli.Flag {
251
253
func FipsEndpointFlag () []cli.Flag {
252
254
return []cli.Flag {
253
255
cli.BoolFlag {
254
- Name : UseFIPSFlag + ",fips" ,
256
+ Name : UseFIPSFlag + ",fips" ,
255
257
Usage : "[Optional] Routes calls to AWS services through FIPS endpoints." ,
256
258
},
257
259
}
Original file line number Diff line number Diff line change @@ -17,8 +17,11 @@ package utils
17
17
import (
18
18
"fmt"
19
19
"os"
20
+ "strings"
20
21
22
+ "github.com/aws/aws-sdk-go/aws"
21
23
"github.com/aws/aws-sdk-go/aws/awserr"
24
+ "github.com/aws/aws-sdk-go/service/ecs"
22
25
)
23
26
24
27
const (
@@ -58,3 +61,20 @@ func EntityAlreadyExists(err error) bool {
58
61
}
59
62
return false
60
63
}
64
+
65
+ // GetTags parses AWS Resource tags from the flag value
66
+ // users specify tags in this format: key1=value1,key2=value2,key3=value3
67
+ func GetTags (flagValue string , tags []* ecs.Tag ) ([]* ecs.Tag , error ) {
68
+ keyValPairs := strings .Split (flagValue , "," )
69
+ for _ , pair := range keyValPairs {
70
+ split := strings .Split (pair , "=" )
71
+ if len (split ) != 2 {
72
+ return nil , fmt .Errorf ("Tag input not formatted correctly: %s" , pair )
73
+ }
74
+ tags = append (tags , & ecs.Tag {
75
+ Key : aws .String (split [0 ]),
76
+ Value : aws .String (split [1 ]),
77
+ })
78
+ }
79
+ return tags , nil
80
+ }
You can’t perform that action at this time.
0 commit comments