fog-huaweicloud 0.0.3 → 0.1.2

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: 30a0fea20eda46cb34760f2535e6647fc29a3da5
4
- data.tar.gz: 0a287393066b8a9857f361fffd51c45cf6482fdf
3
+ metadata.gz: 073897e81a5750e2b73cfcf2019d1515f6bf174e
4
+ data.tar.gz: f174d120d9376189cc3905ca70675a80776d7e16
5
5
  SHA512:
6
- metadata.gz: b219778ca6cff3d7168cc465b7e1d394c9beb676b5f32cc9950e55f84aa5e21160b79bcbcf532bd96f497586cf85f2456134cdc8231a1f9a5859fdb3f4464966
7
- data.tar.gz: 72e3e133d239b70ae13e02b8b673234da216db7f3d3cc99f0836dff03d53aa8ce4642cb079bca5178e9d2f0795a3aff90c96e5d7b343826f87464317ca60f67c
6
+ metadata.gz: 095e90b2e07b86aa5866fee0e71485a2f3cbdc97fd4d0dcd53f235a2ad369bd0548e4d7a8794c027db7fa9edd72d28b89450dc60b32ba5f9fc512f8e2702e570
7
+ data.tar.gz: 46ae77270c82fd44c3143ed9a3ac39e217be21ff9640f212a56196060d8aad45e931f87443b2b4f993c5cd8d7b59386b977bbfda865f8417351f0ef80829ece1
data/CHANGELOG.md CHANGED
@@ -44,4 +44,4 @@
44
44
  ## Compute
45
45
 
46
46
  * create_server and the Server model where updated to allow booting a VM
47
- with NICs (subnet_id, port_id, fixed_ip).
47
+ with NICs (net_id, port_id, fixed_ip).
@@ -336,7 +336,7 @@ module Fog
336
336
  }
337
337
  ],
338
338
  "mac_addr" => "fa:16:3e:4c:2c:30",
339
- "subnet_id" => "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
339
+ "net_id" => "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
340
340
  "port_id" => "ce531f90-199f-48c0-816c-13e38010b442",
341
341
  "port_state" => "ACTIVE"
342
342
  }
@@ -7,7 +7,7 @@ module Fog
7
7
  identity :port_id
8
8
  attribute :fixed_ips, :type => :array
9
9
  attribute :mac_addr
10
- attribute :subnet_id
10
+ attribute :net_id
11
11
  attribute :port_state
12
12
  end
13
13
  end
@@ -12,8 +12,8 @@ module Fog
12
12
 
13
13
  if options[:port_id]
14
14
  body['interfaceAttachment']['port_id'] = options[:port_id]
15
- elsif options[:subnet_id]
16
- body['interfaceAttachment']['subnet_id'] = options[:subnet_id]
15
+ elsif options[:net_id]
16
+ body['interfaceAttachment']['net_id'] = options[:net_id]
17
17
  end
18
18
 
19
19
  if options[:ip_address]
@@ -46,7 +46,7 @@ module Fog
46
46
  data['server']['networks'] =
47
47
  Array(options['nics']).map do |nic|
48
48
  neti = {}
49
- neti['uuid'] = (nic['subnet_id'] || nic[:subnet_id]) unless (nic['subnet_id'] || nic[:subnet_id]).nil?
49
+ neti['uuid'] = (nic['net_id'] || nic[:net_id]) unless (nic['net_id'] || nic[:net_id]).nil?
50
50
  neti['fixed_ip'] = (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]) unless (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]).nil?
51
51
  neti['port'] = (nic['port_id'] || nic[:port_id]) unless (nic['port_id'] || nic[:port_id]).nil?
52
52
  neti
@@ -76,18 +76,12 @@ module Fog
76
76
 
77
77
  private
78
78
 
79
- def request(params, parse_json = true, overwrite_version={})
79
+ def request(params, parse_json = true)
80
80
  retried = false
81
81
  begin
82
- # NOTE: This is only for transition usage. It should be removed once we upgraded all
83
- # the APIs to non-OpenStack version.
84
- real_path = @path.clone
85
- overwrite_version.each do |key, value|
86
- real_path.sub!(key, value)
87
- end
88
82
  response = @connection.request(params.merge(
89
83
  :headers => headers(params.delete(:headers)),
90
- :path => "#{real_path}/#{params[:path]}"
84
+ :path => "#{@path}/#{params[:path]}"
91
85
  ))
92
86
  rescue Excon::Errors::Unauthorized => error
93
87
  # token expiration and token renewal possible
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module HuaweiCloud
3
- VERSION = '0.0.3'.freeze
3
+ VERSION = '0.1.2'.freeze
4
4
  end
5
5
  end
@@ -14,13 +14,13 @@ module Fog
14
14
  super
15
15
  end
16
16
 
17
- def all(filters_arg = filters, openstack_compatible=true)
17
+ def all(filters_arg = filters)
18
18
  filters = filters_arg
19
- load_response(service.list_subnets(filters, openstack_compatible), 'subnets')
19
+ load_response(service.list_subnets(filters), 'subnets')
20
20
  end
21
21
 
22
- def get(subnet_id, openstack_compatible=true)
23
- if subnet = service.get_subnet(subnet_id, openstack_compatible).body['subnet']
22
+ def get(subnet_id)
23
+ if subnet = service.get_subnet(subnet_id).body['subnet']
24
24
  new(subnet)
25
25
  end
26
26
  rescue Fog::Network::HuaweiCloud::NotFound
@@ -2,16 +2,17 @@ module Fog
2
2
  module Network
3
3
  class HuaweiCloud
4
4
  class Real
5
- def get_subnet(subnet_id,openstack_compatible = true)
6
- overwrite_version = openstack_compatible ? {} : {"v2.0" => "v1/#{@current_tenant['id']}"}
7
- request({:expects => [200], :method=> 'GET', :path => "subnets/#{subnet_id}"},
8
- true, overwrite_version
5
+ def get_subnet(subnet_id)
6
+ request(
7
+ :expects => [200],
8
+ :method => 'GET',
9
+ :path => "subnets/#{subnet_id}"
9
10
  )
10
11
  end
11
12
  end
12
13
 
13
14
  class Mock
14
- def get_subnet(subnet_id, openstack_compatible = true)
15
+ def get_subnet(subnet_id)
15
16
  response = Excon::Response.new
16
17
  if data = self.data[:subnets][subnet_id]
17
18
  response.status = 200
@@ -2,17 +2,18 @@ module Fog
2
2
  module Network
3
3
  class HuaweiCloud
4
4
  class Real
5
- def list_subnets(filters = {}, openstack_compatible = true)
6
- overwrite_version = openstack_compatible ? {} : {"v2.0" => "v1/#{@current_tenant['id']}"}
5
+ def list_subnets(filters = {})
7
6
  request(
8
- {:expects => 200, :method => 'GET', :path => 'subnets', :query => filters},
9
- true, overwrite_version
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :path => 'subnets',
10
+ :query => filters
10
11
  )
11
12
  end
12
13
  end
13
14
 
14
15
  class Mock
15
- def list_subnets(_filters = {}, openstack_compatible = true)
16
+ def list_subnets(_filters = {})
16
17
  Excon::Response.new(
17
18
  :body => {'subnets' => data[:subnets].values},
18
19
  :status => 200
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-huaweicloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huawei
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-03 00:00:00.000000000 Z
11
+ date: 2018-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core