-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yaml
200 lines (199 loc) · 7.16 KB
/
config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
cog_bundle_version: 4
name: s3
version: 0.1.0
docker:
image: cogcmd/aws-s3
tag: 0.1.0
description: Manage S3 buckets and files
long_description: >
This bundle provides commands for creating, inspecting, and controlling S3
buckets and objects (referred to as files in this bundle) on AWS. To
communicate with the AWS API we use the aws-sdk library written in Ruby.
Permissions are used to control which users are authorized to run each
command. Listing and reading buckets and files requires the s3:read
permission. Modifying the state or other values of buckets and files requires
the s3:write permission. And, deleting buckets and files requires the
s3:admin permission.
homepage: https://github.com/cogcmd/aws-s3
author: Patrick Van Stee <[email protected]>
config:
notes: >
When creating the access key for use with the following environment
variables, make sure the IAM user that owns the key has the
AmazonS3FullAccess policy.
env:
- var: AWS_ACCESS_KEY_ID
description: Requried ID of the access key used to authenticate with the AWS API
- var: AWS_SECRET_ACCESS_KEY
description: Required secret of the access key used to authenticate with the AWS API
- var: AWS_REGION
description: Optional region used for all commands unless one is provided via the -r,--region flag
commands:
bucket-acl:
executable: /home/bundle/cog-command
description: Lists ACLs of a bucket
arguments: "<bucket>"
rules:
- "must have s3:read"
options:
region:
type: string
required: false
description: S3 location to connect to (us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, ap-south-1, sa-east-1)
short_flag: r
bucket-list:
executable: /home/bundle/cog-command
description: Lists buckets
long_description: >
If you have a large number of buckets or want to filter down to only a
few in a pipeline, you can use the optional pattern argument. The pattern
can be any valid ruby regular expression and is applied to the bucket
name. Only buckets with matching names will be returned. If a pattern is
not provided all buckets are returned.
arguments: "[pattern]"
rules:
- "must have s3:read"
options:
region:
type: string
required: false
description: S3 location to connect to (us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, ap-south-1, sa-east-1)
short_flag: r
bucket-create:
executable: /home/bundle/cog-command
description: Creates a bucket
arguments: "<name>"
rules:
- "must have s3:write"
options:
acl:
type: string
required: false
description: ACL to apply. Defaults to private. (private, public-read, public-read-write, authenticated-read)
short_flag: a
region:
type: string
required: false
description: S3 location in which to create the bucket (us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, ap-south-1, sa-east-1)
short_flag: r
bucket-destroy:
executable: /home/bundle/cog-command
description: Destroys buckets
arguments: "<name> [<name> ...]"
rules:
- "must have s3:admin"
options:
region:
type: string
required: false
description: S3 location to connect to (us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, ap-south-1, sa-east-1)
short_flag: r
file-list:
executable: /home/bundle/cog-command
description: Lists files in a bucket
long_description: >
If you have a large number of files or want to filter down to only a few
in a pipeline, you can use the optional pattern argument. The pattern can
be any valid ruby regular expression and is applied to the file key. Only
files with matching keys will be returned. If a pattern is not provided
all files in the bucket are returned.
arguments: "<bucket> [pattern]"
rules:
- "must have s3:read"
options:
region:
type: string
required: false
description: S3 location to connect to (us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, ap-south-1, sa-east-1)
short_flag: r
file-create:
executable: /home/bundle/cog-command
description: Creates a file
arguments: "<bucket> <key> <body>"
rules:
- "must have s3:write"
options:
region:
type: string
required: false
description: S3 location to connect to (us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, ap-south-1, sa-east-1)
short_flag: r
file-info:
executable: /home/bundle/cog-command
description: Reads a file
arguments: "<bucket> <key>"
rules:
- "must have s3:read"
options:
region:
type: string
required: false
description: S3 location to connect to (us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, ap-south-1, sa-east-1)
short_flag: r
file-destroy:
executable: /home/bundle/cog-command
description: Destroys a file
arguments: "<bucket> <key>"
rules:
- "must have s3:admin"
options:
region:
type: string
required: false
description: S3 location to connect to (us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, ap-south-1, sa-east-1)
short_flag: r
permissions:
- s3:read
- s3:write
- s3:admin
templates:
bucket_list:
body: |
| Name | Creation Date |
| ---- | ------------- |
~each var=$results as=bucket~
| ~$bucket.name~ | ~$bucket.creation_date~ |
~end~
bucket_create:
body: |
~each var=$results as=bucket~
Created bucket at location ~$bucket.location~
~end~
bucket_destroy:
body: |
~each var=$results as=bucket~
Destroyed bucket ~$bucket.name~
~end~
bucket_acl:
body: |
| Permission | Grantee |
| ---- | ------------- |
~each var=$results as=acl~
| ~$acl.permission~ | ~$acl.grantee.display_name~ |
~end~
file_list:
body: |
| Key | Last Modified | Size |
| --- | ------------- | ---- |
~each var=$results as=file~
| ~$file.key~ | ~$file.last_modified~ | ~$file.size~ |
~end~
file_create:
body: |
~each var=$results as=file~
Created file ~$file.key~ in bucket ~$file.bucket~
~end~
file_info:
body: |
~each var=$results as=file~
Contents of file ~$file.key~ in bucket ~$file.bucket~
```
~$file.body~
```
~end~
file_destroy:
body: |
~each var=$results as=file~
Destroyed file ~$file.key~ in bucket ~$file.bucket~
~end~