ext_fog_aws 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +3 -0
- data/lib/ext_fog_aws.rb +12 -0
- data/lib/ext_fog_aws/fog/aws/iam.rb +16 -0
- data/lib/ext_fog_aws/fog/aws/models/iam/group.rb +22 -0
- data/lib/ext_fog_aws/fog/aws/ses.rb +21 -0
- data/lib/ext_fog_aws/fog/core/service.rb +20 -0
- data/lib/ext_fog_aws/fog/parsers/aws/base.rb +28 -0
- data/lib/ext_fog_aws/fog/parsers/base.rb +16 -0
- data/lib/ext_fog_aws/fog/parsers/schema.rb +182 -0
- data/lib/ext_fog_aws/version.rb +3 -0
- data/lib/fog/aws/models/iam/ssh_public_key.rb +36 -0
- data/lib/fog/aws/models/iam/ssh_public_keys.rb +29 -0
- data/lib/fog/aws/models/ses/domain.rb +52 -0
- data/lib/fog/aws/models/ses/domains.rb +23 -0
- data/lib/fog/aws/models/ses/receipt_rule.rb +63 -0
- data/lib/fog/aws/models/ses/receipt_rules.rb +22 -0
- data/lib/fog/aws/requests/iam/delete_ssh_public_key.rb +20 -0
- data/lib/fog/aws/requests/iam/list_ssh_public_keys.rb +35 -0
- data/lib/fog/aws/requests/iam/upload_ssh_public_key.rb +37 -0
- data/lib/fog/aws/requests/ses/delete_identity.rb +24 -0
- data/lib/fog/aws/requests/ses/describe_active_receipt_rule_set.rb +74 -0
- data/lib/fog/aws/requests/ses/list_identities.rb +29 -0
- data/lib/fog/aws/requests/ses/list_receipt_rule_sets.rb +32 -0
- data/lib/fog/aws/requests/ses/verify_domain_dkim.rb +29 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e0e28a1c6e375f4416c6c99279353593d9210de53f6d9133879eb084e48aa868
|
4
|
+
data.tar.gz: 80ff1e222bcbbf98293e07c5e030671858c878819e9f40cbc5097d5550317c84
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a06c3e3256dd32083ee2268dc99c0ba26620b085ef54558384417c5dcac601f42105081f165266a3aa277c4bfc555e868c9768f78f964e4bc3dac344a7691b67
|
7
|
+
data.tar.gz: 54316df4dfcfc3f8880f2173b5347224306456b14d9fa51b24dede5c8320c77c0770af8923f444cfdc50af35f8984aff028e9f91155a69539a2ddff9e5f5e986
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Patrice Lebel
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/lib/ext_fog_aws.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "ext_fog_aws/version"
|
2
|
+
# https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/excon.rb
|
3
|
+
require 'fog-aws'
|
4
|
+
require 'ext_fog_aws/fog/core/service'
|
5
|
+
require 'ext_fog_aws/fog/parsers/base'
|
6
|
+
require 'ext_fog_aws/fog/parsers/aws/base'
|
7
|
+
require 'ext_fog_aws/fog/aws/iam'
|
8
|
+
require 'ext_fog_aws/fog/aws/ses'
|
9
|
+
|
10
|
+
module ExtFogAws
|
11
|
+
# Your code goes here...
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fog/aws/iam'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
IAM.class_eval do
|
6
|
+
request :delete_ssh_public_key
|
7
|
+
request :list_ssh_public_keys
|
8
|
+
request :upload_ssh_public_key
|
9
|
+
|
10
|
+
model :ssh_public_key
|
11
|
+
collection :ssh_public_keys
|
12
|
+
|
13
|
+
extend_model :group
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'fog/aws/models/iam/group'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class IAM
|
6
|
+
Group.class_eval do
|
7
|
+
def remove_user(user_or_name)
|
8
|
+
requires :name
|
9
|
+
|
10
|
+
user = if user_or_name.is_a?(Fog::AWS::IAM::User)
|
11
|
+
user_or_name
|
12
|
+
else
|
13
|
+
service.users.new(:id => user_or_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
service.remove_user_from_group(self.name, user.identity)
|
17
|
+
merge_attributes(:users => self.users - [user])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'fog/aws/ses'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
SES.class_eval do
|
6
|
+
# request :create_receipt_rule
|
7
|
+
# request :delete_receipt_rule
|
8
|
+
request :delete_identity
|
9
|
+
request :describe_active_receipt_rule_set
|
10
|
+
request :list_identities
|
11
|
+
request :list_receipt_rule_sets
|
12
|
+
request :verify_domain_dkim
|
13
|
+
|
14
|
+
model_path 'fog/aws/models/ses'
|
15
|
+
model :domain
|
16
|
+
collection :domains
|
17
|
+
model :receipt_rule
|
18
|
+
collection :receipt_rules
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
Service.class_eval do
|
3
|
+
class << self
|
4
|
+
def extend_request(request)
|
5
|
+
index = requests.index{ |_path, name| name == request }
|
6
|
+
requests[index][0] = File.join('ext', @request_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def extend_model(model)
|
10
|
+
index = model_files.index{ |_path, name| name == model }
|
11
|
+
model_files[index][0] = File.join('ext', @model_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def extend_collection(collection)
|
15
|
+
index = collection_files.index{ |_path, name| name == collection }
|
16
|
+
collection_files[index][0] = File.join('ext', @model_path)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
class Base < Fog::Parsers::Base
|
5
|
+
def self.schema
|
6
|
+
aws_schema.merge!({
|
7
|
+
'ResponseMetadata' => {
|
8
|
+
'RequestId' => :string
|
9
|
+
}
|
10
|
+
})
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.aws_schema
|
14
|
+
{}
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.arrays
|
18
|
+
["member"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def reset
|
22
|
+
super
|
23
|
+
@response['ResponseMetadata'] = {}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Parsers
|
5
|
+
module Schema
|
6
|
+
def reset
|
7
|
+
super
|
8
|
+
return unless (@schema = self.class.schema)
|
9
|
+
|
10
|
+
@stack = NodeStack.new(@response, @schema, self.class.arrays)
|
11
|
+
end
|
12
|
+
|
13
|
+
def start_element(name, attrs = [])
|
14
|
+
super
|
15
|
+
return unless @schema
|
16
|
+
|
17
|
+
@stack.start_element name
|
18
|
+
end
|
19
|
+
|
20
|
+
def end_element(name)
|
21
|
+
return super unless @schema
|
22
|
+
|
23
|
+
@stack.end_element name, value
|
24
|
+
end
|
25
|
+
|
26
|
+
class NodeStack < Array
|
27
|
+
alias_method :top, :last
|
28
|
+
|
29
|
+
def initialize(*args)
|
30
|
+
@response, @schema, @arrays = args
|
31
|
+
super()
|
32
|
+
end
|
33
|
+
|
34
|
+
def start_element(name)
|
35
|
+
if top
|
36
|
+
if @arrays.include? name
|
37
|
+
push top.new_item
|
38
|
+
elsif top.next_schema.key? name
|
39
|
+
push new_node(name, top.next_schema, top.next_result)
|
40
|
+
end
|
41
|
+
elsif @schema.key? name
|
42
|
+
push new_node(name, @schema, @response)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def end_element(name, value)
|
47
|
+
if top
|
48
|
+
if (@arrays + [top.name]).include? name
|
49
|
+
top.update_result(value)
|
50
|
+
pop
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def new_node(name, schema_pointer, result_pointer)
|
56
|
+
node_class =
|
57
|
+
case schema_pointer[name]
|
58
|
+
when Hash
|
59
|
+
NodeHash
|
60
|
+
when Array
|
61
|
+
NodeArray
|
62
|
+
else
|
63
|
+
NodeValue
|
64
|
+
end
|
65
|
+
node_class.new(name, schema_pointer, result_pointer)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class Node
|
70
|
+
attr_reader :name
|
71
|
+
|
72
|
+
def initialize(name, schema_pointer, result_pointer, index = nil)
|
73
|
+
@name = name
|
74
|
+
@schema_pointer = schema_pointer
|
75
|
+
@result_pointer = result_pointer
|
76
|
+
@index = index
|
77
|
+
end
|
78
|
+
|
79
|
+
def update_result(_value); end
|
80
|
+
|
81
|
+
def next_schema
|
82
|
+
raise NotImplementedError
|
83
|
+
end
|
84
|
+
|
85
|
+
def next_result
|
86
|
+
raise NotImplementedError
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class NodeHash < Node
|
91
|
+
def initialize(*)
|
92
|
+
super
|
93
|
+
if @index
|
94
|
+
@result_pointer[name][@index] = {}
|
95
|
+
else
|
96
|
+
@result_pointer[name] = {}
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def next_schema
|
101
|
+
_next_schema.is_a?(Hash) ? _next_schema : {}
|
102
|
+
end
|
103
|
+
|
104
|
+
def next_result
|
105
|
+
_next_schema.is_a?(Hash) ? _next_result : {}
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def _next_schema
|
111
|
+
if @index
|
112
|
+
@schema_pointer[name].first
|
113
|
+
else
|
114
|
+
@schema_pointer[name]
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def _next_result
|
119
|
+
if @index
|
120
|
+
@result_pointer[name][@index]
|
121
|
+
else
|
122
|
+
@result_pointer[name]
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
class NodeValue < Node
|
128
|
+
def next_schema
|
129
|
+
{}
|
130
|
+
end
|
131
|
+
|
132
|
+
def next_result
|
133
|
+
{}
|
134
|
+
end
|
135
|
+
|
136
|
+
def update_result(value)
|
137
|
+
if @index
|
138
|
+
@result_pointer[name][@index] = cast(value)
|
139
|
+
else
|
140
|
+
@result_pointer[name] = cast(value)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
private
|
145
|
+
|
146
|
+
def cast(value)
|
147
|
+
case @schema_pointer[name]
|
148
|
+
when :boolean
|
149
|
+
value == "true"
|
150
|
+
when :time
|
151
|
+
Time.parse(value)
|
152
|
+
when :integer
|
153
|
+
value.to_i
|
154
|
+
when :float
|
155
|
+
value.to_f
|
156
|
+
else
|
157
|
+
value
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
class NodeArray < Node
|
163
|
+
def initialize(*)
|
164
|
+
super
|
165
|
+
@count = 0
|
166
|
+
@result_pointer[name] = []
|
167
|
+
end
|
168
|
+
|
169
|
+
def next_schema
|
170
|
+
@schema_pointer[name].first
|
171
|
+
end
|
172
|
+
|
173
|
+
def new_item
|
174
|
+
index = @count
|
175
|
+
@count += 1
|
176
|
+
item_class = next_schema.is_a?(Hash) ? NodeHash : NodeValue
|
177
|
+
item_class.new(name, @schema_pointer, @result_pointer, index)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class SshPublicKey < Fog::Model
|
5
|
+
identity :id, :aliases => 'SSHPublicKeyId'
|
6
|
+
attribute :body, :aliases => 'SSHPublicKeyBody'
|
7
|
+
attribute :fingerprint, :aliases => 'Fingerprint'
|
8
|
+
attribute :status, :aliases => 'Status'
|
9
|
+
attribute :upload_date, :aliases => 'UploadDate'
|
10
|
+
attribute :username, :aliases => 'UserName'
|
11
|
+
|
12
|
+
def save
|
13
|
+
requires :body
|
14
|
+
requires :username
|
15
|
+
|
16
|
+
data = service.upload_ssh_public_key(body, username).body["SSHPublicKey"]
|
17
|
+
merge_attributes(data)
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def destroy
|
22
|
+
requires :id
|
23
|
+
requires :username
|
24
|
+
|
25
|
+
service.delete_ssh_public_key(id, username)
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def user
|
30
|
+
requires :username
|
31
|
+
service.users.get(username)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'fog/aws/models/iam/ssh_public_key'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class IAM
|
6
|
+
class SshPublicKeys < Fog::Collection
|
7
|
+
model Fog::AWS::IAM::SshPublicKey
|
8
|
+
|
9
|
+
def initialize(attributes = {})
|
10
|
+
@username = attributes[:username]
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def all
|
15
|
+
data = service.list_ssh_public_keys('UserName'=> @username).body['SSHPublicKeys']
|
16
|
+
load(data)
|
17
|
+
end
|
18
|
+
|
19
|
+
def get(identity)
|
20
|
+
self.all.select {|ssh_public_key| ssh_public_key.id == identity}.first
|
21
|
+
end
|
22
|
+
|
23
|
+
def new(attributes = {})
|
24
|
+
super({username: @username }.merge!(attributes))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class SES
|
4
|
+
class Domain < Fog::Model
|
5
|
+
identity :name, :aliases => 'Domain'
|
6
|
+
attribute :verification_token, :aliases => 'VerificationToken'
|
7
|
+
attribute :dkim_tokens, :aliases => 'DkimTokens'
|
8
|
+
attribute :with_inbox, type: :boolean
|
9
|
+
|
10
|
+
def save
|
11
|
+
requires :name
|
12
|
+
|
13
|
+
verification_token = service.verify_domain_identity(name).body['VerificationToken']
|
14
|
+
dkim_tokens = service.verify_domain_dkim(name).body['DkimTokens']
|
15
|
+
merge_attributes(verification_token: verification_token, dkim_tokens: dkim_tokens)
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def destroy
|
20
|
+
requires :name
|
21
|
+
|
22
|
+
service.delete_identity(name)
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
def records
|
27
|
+
([verification_record] + dkim_records + [inbox_record]).compact
|
28
|
+
end
|
29
|
+
|
30
|
+
def verification_record
|
31
|
+
if verification_token
|
32
|
+
{ name: "_amazonses.#{name}", value: %{"#{verification_token}"}, type: 'TXT' }
|
33
|
+
else
|
34
|
+
{ name: "_amazonses.#{name}", type: 'TXT' }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def dkim_records
|
39
|
+
if dkim_tokens
|
40
|
+
dkim_tokens.map{ |token| { name: "#{token}._domainkey.#{name}", value: "#{token}.dkim.amazonses.com", type: 'CNAME' } }
|
41
|
+
else
|
42
|
+
[{ name: "_domainkey.#{name}", type: 'CNAME' }]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def inbox_record
|
47
|
+
{ name: name, value: "10 inbound-smtp.us-east-1.amazonaws.com", type: 'MX' } if with_inbox
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'fog/aws/models/ses/domain'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class SES
|
6
|
+
class Domains < Fog::Collection
|
7
|
+
model Fog::AWS::SES::Domain
|
8
|
+
|
9
|
+
def all
|
10
|
+
data = service.list_identities('Type'=> 'Domain').body['Identities'].map{ |name| { 'Domain' => name } }
|
11
|
+
load(data)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(domain, with_inbox: false)
|
15
|
+
if (result = self.all.select{ |identity| identity.name == domain }.first)
|
16
|
+
result.with_inbox = with_inbox
|
17
|
+
end
|
18
|
+
result
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class SES
|
4
|
+
class ReceiptRule < Fog::Model
|
5
|
+
identity :name, aliases: 'Name'
|
6
|
+
attribute :actions, aliases: 'Actions', type: :array
|
7
|
+
attribute :enabled, aliases: 'Enabled', type: :boolean
|
8
|
+
attribute :recipients, aliases: 'Recipients', type: :array
|
9
|
+
attribute :scan_enabled, aliases: 'ScanEnabled', type: :boolean
|
10
|
+
attribute :tls_policy, aliases: 'TlsPolicy'
|
11
|
+
attribute :rule_set_name, aliases: 'RuleSetName'
|
12
|
+
|
13
|
+
def save
|
14
|
+
requires :name
|
15
|
+
requires :rule_set_name
|
16
|
+
|
17
|
+
raise NotImplementedError
|
18
|
+
|
19
|
+
# TODO doesn't work
|
20
|
+
rule = dup_attributes!
|
21
|
+
self.class.aliases.each do |aliases, name|
|
22
|
+
rule[aliases] = rule.delete(name) if rule.key?(name)
|
23
|
+
end
|
24
|
+
service.create_receipt_rule(rule, rule.delete('RuleSetName'))
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
def destroy
|
29
|
+
requires :name
|
30
|
+
requires :rule_set_name
|
31
|
+
|
32
|
+
raise NotImplementedError
|
33
|
+
|
34
|
+
# TODO doesn't work
|
35
|
+
service.delete_receipt_rule(name, rule_set_name)
|
36
|
+
true
|
37
|
+
end
|
38
|
+
|
39
|
+
def void!(domain, options = {})
|
40
|
+
merge_attributes({
|
41
|
+
'Actions' => [
|
42
|
+
{
|
43
|
+
'StopAction' => {
|
44
|
+
'Scope' => 'RuleSet'
|
45
|
+
}
|
46
|
+
}
|
47
|
+
],
|
48
|
+
'Enabled' => true,
|
49
|
+
'Name' => "void-#{domain}",
|
50
|
+
'Recipients' => [
|
51
|
+
domain
|
52
|
+
],
|
53
|
+
'ScanEnabled' => true,
|
54
|
+
'TlsPolicy' => 'Require',
|
55
|
+
'RuleSetName' => 'default-rule-set',
|
56
|
+
}.merge!(options))
|
57
|
+
|
58
|
+
self
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'fog/aws/models/ses/receipt_rule'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module AWS
|
5
|
+
class SES
|
6
|
+
class ReceiptRules < Fog::Collection
|
7
|
+
model Fog::AWS::SES::ReceiptRule
|
8
|
+
|
9
|
+
def all
|
10
|
+
data = service.describe_active_receipt_rule_set.body
|
11
|
+
rule_set_name = data['Metadata']['Name']
|
12
|
+
data = data['Rules'].map{ |rule| rule['RuleSetName'] = rule_set_name; rule }
|
13
|
+
load(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(name)
|
17
|
+
self.all.select{ |rule| rule.name == name }.first
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class IAM
|
4
|
+
class Real
|
5
|
+
require 'fog/aws/parsers/iam/basic'
|
6
|
+
|
7
|
+
# https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteSSHPublicKey.html
|
8
|
+
|
9
|
+
def delete_ssh_public_key(ssh_public_key_id, username)
|
10
|
+
request({
|
11
|
+
'SSHPublicKeyId' => ssh_public_key_id,
|
12
|
+
'UserName' => username,
|
13
|
+
'Action' => 'DeleteSSHPublicKey',
|
14
|
+
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
15
|
+
})
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module IAM
|
5
|
+
class ListSshPublicKeys < Fog::Parsers::AWS::Base
|
6
|
+
# https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListSSHPublicKeys.html
|
7
|
+
def self.aws_schema
|
8
|
+
{
|
9
|
+
'IsTruncated' => :boolean,
|
10
|
+
'Marker' => :string,
|
11
|
+
'SSHPublicKeys' => [{
|
12
|
+
'SSHPublicKeyId' => :string,
|
13
|
+
'Status' => 'Active|Inactive',
|
14
|
+
'UploadDate' => :time,
|
15
|
+
'UserName' => :string,
|
16
|
+
}]
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
module AWS
|
24
|
+
class IAM
|
25
|
+
class Real
|
26
|
+
def list_ssh_public_keys(options = {})
|
27
|
+
request({
|
28
|
+
'Action' => 'ListSSHPublicKeys',
|
29
|
+
:parser => Fog::Parsers::AWS::IAM::ListSshPublicKeys.new
|
30
|
+
}.merge!(options))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module IAM
|
5
|
+
class UploadSshPublicKey < Fog::Parsers::AWS::Base
|
6
|
+
# https://docs.aws.amazon.com/IAM/latest/APIReference/API_UploadSSHPublicKey.html
|
7
|
+
def self.aws_schema
|
8
|
+
{
|
9
|
+
'SSHPublicKey' => {
|
10
|
+
'Fingerprint' => :string,
|
11
|
+
'SSHPublicKeyBody' => :string,
|
12
|
+
'SSHPublicKeyId' => :string,
|
13
|
+
'Status' => 'Active|Inactive',
|
14
|
+
'UploadDate' => :time,
|
15
|
+
'UserName' => :string,
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
module AWS
|
24
|
+
class IAM
|
25
|
+
class Real
|
26
|
+
def upload_ssh_public_key(public_key, username)
|
27
|
+
request({
|
28
|
+
'Action' => 'UploadSSHPublicKey',
|
29
|
+
'SSHPublicKeyBody' => public_key,
|
30
|
+
'UserName' => username,
|
31
|
+
:parser => Fog::Parsers::AWS::IAM::UploadSshPublicKey.new
|
32
|
+
})
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module SES
|
5
|
+
class DeleteIdentity < Fog::Parsers::AWS::Base
|
6
|
+
# https://docs.aws.amazon.com/ses/latest/APIReference/API_DeleteIdentity.html
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
module AWS
|
12
|
+
class SES
|
13
|
+
class Real
|
14
|
+
def delete_identity(name)
|
15
|
+
request({
|
16
|
+
'Action' => 'DeleteIdentity',
|
17
|
+
'Identity' => name,
|
18
|
+
:parser => Fog::Parsers::AWS::SES::DeleteIdentity.new
|
19
|
+
})
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module SES
|
5
|
+
class DescribeActiveReceiptRuleSet < Fog::Parsers::AWS::Base
|
6
|
+
# https://docs.aws.amazon.com/ses/latest/APIReference/API_DescribeActiveReceiptRuleSet.html
|
7
|
+
def self.aws_schema
|
8
|
+
{
|
9
|
+
'Metadata' => {
|
10
|
+
'Name' => :string,
|
11
|
+
'CreatedTimestamp' => :time,
|
12
|
+
},
|
13
|
+
'Rules' => [{
|
14
|
+
'Actions' => [{
|
15
|
+
'AddHeaderAction' => {
|
16
|
+
'HeaderName' => :string,
|
17
|
+
'HeaderValue' => :string,
|
18
|
+
},
|
19
|
+
'BounceAction' => {
|
20
|
+
'Message' => :string,
|
21
|
+
'Sender' => :string,
|
22
|
+
'SmtpReplyCode' => :string,
|
23
|
+
'StatusCode' => :string,
|
24
|
+
'TopicArn' => :string,
|
25
|
+
},
|
26
|
+
'LambdaAction' => {
|
27
|
+
'FunctionArn' => :string,
|
28
|
+
'InvocationType' => 'Event|RequestResponse',
|
29
|
+
'TopicArn' => :string,
|
30
|
+
},
|
31
|
+
'S3Action' => {
|
32
|
+
'BucketName' => :string,
|
33
|
+
'KmsKeyArn' => :string,
|
34
|
+
'ObjectKeyPrefix' => :string,
|
35
|
+
'TopicArn' => :string,
|
36
|
+
},
|
37
|
+
'SNSAction' => {
|
38
|
+
'Encoding' => 'UTF-8|Base64',
|
39
|
+
'TopicArn' => :string,
|
40
|
+
},
|
41
|
+
'StopAction' => {
|
42
|
+
'Scope' => 'RuleSet',
|
43
|
+
'TopicArn' => :string,
|
44
|
+
},
|
45
|
+
'WorkmailAction' => {
|
46
|
+
'OrganizationArn' => :string,
|
47
|
+
'TopicArn' => :string,
|
48
|
+
},
|
49
|
+
}],
|
50
|
+
'Enabled' => :boolean,
|
51
|
+
'Name' => :string,
|
52
|
+
'Recipients' => [:string],
|
53
|
+
'ScanEnabled' => :boolean,
|
54
|
+
'TlsPolicy' => 'Require|Optional',
|
55
|
+
}]
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
module AWS
|
63
|
+
class SES
|
64
|
+
class Real
|
65
|
+
def describe_active_receipt_rule_set(options = {})
|
66
|
+
request({
|
67
|
+
'Action' => 'DescribeActiveReceiptRuleSet',
|
68
|
+
:parser => Fog::Parsers::AWS::SES::DescribeActiveReceiptRuleSet.new
|
69
|
+
}.merge!(options))
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module SES
|
5
|
+
class ListIdentities < Fog::Parsers::AWS::Base
|
6
|
+
# https://docs.aws.amazon.com/ses/latest/APIReference/API_ListIdentities.html
|
7
|
+
def self.aws_schema
|
8
|
+
{
|
9
|
+
'Identities' => [:string],
|
10
|
+
'NextToken' => :string,
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
module AWS
|
18
|
+
class SES
|
19
|
+
class Real
|
20
|
+
def list_identities(options = {})
|
21
|
+
request({
|
22
|
+
'Action' => 'ListIdentities',
|
23
|
+
:parser => Fog::Parsers::AWS::SES::ListIdentities.new
|
24
|
+
}.merge!(options))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module SES
|
5
|
+
class ListReceiptRuleSets < Fog::Parsers::AWS::Base
|
6
|
+
# https://docs.aws.amazon.com/ses/latest/APIReference/API_ListReceiptRuleSets.html
|
7
|
+
def self.aws_schema
|
8
|
+
{
|
9
|
+
'NextToken' => :string,
|
10
|
+
'RuleSets' => [{
|
11
|
+
'Name' => :string,
|
12
|
+
'CreatedTimestamp' => :time,
|
13
|
+
}]
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
module AWS
|
21
|
+
class SES
|
22
|
+
class Real
|
23
|
+
def list_receipt_rule_sets(options = {})
|
24
|
+
request({
|
25
|
+
'Action' => 'ListReceiptRuleSets',
|
26
|
+
:parser => Fog::Parsers::AWS::SES::ListReceiptRuleSets.new
|
27
|
+
}.merge!(options))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Parsers
|
3
|
+
module AWS
|
4
|
+
module SES
|
5
|
+
class VerifyDomainDkim < Fog::Parsers::AWS::Base
|
6
|
+
# https://docs.aws.amazon.com/ses/latest/APIReference/API_VerifyDomainDkim.html
|
7
|
+
def self.aws_schema
|
8
|
+
{
|
9
|
+
'DkimTokens' => [:string]
|
10
|
+
}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
module AWS
|
17
|
+
class SES
|
18
|
+
class Real
|
19
|
+
def verify_domain_dkim(domain)
|
20
|
+
request({
|
21
|
+
'Action' => 'VerifyDomainDkim',
|
22
|
+
'Domain' => domain,
|
23
|
+
:parser => Fog::Parsers::AWS::SES::VerifyDomainDkim.new
|
24
|
+
})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ext_fog_aws
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Patrice Lebel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fog-aws
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mime-types
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: ExtFogAws
|
42
|
+
email:
|
43
|
+
- patleb@users.noreply.github.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.md
|
50
|
+
- lib/ext_fog_aws.rb
|
51
|
+
- lib/ext_fog_aws/fog/aws/iam.rb
|
52
|
+
- lib/ext_fog_aws/fog/aws/models/iam/group.rb
|
53
|
+
- lib/ext_fog_aws/fog/aws/ses.rb
|
54
|
+
- lib/ext_fog_aws/fog/core/service.rb
|
55
|
+
- lib/ext_fog_aws/fog/parsers/aws/base.rb
|
56
|
+
- lib/ext_fog_aws/fog/parsers/base.rb
|
57
|
+
- lib/ext_fog_aws/fog/parsers/schema.rb
|
58
|
+
- lib/ext_fog_aws/version.rb
|
59
|
+
- lib/fog/aws/models/iam/ssh_public_key.rb
|
60
|
+
- lib/fog/aws/models/iam/ssh_public_keys.rb
|
61
|
+
- lib/fog/aws/models/ses/domain.rb
|
62
|
+
- lib/fog/aws/models/ses/domains.rb
|
63
|
+
- lib/fog/aws/models/ses/receipt_rule.rb
|
64
|
+
- lib/fog/aws/models/ses/receipt_rules.rb
|
65
|
+
- lib/fog/aws/requests/iam/delete_ssh_public_key.rb
|
66
|
+
- lib/fog/aws/requests/iam/list_ssh_public_keys.rb
|
67
|
+
- lib/fog/aws/requests/iam/upload_ssh_public_key.rb
|
68
|
+
- lib/fog/aws/requests/ses/delete_identity.rb
|
69
|
+
- lib/fog/aws/requests/ses/describe_active_receipt_rule_set.rb
|
70
|
+
- lib/fog/aws/requests/ses/list_identities.rb
|
71
|
+
- lib/fog/aws/requests/ses/list_receipt_rule_sets.rb
|
72
|
+
- lib/fog/aws/requests/ses/verify_domain_dkim.rb
|
73
|
+
homepage: https://github.com/patleb/ext_fog_aws
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubygems_version: 3.0.1
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: ExtFogAws
|
96
|
+
test_files: []
|