aws-sdk 1.7.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +4 -4
- data/lib/aws-sdk.rb +60 -1
- data/lib/aws.rb +1 -50
- data/lib/aws/api_config/CloudFront-2012-05-05.yml +864 -899
- data/lib/aws/api_config/DataPipeline-2012-10-29.yml +422 -0
- data/lib/aws/api_config/EC2-2012-07-20.yml +0 -2
- data/lib/aws/api_config/Glacier-2012-06-01.yml +622 -0
- data/lib/aws/api_config/ImportExport-2010-06-01.yml +109 -0
- data/lib/aws/api_config/{SQS-2011-10-01.yml → SQS-2012-11-05.yml} +3 -1
- data/lib/aws/api_config/StorageGateway-2012-06-30.yml +748 -0
- data/lib/aws/cloud_front.rb +71 -0
- data/lib/aws/cloud_front/client.rb +1307 -0
- data/lib/aws/cloud_front/config.rb +18 -0
- data/lib/aws/cloud_front/errors.rb +22 -0
- data/lib/aws/cloud_front/request.rb +44 -0
- data/lib/aws/core.rb +19 -1
- data/lib/aws/core/client.rb +7 -0
- data/lib/aws/core/collection.rb +1 -1
- data/lib/aws/core/configuration.rb +12 -0
- data/lib/aws/core/data.rb +13 -8
- data/lib/aws/core/json_client.rb +3 -4
- data/lib/aws/core/json_parser.rb +76 -0
- data/lib/aws/core/json_request_builder.rb +4 -3
- data/lib/aws/core/json_response_parser.rb +1 -3
- data/lib/aws/core/managed_file.rb +32 -0
- data/lib/aws/core/options/json_serializer.rb +82 -0
- data/lib/aws/core/options/validator.rb +5 -1
- data/lib/aws/core/options/xml_serializer.rb +18 -4
- data/lib/aws/core/{rest_client.rb → rest_json_client.rb} +5 -6
- data/lib/aws/core/rest_request_builder.rb +59 -35
- data/lib/aws/core/rest_response_parser.rb +13 -4
- data/lib/aws/core/rest_xml_client.rb +47 -0
- data/lib/aws/core/signature/version_4.rb +22 -8
- data/lib/aws/data_pipeline.rb +30 -0
- data/lib/aws/data_pipeline/client.rb +392 -0
- data/lib/aws/data_pipeline/config.rb +18 -0
- data/lib/aws/data_pipeline/errors.rb +20 -0
- data/lib/aws/data_pipeline/request.rb +26 -0
- data/lib/aws/ec2/instance_collection.rb +11 -3
- data/lib/aws/ec2/security_group.rb +5 -5
- data/lib/aws/ec2/security_group/{egress_ip_permission_collection.rb → ip_permission_collection.rb} +33 -14
- data/lib/aws/glacier.rb +50 -0
- data/lib/aws/glacier/archive.rb +54 -0
- data/lib/aws/glacier/archive_collection.rb +141 -0
- data/lib/aws/glacier/client.rb +286 -0
- data/lib/aws/glacier/config.rb +19 -0
- data/lib/aws/glacier/errors.rb +22 -0
- data/lib/aws/glacier/request.rb +34 -0
- data/lib/aws/glacier/resource.rb +30 -0
- data/lib/aws/glacier/vault.rb +137 -0
- data/lib/aws/glacier/vault_collection.rb +75 -0
- data/lib/aws/glacier/vault_notification_configuration.rb +27 -0
- data/lib/aws/import_export.rb +71 -0
- data/lib/aws/import_export/client.rb +109 -0
- data/lib/aws/import_export/config.rb +19 -0
- data/lib/aws/import_export/errors.rb +22 -0
- data/lib/aws/import_export/request.rb +23 -0
- data/lib/aws/route_53/client.rb +1 -1
- data/lib/aws/s3/bucket_lifecycle_configuration.rb +160 -63
- data/lib/aws/s3/client.rb +43 -0
- data/lib/aws/s3/client/xml.rb +6 -0
- data/lib/aws/s3/cors_rule_collection.rb +1 -1
- data/lib/aws/s3/data_options.rb +1 -3
- data/lib/aws/s3/request.rb +1 -1
- data/lib/aws/s3/s3_object.rb +52 -10
- data/lib/aws/sqs/client.rb +9 -3
- data/lib/aws/sqs/queue.rb +44 -5
- data/lib/aws/storage_gateway.rb +71 -0
- data/lib/aws/storage_gateway/client.rb +472 -0
- data/lib/aws/storage_gateway/config.rb +18 -0
- data/lib/aws/storage_gateway/errors.rb +22 -0
- data/lib/aws/storage_gateway/request.rb +28 -0
- data/lib/aws/version.rb +1 -1
- metadata +45 -10
- data/lib/aws/ec2/security_group/ingress_ip_permission_collection.rb +0 -61
@@ -0,0 +1,286 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class Glacier
|
16
|
+
|
17
|
+
# All operations with Amazon Glacier require your AWS account ID.
|
18
|
+
# You can specify the special value of '-' to specify your
|
19
|
+
# AWS account ID.
|
20
|
+
#
|
21
|
+
# glacier = AWS::Glacier.new
|
22
|
+
# resp = glacier.client.list_vaults(:account_id => '-')
|
23
|
+
#
|
24
|
+
class Client < Core::RESTJSONClient
|
25
|
+
|
26
|
+
define_client_methods('2012-06-01')
|
27
|
+
|
28
|
+
# @private
|
29
|
+
CACHEABLE_REQUESTS = Set[]
|
30
|
+
|
31
|
+
## client methods ##
|
32
|
+
|
33
|
+
# @!method abort_multipart_upload(options = {})
|
34
|
+
# Calls the DELETE AbortMultipartUpload API operation.
|
35
|
+
# @param [Hash] options
|
36
|
+
# * +:account_id+ - *required* - (String)
|
37
|
+
# * +:vault_name+ - *required* - (String)
|
38
|
+
# * +:upload_id+ - *required* - (String)
|
39
|
+
# @return [Core::Response]
|
40
|
+
|
41
|
+
# @!method complete_multipart_upload(options = {})
|
42
|
+
# Calls the POST CompleteMultipartUpload API operation.
|
43
|
+
# @param [Hash] options
|
44
|
+
# * +:account_id+ - *required* - (String)
|
45
|
+
# * +:vault_name+ - *required* - (String)
|
46
|
+
# * +:upload_id+ - *required* - (String)
|
47
|
+
# * +:archive_size+ - (Integer)
|
48
|
+
# * +:checksum+ - *required* - (String)
|
49
|
+
# * +:content_sha256+ - (String)
|
50
|
+
# @return [Core::Response]
|
51
|
+
|
52
|
+
# @!method create_vault(options = {})
|
53
|
+
# Calls the PUT CreateVault API operation.
|
54
|
+
# @param [Hash] options
|
55
|
+
# * +:account_id+ - *required* - (String)
|
56
|
+
# * +:vault_name+ - *required* - (String)
|
57
|
+
# @return [Core::Response]
|
58
|
+
|
59
|
+
# @!method delete_archive(options = {})
|
60
|
+
# Calls the DELETE DeleteArchive API operation.
|
61
|
+
# @param [Hash] options
|
62
|
+
# * +:account_id+ - *required* - (String)
|
63
|
+
# * +:vault_name+ - *required* - (String)
|
64
|
+
# * +:archive_id+ - *required* - (String)
|
65
|
+
# @return [Core::Response]
|
66
|
+
|
67
|
+
# @!method delete_vault(options = {})
|
68
|
+
# Calls the DELETE DeleteVault API operation.
|
69
|
+
# @param [Hash] options
|
70
|
+
# * +:account_id+ - *required* - (String)
|
71
|
+
# * +:vault_name+ - *required* - (String)
|
72
|
+
# @return [Core::Response]
|
73
|
+
|
74
|
+
# @!method delete_vault_notifications(options = {})
|
75
|
+
# Calls the DELETE DeleteVaultNotifications API operation.
|
76
|
+
# @param [Hash] options
|
77
|
+
# * +:account_id+ - *required* - (String)
|
78
|
+
# * +:vault_name+ - *required* - (String)
|
79
|
+
# @return [Core::Response]
|
80
|
+
|
81
|
+
# @!method describe_job(options = {})
|
82
|
+
# Calls the GET DescribeJob API operation.
|
83
|
+
# @param [Hash] options
|
84
|
+
# * +:account_id+ - *required* - (String)
|
85
|
+
# * +:vault_name+ - *required* - (String)
|
86
|
+
# * +:job_id+ - *required* - (String)
|
87
|
+
# @return [Core::Response]
|
88
|
+
# The #data method of the response object returns
|
89
|
+
# a hash with the following structure:
|
90
|
+
# * +:job_id+ - (String)
|
91
|
+
# * +:job_description+ - (String)
|
92
|
+
# * +:action+ - (String)
|
93
|
+
# * +:archive_id+ - (String)
|
94
|
+
# * +:vault_arn+ - (String)
|
95
|
+
# * +:creation_date+ - (String)
|
96
|
+
# * +:completed+ - (Boolean)
|
97
|
+
# * +:status_code+ - (String)
|
98
|
+
# * +:status_message+ - (String)
|
99
|
+
# * +:archive_size_in_bytes+ - (Integer)
|
100
|
+
# * +:inventory_size_in_bytes+ - (Integer)
|
101
|
+
# * +:sns_topic+ - (String)
|
102
|
+
# * +:completion_date+ - (String)
|
103
|
+
# * +:sha256_tree_hash+ - (String)
|
104
|
+
|
105
|
+
# @!method describe_vault(options = {})
|
106
|
+
# Calls the GET DescribeVault API operation.
|
107
|
+
# @param [Hash] options
|
108
|
+
# * +:account_id+ - *required* - (String)
|
109
|
+
# * +:vault_name+ - *required* - (String)
|
110
|
+
# @return [Core::Response]
|
111
|
+
# The #data method of the response object returns
|
112
|
+
# a hash with the following structure:
|
113
|
+
# * +:vault_arn+ - (String)
|
114
|
+
# * +:vault_name+ - (String)
|
115
|
+
# * +:creation_date+ - (String)
|
116
|
+
# * +:last_inventory_date+ - (String)
|
117
|
+
# * +:number_of_archives+ - (Integer)
|
118
|
+
# * +:size_in_bytes+ - (Integer)
|
119
|
+
|
120
|
+
# @!method get_job_output(options = {})
|
121
|
+
# Calls the GET GetJobOutput API operation.
|
122
|
+
# @param [Hash] options
|
123
|
+
# * +:account_id+ - *required* - (String)
|
124
|
+
# * +:vault_name+ - *required* - (String)
|
125
|
+
# * +:job_id+ - *required* - (String)
|
126
|
+
# * +:range+ - (String)
|
127
|
+
# @return [Core::Response]
|
128
|
+
|
129
|
+
# @!method get_vault_notifications(options = {})
|
130
|
+
# Calls the GET GetVaultNotifications API operation.
|
131
|
+
# @param [Hash] options
|
132
|
+
# * +:account_id+ - *required* - (String)
|
133
|
+
# * +:vault_name+ - *required* - (String)
|
134
|
+
# @return [Core::Response]
|
135
|
+
# The #data method of the response object returns
|
136
|
+
# a hash with the following structure:
|
137
|
+
# * +:vault_notification_config+ - (Hash)
|
138
|
+
# * +:sns_topic+ - (String)
|
139
|
+
# * +:events+ - (Array<String>)
|
140
|
+
|
141
|
+
# @!method initiate_job(options = {})
|
142
|
+
# Calls the POST InitiateJob API operation.
|
143
|
+
# @param [Hash] options
|
144
|
+
# * +:account_id+ - *required* - (String)
|
145
|
+
# * +:vault_name+ - *required* - (String)
|
146
|
+
# * +:job_parameters+ - *required* - (Hash)
|
147
|
+
# * +:format+ - (String)
|
148
|
+
# * +:type+ - (String)
|
149
|
+
# * +:archive_id+ - (String)
|
150
|
+
# * +:description+ - (String)
|
151
|
+
# * +:sns_topic+ - (String)
|
152
|
+
# @return [Core::Response]
|
153
|
+
|
154
|
+
# @!method initiate_multipart_upload(options = {})
|
155
|
+
# Calls the POST InitiateMultipartUpload API operation.
|
156
|
+
# @param [Hash] options
|
157
|
+
# * +:account_id+ - *required* - (String)
|
158
|
+
# * +:vault_name+ - *required* - (String)
|
159
|
+
# * +:archive_description+ - (String)
|
160
|
+
# * +:part_size+ - (Integer)
|
161
|
+
# @return [Core::Response]
|
162
|
+
|
163
|
+
# @!method list_jobs(options = {})
|
164
|
+
# Calls the GET ListJobs API operation.
|
165
|
+
# @param [Hash] options
|
166
|
+
# * +:account_id+ - *required* - (String)
|
167
|
+
# * +:vault_name+ - *required* - (String)
|
168
|
+
# * +:limit+ - (Integer)
|
169
|
+
# * +:marker+ - (String)
|
170
|
+
# * +:statuscode+ - (String)
|
171
|
+
# * +:completed+ - (String)
|
172
|
+
# @return [Core::Response]
|
173
|
+
# The #data method of the response object returns
|
174
|
+
# a hash with the following structure:
|
175
|
+
# * +:job_list+ - (Array<Hash>)
|
176
|
+
# * +:job_id+ - (String)
|
177
|
+
# * +:job_description+ - (String)
|
178
|
+
# * +:action+ - (String)
|
179
|
+
# * +:archive_id+ - (String)
|
180
|
+
# * +:vault_arn+ - (String)
|
181
|
+
# * +:creation_date+ - (String)
|
182
|
+
# * +:completed+ - (Boolean)
|
183
|
+
# * +:status_code+ - (String)
|
184
|
+
# * +:status_message+ - (String)
|
185
|
+
# * +:archive_size_in_bytes+ - (Integer)
|
186
|
+
# * +:inventory_size_in_bytes+ - (Integer)
|
187
|
+
# * +:sns_topic+ - (String)
|
188
|
+
# * +:completion_date+ - (String)
|
189
|
+
# * +:sha256_tree_hash+ - (String)
|
190
|
+
# * +:marker+ - (String)
|
191
|
+
|
192
|
+
# @!method list_multipart_uploads(options = {})
|
193
|
+
# Calls the GET ListMultipartUploads API operation.
|
194
|
+
# @param [Hash] options
|
195
|
+
# * +:account_id+ - *required* - (String)
|
196
|
+
# * +:vault_name+ - *required* - (String)
|
197
|
+
# * +:upload_id_marker+ - (String)
|
198
|
+
# * +:limit+ - (Integer)
|
199
|
+
# @return [Core::Response]
|
200
|
+
# The #data method of the response object returns
|
201
|
+
# a hash with the following structure:
|
202
|
+
# * +:uploads_list+ - (Array<Hash>)
|
203
|
+
# * +:multipart_upload_id+ - (String)
|
204
|
+
# * +:vault_arn+ - (String)
|
205
|
+
# * +:archive_description+ - (String)
|
206
|
+
# * +:part_size_in_bytes+ - (Integer)
|
207
|
+
# * +:creation_date+ - (String)
|
208
|
+
# * +:marker+ - (String)
|
209
|
+
|
210
|
+
# @!method list_parts(options = {})
|
211
|
+
# Calls the GET ListParts API operation.
|
212
|
+
# @param [Hash] options
|
213
|
+
# * +:account_id+ - *required* - (String)
|
214
|
+
# * +:vault_name+ - *required* - (String)
|
215
|
+
# * +:upload_id+ - *required* - (String)
|
216
|
+
# * +:marker+ - (String)
|
217
|
+
# * +:limit+ - (Integer)
|
218
|
+
# @return [Core::Response]
|
219
|
+
# The #data method of the response object returns
|
220
|
+
# a hash with the following structure:
|
221
|
+
# * +:multipart_upload_id+ - (String)
|
222
|
+
# * +:vault_arn+ - (String)
|
223
|
+
# * +:archive_description+ - (String)
|
224
|
+
# * +:part_size_in_bytes+ - (Integer)
|
225
|
+
# * +:creation_date+ - (String)
|
226
|
+
# * +:parts+ - (Array<Hash>)
|
227
|
+
# * +:range_in_bytes+ - (String)
|
228
|
+
# * +:sha256_tree_hash+ - (String)
|
229
|
+
# * +:marker+ - (String)
|
230
|
+
|
231
|
+
# @!method list_vaults(options = {})
|
232
|
+
# Calls the GET ListVaults API operation.
|
233
|
+
# @param [Hash] options
|
234
|
+
# * +:account_id+ - *required* - (String)
|
235
|
+
# * +:marker+ - (String)
|
236
|
+
# * +:limit+ - (Integer)
|
237
|
+
# @return [Core::Response]
|
238
|
+
# The #data method of the response object returns
|
239
|
+
# a hash with the following structure:
|
240
|
+
# * +:vault_list+ - (Array<Hash>)
|
241
|
+
# * +:vault_arn+ - (String)
|
242
|
+
# * +:vault_name+ - (String)
|
243
|
+
# * +:creation_date+ - (String)
|
244
|
+
# * +:last_inventory_date+ - (String)
|
245
|
+
# * +:number_of_archives+ - (Integer)
|
246
|
+
# * +:size_in_bytes+ - (Integer)
|
247
|
+
# * +:marker+ - (String)
|
248
|
+
|
249
|
+
# @!method set_vault_notifications(options = {})
|
250
|
+
# Calls the PUT SetVaultNotifications API operation.
|
251
|
+
# @param [Hash] options
|
252
|
+
# * +:account_id+ - *required* - (String)
|
253
|
+
# * +:vault_name+ - *required* - (String)
|
254
|
+
# * +:vault_notification_config+ - *required* - (Hash)
|
255
|
+
# * +:sns_topic+ - (String)
|
256
|
+
# * +:events+ - (Array<String>)
|
257
|
+
# @return [Core::Response]
|
258
|
+
|
259
|
+
# @!method upload_archive(options = {})
|
260
|
+
# Calls the POST UploadArchive API operation.
|
261
|
+
# @param [Hash] options
|
262
|
+
# * +:vault_name+ - *required* - (String)
|
263
|
+
# * +:account_id+ - *required* - (String)
|
264
|
+
# * +:archive_description+ - (String)
|
265
|
+
# * +:checksum+ - *required* - (String)
|
266
|
+
# * +:body+ - *required* - (IO)
|
267
|
+
# * +:content_sha256+ - (String)
|
268
|
+
# @return [Core::Response]
|
269
|
+
|
270
|
+
# @!method upload_multipart_part(options = {})
|
271
|
+
# Calls the PUT UploadMultipartPart API operation.
|
272
|
+
# @param [Hash] options
|
273
|
+
# * +:account_id+ - *required* - (String)
|
274
|
+
# * +:vault_name+ - *required* - (String)
|
275
|
+
# * +:upload_id+ - *required* - (String)
|
276
|
+
# * +:checksum+ - *required* - (String)
|
277
|
+
# * +:range+ - (String)
|
278
|
+
# * +:body+ - *required* - (IO)
|
279
|
+
# * +:content_sha256+ - (String)
|
280
|
+
# @return [Core::Response]
|
281
|
+
|
282
|
+
## end client methods ##
|
283
|
+
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
5
|
+
# may not use this file except in compliance with the License. A copy of
|
6
|
+
# the License is located at
|
7
|
+
#
|
8
|
+
# http://aws.amazon.com/apache2.0/
|
9
|
+
#
|
10
|
+
# or in the "license" file accompanying this file. This file is
|
11
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
12
|
+
# ANY KIND, either express or implied. See the License for the specific
|
13
|
+
# language governing permissions and limitations under the License.
|
14
|
+
|
15
|
+
AWS::Core::Configuration.module_eval do
|
16
|
+
|
17
|
+
add_service 'Glacier', 'glacier', 'glacier.us-east-1.amazonaws.com'
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class Glacier
|
16
|
+
module Errors
|
17
|
+
|
18
|
+
extend Core::LazyErrorClasses
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class Glacier
|
16
|
+
|
17
|
+
# @private
|
18
|
+
class Request < Core::Http::Request
|
19
|
+
|
20
|
+
include Core::Signature::Version4
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
super
|
24
|
+
self.headers['x-amz-glacier-version'] = Glacier::Client::API_VERSION
|
25
|
+
end
|
26
|
+
|
27
|
+
def service
|
28
|
+
'glacier'
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class Glacier
|
16
|
+
class Resource < Core::Resource
|
17
|
+
|
18
|
+
# @private
|
19
|
+
def initialize *args
|
20
|
+
options = args.last.is_a?(Hash) ? args.last : {}
|
21
|
+
@account_id = options[:account_id] || '-'
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String] :account_id
|
26
|
+
attr_reader :account_id
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
+
# may not use this file except in compliance with the License. A copy of
|
5
|
+
# the License is located at
|
6
|
+
#
|
7
|
+
# http://aws.amazon.com/apache2.0/
|
8
|
+
#
|
9
|
+
# or in the "license" file accompanying this file. This file is
|
10
|
+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
+
# ANY KIND, either express or implied. See the License for the specific
|
12
|
+
# language governing permissions and limitations under the License.
|
13
|
+
|
14
|
+
module AWS
|
15
|
+
class Glacier
|
16
|
+
|
17
|
+
#
|
18
|
+
# @attr_reader [String] arn
|
19
|
+
#
|
20
|
+
# @attr_reader [Integer] size_in_bytes
|
21
|
+
#
|
22
|
+
# @attr_reader [Integer] number_of_archives
|
23
|
+
#
|
24
|
+
# @attr_reader [Time] creation_date
|
25
|
+
#
|
26
|
+
# @attr_reader [Time] last_inventory_date
|
27
|
+
#
|
28
|
+
class Vault < Resource
|
29
|
+
|
30
|
+
# @param [String] name
|
31
|
+
# @param [Hash] options
|
32
|
+
# @option options [String] :account_id
|
33
|
+
def initialize name, options = {}
|
34
|
+
@name = name
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
attr_reader :name
|
40
|
+
|
41
|
+
attribute :arn, :from => :vault_arn, :static => true
|
42
|
+
|
43
|
+
attribute :size_in_bytes
|
44
|
+
|
45
|
+
attribute :number_of_archives
|
46
|
+
|
47
|
+
attribute :creation_date, :static => true
|
48
|
+
|
49
|
+
attribute :last_inventory_date
|
50
|
+
|
51
|
+
populates_from(:list_vaults) do |resp|
|
52
|
+
resp.request_options[:account_id] == account_id and
|
53
|
+
resp[:vault_list].find {|vault| vault[:name] == name }
|
54
|
+
end
|
55
|
+
|
56
|
+
populates_from(:describe_vault) do |resp|
|
57
|
+
if resp.request_options[:account_id] == account_id and resp[:name] == name
|
58
|
+
resp
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# @return [ArchiveCollection]
|
63
|
+
def archives
|
64
|
+
ArchiveCollection.new(self)
|
65
|
+
end
|
66
|
+
|
67
|
+
# @param [String,SNS::Topic] topic The SNS topic ARN string or an
|
68
|
+
# SNS::Topic object to send event notifications to.
|
69
|
+
# @param [Array<String>] events An array of one or more events for
|
70
|
+
# which you want Amazon Glacier to send notifications.
|
71
|
+
# Valid values include:
|
72
|
+
# * 'ArchiveRetrievalCompleted'
|
73
|
+
# * 'InventoryRetrievalCompleted'
|
74
|
+
# @return [VaultNotificationConfiguration]
|
75
|
+
def configure_notifications topic, events
|
76
|
+
|
77
|
+
topic_arn = topic.is_a?(String) ? topic : topic.arn
|
78
|
+
|
79
|
+
cfg = VaultNotificationConfiguration.new
|
80
|
+
cfg.sns_topic = SNS::Topic.new(topic_arn, :config => config)
|
81
|
+
cfg.events = events
|
82
|
+
cfg
|
83
|
+
|
84
|
+
self.notification_configuration = cfg
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
# @return [VaultNotificationConfiguration,nil]
|
89
|
+
def notification_configuration
|
90
|
+
resp = client.get_vault_notifications(resource_options)
|
91
|
+
cfg = VaultNotificationConfiguration.new
|
92
|
+
cfg.sns_topic = SNS::Topic.new(resp[:sns_topic], :config => config)
|
93
|
+
cfg.events = resp[:events]
|
94
|
+
cfg
|
95
|
+
rescue Errors::ResourceNotFoundException
|
96
|
+
nil
|
97
|
+
end
|
98
|
+
|
99
|
+
# Sets the notification configuration for this vault. If you pass
|
100
|
+
# a +nil+ value, the notification configuraiton will be deleted
|
101
|
+
# @param [VaultNotificationConfiguration] cfg
|
102
|
+
def notification_configuration= cfg
|
103
|
+
if cfg
|
104
|
+
opts = {}
|
105
|
+
opts.merge!(resource_options)
|
106
|
+
opts[:vault_notification_config] = {}
|
107
|
+
opts[:vault_notification_config][:sns_topic] = cfg.sns_topic.arn
|
108
|
+
opts[:vault_notification_config][:events] = cfg.events
|
109
|
+
client.set_vault_notifications(opts)
|
110
|
+
else
|
111
|
+
client.delete_vault_notifications(resource_options)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Deletes the current vault. You can only delete an empty vault.
|
116
|
+
# @return [nil]
|
117
|
+
def delete
|
118
|
+
client.delete_vault(resource_options)
|
119
|
+
nil
|
120
|
+
end
|
121
|
+
|
122
|
+
protected
|
123
|
+
|
124
|
+
def get_resource attr = nil
|
125
|
+
client.describe_vault(resource_options)
|
126
|
+
end
|
127
|
+
|
128
|
+
def resource_identifiers
|
129
|
+
[
|
130
|
+
[:vault_name, name],
|
131
|
+
[:account_id, account_id],
|
132
|
+
]
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|