fog-aws 0.2.0 → 0.2.2

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: 20c52aa88f06a8177fe9d43fa20e7ebd444a9a64
4
- data.tar.gz: e1616bbc74d55c0e431606b0cb11f91bab3fb68a
3
+ metadata.gz: b755e78b954c63b5857d91ec7054021ad448bf51
4
+ data.tar.gz: f9f118f04869ec1ec925fda14d3a896a7a48c40f
5
5
  SHA512:
6
- metadata.gz: 77794deeef38718df73253ac8d9088691e64272ed14bc7180fa7c237e88c67e02b0c45f8c426e5311587cab8fe6523b7f287d752d08ee108180cded5ba54f1c8
7
- data.tar.gz: e767e0eeefed0b8806a24633ca77f7acf5fb307f9e795f9afeef5a52893bf52fbee64ae70dc3d3766e405f86e8fadbd5f8c5286d4a3e53fc8bf13202180ba73a
6
+ metadata.gz: 824e71f7f75c19fd9e0d0fea083f3538f7f302f763d532eaa92f51d111e9bc4afaa4f406f88e856c19fcdda555ce4bbb5e40c6a8b860996ce1df06ccdc43d7be
7
+ data.tar.gz: 68e19eed81bd3f187ac2f39cc12b5a8389af3cc077d2ef2459392a6acfa2601b6732c79926392e10fc1cc7ff84d92cdf6ebc03b8613eac94dbe67f9aea0d7fd1
@@ -37,7 +37,7 @@ module Fog
37
37
  end
38
38
 
39
39
  def self.reset
40
- @data.clear
40
+ data.clear
41
41
  end
42
42
 
43
43
  attr_reader :account_id
@@ -14,7 +14,19 @@ module Fog
14
14
 
15
15
  class Mock
16
16
  def add_permission(options = {})
17
- Fog::Mock.not_implemented
17
+ topic_arn = options.delete('TopicArn')
18
+ label = options.delete('Label')
19
+ actions = Hash[options.select { |k,v| k.match(/^ActionName/) }].values
20
+ members = Hash[options.select { |k,v| k.match(/^AWSAccountId/) }].values
21
+
22
+ self.data[:permissions][topic_arn][label] = {
23
+ :members => members,
24
+ :actions => actions,
25
+ }
26
+
27
+ response = Excon::Response.new
28
+ response.body = {"RequestId" => Fog::AWS::Mock.request_id}
29
+ response
18
30
  end
19
31
  end
20
32
  end
@@ -38,6 +38,7 @@ module Fog
38
38
  "EffectiveDeliveryPolicy" => %Q|{"http":{"defaultHealthyRetryPolicy":{"minDelayTarget":20,"maxDelayTarget":20,"numRetries":3,"numMaxDelayRetries":0,"numNoDelayRetries":0,"numMinDelayRetries":0,"backoffFunction":"linear"},"disableSubscriptionOverrides":false}}|,
39
39
  "Policy" => %Q|{"Version":"2008-10-17","Id":"__default_policy_ID","Statement":[{"Sid":"__default_statement_ID","Effect":"Allow","Principal":{"AWS":"*"},"Action":["SNS:Publish","SNS:RemovePermission","SNS:SetTopicAttributes","SNS:DeleteTopic","SNS:ListSubscriptionsByTopic","SNS:GetTopicAttributes","SNS:Receive","SNS:AddPermission","SNS:Subscribe"],"Resource":"arn:aws:sns:us-east-1:990279267269:Smithy","Condition":{"StringEquals":{"AWS:SourceOwner":"990279267269"}}}]}|
40
40
  }
41
+ self.data[:permissions][topic_arn] = {}
41
42
  response.body = {"TopicArn" => topic_arn, "RequestId" => Fog::AWS::Mock.request_id}
42
43
  response
43
44
  end
@@ -14,7 +14,14 @@ module Fog
14
14
 
15
15
  class Mock
16
16
  def remove_permission(options = {})
17
- Fog::Mock.not_implemented
17
+ topic_arn = options['TopicArn']
18
+ label = options['Label']
19
+
20
+ self.data[:permissions][topic_arn].delete(label)
21
+
22
+ response = Excon::Response.new
23
+ response.body = {"RequestId" => Fog::AWS::Mock.request_id}
24
+ response
18
25
  end
19
26
  end
20
27
  end
@@ -32,6 +32,7 @@ module Fog
32
32
  region_hash[key] = {
33
33
  :topics => {},
34
34
  :subscriptions => {},
35
+ :permissions => {},
35
36
  }
36
37
  end
37
38
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AWS
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -32,6 +32,14 @@ Shindo.tests('AWS::SNS | topic lifecycle tests', ['aws', 'sns']) do
32
32
  Fog::AWS[:sns].get_topic_attributes(@topic_arn).body
33
33
  end
34
34
 
35
+ tests("#add_permission('#{@topic_arn}')").formats(AWS::SNS::Formats::BASIC) do
36
+ Fog::AWS[:sns].add_permission('TopicArn' => @topic_arn, 'Label' => 'Test', 'ActionName.member.1' => 'Subscribe', 'AWSAccountId.member.1' => '1234567890').body
37
+ end
38
+
39
+ tests("#remove_permission('#{@topic_arn}')").formats(AWS::SNS::Formats::BASIC) do
40
+ Fog::AWS[:sns].remove_permission('TopicArn' => @topic_arn, 'Label' => 'Test').body
41
+ end
42
+
35
43
  tests("#delete_topic('#{@topic_arn}')").formats(AWS::SNS::Formats::BASIC) do
36
44
  Fog::AWS[:sns].delete_topic(@topic_arn).body
37
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane