aws-sdk-resources 2.0.3.pre → 2.0.4.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a81b17767e316a7a512bb61c9b9cb392a0c7150
4
- data.tar.gz: 7630c31ed82206477494004bb74ea2b5fbf03702
3
+ metadata.gz: ca9755ea86d6fd5ae7d8d1563388f5b49bf92531
4
+ data.tar.gz: f6cddfb6c0b3bc60d43535eb72c032f52dd441c0
5
5
  SHA512:
6
- metadata.gz: 8ef040fef33dd3ad75ad628d038de5ec9e1c28e32e875d949aa944fc50921ece4f1637d8b47156b2b396e9999993707dc26a4dfd97ee08d2e93ae381b350c61a
7
- data.tar.gz: c69c84b2b228f504aaccf75c19e3074ad5a6e3c139f1e92c58e2fa38211b1731e3df3d6c38e4ff84bdb39d2b383b03e9e9cb2c3477c5ed665afbc9ff39f47103
6
+ metadata.gz: ee25f65aee406f6a1b775ba4a80c80ddeaff2155f18f1d32be922cca5babc26103ae09419c45dbca5fd1b2f17df427116be963158b67c9e7f95b4248c16a0387
7
+ data.tar.gz: e423fd5b896a97a9e305beddb4853b111f120442f4f8584dcd1f464a2d2d20e8f9ec5cf43298f0d0d01a08dad8c259db618d55915b326e3e891f31bb507b4025
@@ -21,21 +21,35 @@ module Aws
21
21
 
22
22
  end
23
23
 
24
- service_added do |_, svc_module, options|
25
- definition = options[:resources]
26
- definition = case definition
24
+ class << self
25
+
26
+ private
27
+
28
+ def define_resource_classes(svc_module, definition)
29
+ build_definition(definition).apply(svc_module)
30
+ end
31
+
32
+ def build_definition(definition)
33
+ case definition
27
34
  when nil then Resources::Definition.new({})
28
35
  when Resources::Definition then definition
29
36
  when Hash then Resources::Definition.new(definition)
30
37
  when String then Resources::Definition.new(Aws.load_json(definition), source_path: definition)
31
38
  else raise ArgumentError, "invalid resource definition #{definition}"
39
+ end
32
40
  end
33
- definition.apply(svc_module)
34
41
 
35
- begin
36
- require "aws-sdk-resources/#{_.downcase}"
42
+ def load_resource_customizations(svc_name)
43
+ require "aws-sdk-resources/services/#{svc_name.downcase}"
37
44
  rescue LoadError
45
+ # no customizations
38
46
  end
39
47
 
40
48
  end
49
+
50
+ service_added do |svc_name, svc_module, options|
51
+ define_resource_classes(svc_module, options[:resources])
52
+ load_resource_customizations(svc_name)
53
+ end
54
+
41
55
  end
@@ -0,0 +1,12 @@
1
+ module Aws
2
+ module S3
3
+
4
+ require 'aws-sdk-resources/services/s3/object'
5
+
6
+ autoload :FilePart, 'aws-sdk-resources/services/s3/file_part'
7
+ autoload :FileUploader, 'aws-sdk-resources/services/s3/file_uploader'
8
+ autoload :MultipartFileUploader, 'aws-sdk-resources/services/s3/multipart_file_uploader'
9
+ autoload :MultipartUploadError, 'aws-sdk-resources/services/s3/multipart_upload_error'
10
+
11
+ end
12
+ end
@@ -1,11 +1,5 @@
1
1
  module Aws
2
2
  module S3
3
-
4
- autoload :FilePart, 'aws-sdk-resources/s3/file_part'
5
- autoload :FileUploader, 'aws-sdk-resources/s3/file_uploader'
6
- autoload :MultipartFileUploader, 'aws-sdk-resources/s3/multipart_file_uploader'
7
- autoload :MultipartUploadError, 'aws-sdk-resources/s3/multipart_upload_error'
8
-
9
3
  class Object
10
4
 
11
5
  # Generates a pre-signed URL for this object.
@@ -0,0 +1,5 @@
1
+ module Aws
2
+ module SQS
3
+ require 'aws-sdk-resources/services/sqs/queue.rb'
4
+ end
5
+ end
@@ -0,0 +1,102 @@
1
+ module Aws
2
+ module SQS
3
+ class Queue
4
+ class << self
5
+
6
+ private
7
+
8
+ def queue_str_attr(method_name, options = {})
9
+ name = options[:name] || attr_name(method_name)
10
+ define_method(method_name) do
11
+ attributes[name]
12
+ end
13
+ end
14
+
15
+ def queue_int_attr(method_name, options = {})
16
+ name = options[:name] || attr_name(method_name)
17
+ define_method(method_name) do
18
+ if value = attributes[name]
19
+ value.to_i
20
+ end
21
+ end
22
+ end
23
+
24
+ def queue_time_attr(method_name, options = {})
25
+ name = options[:name] || attr_name(method_name)
26
+ define_method(method_name) do
27
+ if value = attributes[name]
28
+ Time.at(value.to_i)
29
+ end
30
+ end
31
+ end
32
+
33
+ def attr_name(method_name)
34
+ method_name.to_s.split('_').map { |s| s[0].upcase + s[1..-1] }.join
35
+ end
36
+
37
+ end
38
+
39
+ # @group Queue Attributes
40
+ # @return [String] the queue's policy.
41
+ queue_str_attr :policy
42
+
43
+ # @group Queue Attributes
44
+ # @return [Integer] the visibility timeout for the queue. For more information about visibility timeout, see [Visibility Timeout](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html) in the Amazon SQS Developer Guide.
45
+ queue_int_attr :visibility_timeout
46
+
47
+ # @group Queue Attributes
48
+ # @return [Integer] the limit of how many bytes a message can contain before
49
+ # Amazon SQS rejects it.
50
+ queue_int_attr :maximum_message_size
51
+
52
+ # @group Queue Attributes
53
+ # @return [Integer] the number of seconds Amazon SQS retains a message.
54
+ queue_int_attr :message_retention_period
55
+
56
+ # @group Queue Attributes
57
+ # @return [Integer] the approximate number of visible messages in a queue.
58
+ # For more information, see [Resources Required to Process Messages](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ApproximateNumber.html) in the Amazon SQS Developer Guide.
59
+ queue_int_attr :approximate_number_of_messages
60
+
61
+ # @group Queue Attributes
62
+ # @return [Integer] returns the approximate number of messages that are not timed-out and not deleted. For more information, see [Resources Required to Process Messages](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ApproximateNumber.html) in the Amazon SQS Developer Guide.
63
+ queue_int_attr :approximate_number_of_messages_not_visible
64
+
65
+ # @group Queue Attributes
66
+ # @return [Time] the time when the queue was created.
67
+ queue_time_attr :created_timestamp
68
+
69
+ # @group Queue Attributes
70
+ # @return [Time] the time when the queue was last changed.
71
+ queue_time_attr :last_modified_timestamp
72
+
73
+ # @group Queue Attributes
74
+ # @return [String] the queue's Amazon resource name (ARN).
75
+ queue_str_attr :arn, name: 'QueueArn'
76
+
77
+ alias queue_arn arn
78
+
79
+ # @group Queue Attributes
80
+ # @return [Integer] returns the approximate number of messages that
81
+ # are pending to be added to the queue.
82
+ queue_int_attr :approximate_number_of_messages_delayed
83
+
84
+ # @group Queue Attributes
85
+ # @return [Integer] the default delay on the queue in seconds.
86
+ queue_int_attr :delay_seconds
87
+
88
+ # @group Queue Attributes
89
+ # @return [Integer] the time for which a {Client#receive_message} call
90
+ # will wait for a message to arrive.
91
+ queue_int_attr :receive_message_wait_time_seconds
92
+
93
+ # @group Queue Attributes
94
+ # @return [String] the parameters for dead letter queue functionality of
95
+ # the source queue. For more information about RedrivePolicy and dead
96
+ # letter queues, see [Using Amazon SQS Dead Letter Queues](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/SQSDeadLetterQueue.html)
97
+ # in the Amazon SQS Developer Guide.
98
+ queue_str_attr :redrive_policy
99
+
100
+ end
101
+ end
102
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3.pre
4
+ version: 2.0.4.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-16 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.3
19
+ version: 2.0.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.3
26
+ version: 2.0.4
27
27
  description: Provides resource-oriented abstractions for AWS.
28
28
  email:
29
29
  executables: []
@@ -51,11 +51,14 @@ files:
51
51
  - lib/aws-sdk-resources/request.rb
52
52
  - lib/aws-sdk-resources/request_params.rb
53
53
  - lib/aws-sdk-resources/resource.rb
54
- - lib/aws-sdk-resources/s3/file_part.rb
55
- - lib/aws-sdk-resources/s3/file_uploader.rb
56
- - lib/aws-sdk-resources/s3/multipart_file_uploader.rb
57
- - lib/aws-sdk-resources/s3/multipart_upload_error.rb
58
- - lib/aws-sdk-resources/s3.rb
54
+ - lib/aws-sdk-resources/services/s3/file_part.rb
55
+ - lib/aws-sdk-resources/services/s3/file_uploader.rb
56
+ - lib/aws-sdk-resources/services/s3/multipart_file_uploader.rb
57
+ - lib/aws-sdk-resources/services/s3/multipart_upload_error.rb
58
+ - lib/aws-sdk-resources/services/s3/object.rb
59
+ - lib/aws-sdk-resources/services/s3.rb
60
+ - lib/aws-sdk-resources/services/sqs/queue.rb
61
+ - lib/aws-sdk-resources/services/sqs.rb
59
62
  - lib/aws-sdk-resources/source.rb
60
63
  - lib/aws-sdk-resources/validator/context.rb
61
64
  - lib/aws-sdk-resources/validator/identifier_validator.rb