fog-openstack 0.1.13 → 0.1.14

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: b2e12b17ba616a2d5b1d1290312ff5d1cd489c62
4
- data.tar.gz: b81c3f55d47899d6f5ecc77b25065ad77f3df5d0
3
+ metadata.gz: d553be58f8a9eb0f1972cb98898385c4499bc738
4
+ data.tar.gz: 6e25a7433659b73a9286016b2ec59b137e175b26
5
5
  SHA512:
6
- metadata.gz: 7b0cc3dfc3872a6cf24819aa45831807d5cbfec03cc9e992aced62f3576218befdb1e67502029e6b708b7a6d3fd3228924b09873e510ffa68304570b99003b5a
7
- data.tar.gz: f3d442b936d042cdbdc13c3c446fc6f3af09a5c9e602152b154dd61abe18c3b71bd219ce93156df38d220520e7a45d0bdc3dc9c826be1d3e488e3bc211636d76
6
+ metadata.gz: a690106d859693cb48f74ebf18dd9654c0c31219ddf324217df4c1fa344c87d472b6d1f67b52f04e05c426bfadcecf600996e70290402be97ce7eca70ebb0022
7
+ data.tar.gz: 07954dafb481e9dc4ecac147032ee8a60be25a417f140b4b00b01e5d8522e0bf7fde11d2c0b6a196f797f5e042cc792c95ae11f1f974a15ec3815939304b7868
@@ -20,6 +20,8 @@ module Fog
20
20
  ## MODELS
21
21
  #
22
22
  model_path 'fog/network/openstack/models'
23
+ model :extension
24
+ collection :extensions
23
25
  model :network
24
26
  collection :networks
25
27
  model :port
@@ -57,6 +59,10 @@ module Fog
57
59
  #
58
60
  request_path 'fog/network/openstack/requests'
59
61
 
62
+ # Neutron Extensions
63
+ request :list_extensions
64
+ request :get_extension
65
+
60
66
  # Network CRUD
61
67
  request :list_networks
62
68
  request :create_network
@@ -186,11 +192,21 @@ module Fog
186
192
  def self.data
187
193
  @data ||= Hash.new do |hash, key|
188
194
  qos_policy_id = Fog::UUID.uuid
189
- network_id = Fog::UUID.uuid
190
- subnet_id = Fog::UUID.uuid
191
- tenant_id = Fog::Mock.random_hex(8)
195
+ network_id = Fog::UUID.uuid
196
+ extension_id = Fog::UUID.uuid
197
+ subnet_id = Fog::UUID.uuid
198
+ tenant_id = Fog::Mock.random_hex(8)
192
199
 
193
200
  hash[key] = {
201
+ :extensions => {
202
+ extension_id => {
203
+ 'id' => extension_id,
204
+ 'alias' => 'dvr',
205
+ 'description' => 'Enables configuration of Distributed Virtual Routers.',
206
+ 'links' => [],
207
+ 'name' => 'Distributed Virtual Router'
208
+ }
209
+ },
194
210
  :networks => {
195
211
  network_id => {
196
212
  'id' => network_id,
@@ -0,0 +1,15 @@
1
+ require 'fog/openstack/models/model'
2
+
3
+ module Fog
4
+ module Network
5
+ class OpenStack
6
+ class Extension < Fog::OpenStack::Model
7
+ identity :id
8
+ attribute :name
9
+ attribute :links
10
+ attribute :description
11
+ attribute :alias
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,32 @@
1
+ require 'fog/openstack/models/collection'
2
+ require 'fog/network/openstack/models/extension'
3
+
4
+ module Fog
5
+ module Network
6
+ class OpenStack
7
+ class Extensions < Fog::OpenStack::Collection
8
+ attribute :filters
9
+
10
+ model Fog::Network::OpenStack::Extension
11
+
12
+ def initialize(attributes)
13
+ self.filters ||= {}
14
+ super
15
+ end
16
+
17
+ def all(filters_arg = filters)
18
+ filters = filters_arg
19
+ load_response(service.list_extensions(filters), 'extensions')
20
+ end
21
+
22
+ def get(extension_id)
23
+ if extension = service.get_extension(extension_id).body['extension']
24
+ new(extension)
25
+ end
26
+ rescue Fog::Network::OpenStack::NotFound
27
+ nil
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def get_extension(name)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "extensions/#{name}"
10
+ )
11
+ end
12
+ end
13
+
14
+ class Mock
15
+ def get_extension(name)
16
+ response = Excon::Response.new
17
+ if data = self.data[:extensions][name]
18
+ response.status = 200
19
+ response.body = {'extension' => data}
20
+ response
21
+ else
22
+ raise Fog::Network::OpenStack::NotFound
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def list_extensions(filters = {})
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => 'extensions',
10
+ :query => filters
11
+ )
12
+ end
13
+ end
14
+
15
+ class Mock
16
+ def list_extensions(_filters = {})
17
+ Excon::Response.new(
18
+ :body => {'extensions' => data[:extensions].values},
19
+ :status => 200
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Openstack
3
- VERSION = "0.1.13"
3
+ VERSION = "0.1.14"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-04 00:00:00.000000000 Z
11
+ date: 2016-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -710,6 +710,8 @@ files:
710
710
  - lib/fog/monitoring/openstack/requests/update_alarm.rb
711
711
  - lib/fog/monitoring/openstack/requests/update_alarm_definition.rb
712
712
  - lib/fog/network/openstack.rb
713
+ - lib/fog/network/openstack/models/extension.rb
714
+ - lib/fog/network/openstack/models/extensions.rb
713
715
  - lib/fog/network/openstack/models/floating_ip.rb
714
716
  - lib/fog/network/openstack/models/floating_ips.rb
715
717
  - lib/fog/network/openstack/models/ike_policies.rb
@@ -780,6 +782,7 @@ files:
780
782
  - lib/fog/network/openstack/requests/delete_vpn_service.rb
781
783
  - lib/fog/network/openstack/requests/disassociate_floating_ip.rb
782
784
  - lib/fog/network/openstack/requests/disassociate_lb_health_monitor.rb
785
+ - lib/fog/network/openstack/requests/get_extension.rb
783
786
  - lib/fog/network/openstack/requests/get_floating_ip.rb
784
787
  - lib/fog/network/openstack/requests/get_ike_policy.rb
785
788
  - lib/fog/network/openstack/requests/get_ipsec_policy.rb
@@ -799,6 +802,7 @@ files:
799
802
  - lib/fog/network/openstack/requests/get_security_group_rule.rb
800
803
  - lib/fog/network/openstack/requests/get_subnet.rb
801
804
  - lib/fog/network/openstack/requests/get_vpn_service.rb
805
+ - lib/fog/network/openstack/requests/list_extensions.rb
802
806
  - lib/fog/network/openstack/requests/list_floating_ips.rb
803
807
  - lib/fog/network/openstack/requests/list_ike_policies.rb
804
808
  - lib/fog/network/openstack/requests/list_ipsec_policies.rb