fog-openstack 0.1.14 → 0.1.15

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d553be58f8a9eb0f1972cb98898385c4499bc738
4
- data.tar.gz: 6e25a7433659b73a9286016b2ec59b137e175b26
3
+ metadata.gz: 85c015f66fafdd1aeb99e59443520114635930dc
4
+ data.tar.gz: d0915c5216fd3e3bfd6c47f010a5e7dccabb0aee
5
5
  SHA512:
6
- metadata.gz: a690106d859693cb48f74ebf18dd9654c0c31219ddf324217df4c1fa344c87d472b6d1f67b52f04e05c426bfadcecf600996e70290402be97ce7eca70ebb0022
7
- data.tar.gz: 07954dafb481e9dc4ecac147032ee8a60be25a417f140b4b00b01e5d8522e0bf7fde11d2c0b6a196f797f5e042cc792c95ae11f1f974a15ec3815939304b7868
6
+ metadata.gz: 56f592d5413f1f712421cc7fa16f973b8b2445f89f0b4e719e3431350061795bc5bfa56e320a83e8173870409d1af3d4df08fdbedfd33e3d7b21edf2d5ec32f5
7
+ data.tar.gz: 360408ce8e42a4b21ea35f01d85bc76348ad18d99b7609d4e57f1b5284e2c3763432d2648203b34bbe529bd2994b5d078ad52c1562d18473676b5d1360ce4f2d
@@ -172,6 +172,7 @@ module Fog
172
172
  request :delete_security_group
173
173
  request :get_security_group
174
174
  request :list_security_groups
175
+ request :update_security_group
175
176
 
176
177
  # Security Group Rules
177
178
  request :create_security_group_rule
@@ -22,9 +22,14 @@ module Fog
22
22
  end
23
23
 
24
24
  def save
25
- raise Fog::Errors::Error, 'Resaving an existing object may create a duplicate' if persisted?
26
25
  merge_attributes(service.create_security_group(attributes).body['security_group'])
27
- true
26
+ self
27
+ end
28
+
29
+ def update
30
+ requires :id
31
+ merge_attributes(service.update_security_group(id, attributes).body['security_group'])
32
+ self
28
33
  end
29
34
  end
30
35
  end
@@ -0,0 +1,41 @@
1
+ module Fog
2
+ module Network
3
+ class OpenStack
4
+ class Real
5
+ def update_security_group(security_group_id, options = {})
6
+ data = {'security_group' => {}}
7
+
8
+ [:name, :description].each do |key|
9
+ data['security_group'][key] = options[key] if options[key]
10
+ end
11
+
12
+ request(
13
+ :body => Fog::JSON.encode(data),
14
+ :expects => 200,
15
+ :method => 'PUT',
16
+ :path => "security-groups/#{security_group_id}"
17
+ )
18
+ end
19
+ end
20
+
21
+ class Mock
22
+ def update_security_group(security_group_id, options = {})
23
+ response = Excon::Response.new
24
+ security_group = list_security_groups.body['security_groups'].find do |sg|
25
+ sg['id'] == security_group_id
26
+ end
27
+
28
+ if security_group
29
+ security_group['name'] = options[:name]
30
+ security_group['description'] = options[:description]
31
+ response.body = {'security_group' => security_group}
32
+ response.status = 200
33
+ response
34
+ else
35
+ raise Fog::Network::OpenStack::NotFound
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Openstack
3
- VERSION = "0.1.14"
3
+ VERSION = "0.1.15"
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.14
4
+ version: 0.1.15
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-05 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -833,6 +833,7 @@ files:
833
833
  - lib/fog/network/openstack/requests/update_quota.rb
834
834
  - lib/fog/network/openstack/requests/update_rbac_policy.rb
835
835
  - lib/fog/network/openstack/requests/update_router.rb
836
+ - lib/fog/network/openstack/requests/update_security_group.rb
836
837
  - lib/fog/network/openstack/requests/update_subnet.rb
837
838
  - lib/fog/network/openstack/requests/update_vpn_service.rb
838
839
  - lib/fog/nfv/openstack.rb