ibm-cloud-sdk 0.1.5 → 0.1.6

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
  SHA256:
3
- metadata.gz: 8fe8cad325a98aabb1bd328c04aec7c1c4b7dbda4859d41a85baa51916a40d80
4
- data.tar.gz: e40564d9e168b80623282caa7bb1b4efe5519e16a7757f8ac657ddbf57c0976a
3
+ metadata.gz: 160845336c50ab1c67c274cb62fd5e52af7bf0d6e4b5a4a1b57c4ea3c5eb47db
4
+ data.tar.gz: 7762d522d6754815a4e19a927bdcce0d73a8c5a0d204980d44dfdf006d7254d4
5
5
  SHA512:
6
- metadata.gz: 2dabd16a4f84e7c7ade80f0a5d36f0796f15681a53f0f271b01ff6d98b41b00ea249f681c9c402961e53c0a94943c32c18d41e6f1421075be15561ce5c369c7e
7
- data.tar.gz: 90bea5c5ae247170955e937be0fef41c8bd43f0d8749b8a3c08786f25759dd669e5f32e9a35bedada529a5936eb9ae0f06a329df4dcbb99a56c60d2f4dbb7659
6
+ metadata.gz: f42fe440d6a3610c94b7336246eda2dfdf6f794afa501480e633563d3a25f2d27bc337ebf41f82b82dad3a3958c2dbbf094244da77021fbe188fffa5cb73d294
7
+ data.tar.gz: 7af6df6df99133b619aa62bcc03281dc58f8b1f79c1b26d57b6cbf490dfc85f0dbdd46d41306780d8ead81148d71bf9003b78b787d8d21a64c6974ac0fc546a7
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
  All notable changes to the gem ibm-cloud-sdk-ruby will be documented here.
3
3
 
4
+ ## v0.1.6 - 2020-09-23
5
+ - Add PowerIaaS method to get instance info
6
+ - Return region specific PowerVS storage types
7
+ - Move VPC instance into instances and add initialization method.
8
+
4
9
  ## v0.1.5 - 2020-09-21
5
10
  - Added Enumerable based pagination support
6
11
  - Move instance profiles
@@ -21,6 +21,13 @@ module IBM
21
21
  "https://#{region.sub(/-\d$/, '')}.power-iaas.cloud.ibm.com/pcloud/v1"
22
22
  end
23
23
 
24
+ # Get Power Cloud Instance information
25
+ #
26
+ # @return [Hash] CloudInstance
27
+ def get_pcloud_instance
28
+ get("cloud-instances/#{guid}")
29
+ end
30
+
24
31
  # Get all PVM instances in an IBM Power Cloud instance
25
32
  #
26
33
  # @return [Array<Hash>] all PVM Instances for this instance
@@ -159,7 +166,7 @@ module IBM
159
166
  #
160
167
  # @return [Hash] StorageType
161
168
  def get_storage_types
162
- JSON.parse(RestClient.get("https://#{region.sub(/-\d$/, '')}.power-iaas.cloud.ibm.com/broker/v1/storage-types", headers))
169
+ JSON.parse(RestClient.get("https://#{region.sub(/-\d$/, '')}.power-iaas.cloud.ibm.com/broker/v1/storage-types", headers))[region]
163
170
  end
164
171
 
165
172
  def create_network(network_hash)
@@ -1,7 +1,7 @@
1
1
  module IBM
2
2
  module Cloud
3
3
  module SDK
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
6
6
  end
7
7
  end
@@ -9,39 +9,14 @@ module IBM
9
9
  module VPC
10
10
  module INSTANCES
11
11
  # All netowrk interfaces.
12
- class NetworkInterfaces < BaseVPC
12
+ class NetworkInterfaces < BaseCollection
13
13
  def initialize(parent)
14
- super(parent, 'network_interfaces')
15
- end
16
-
17
- def all
18
- get.subkey('network_interfaces')
19
- # get
20
- end
21
-
22
- def update(payload)
23
- post(payload)
24
- end
25
-
26
- def instance(id)
27
- NetworkInterface.new(self, id)
14
+ super(parent, 'network_interfaces', child_class: NetworkInterface)
28
15
  end
29
16
  end
30
17
 
31
18
  # A single network insterface.
32
- class NetworkInterface < BaseVPC
33
- def remove
34
- delete
35
- end
36
-
37
- def details
38
- get
39
- end
40
-
41
- def update(payload)
42
- patch(payload)
43
- end
44
-
19
+ class NetworkInterface < BaseInstance
45
20
  def floating_ips
46
21
  FloatingIps.new(self)
47
22
  end
@@ -7,37 +7,14 @@ module IBM
7
7
  module VPC
8
8
  module INSTANCES
9
9
  # Get all attached volumes.
10
- class VolumeAttachments < BaseVPC
10
+ class VolumeAttachments < BaseCollection
11
11
  def initialize(parent)
12
- super(parent, 'volume_attachments')
13
- end
14
-
15
- def all
16
- get
17
- end
18
-
19
- def create(payload)
20
- post(payload)
21
- end
22
-
23
- def instance(id)
24
- VolumeAttachment.new(self, id)
12
+ super(parent, 'volume_attachments', child_class: VolumeAttachment)
25
13
  end
26
14
  end
27
15
 
28
16
  # A single attached volume.
29
- class VolumeAttachment < BaseVPC
30
- def details
31
- get
32
- end
33
-
34
- def update(payload)
35
- patch(payload)
36
- end
37
-
38
- def remove
39
- delete
40
- end
17
+ class VolumeAttachment < BaseInstance
41
18
  end
42
19
  end
43
20
  end
@@ -1,7 +1,9 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative('instance')
4
+ require_relative 'instance/actions'
5
+ require_relative 'instance/network_interfaces'
6
+ require_relative 'instance/volume_attachments'
5
7
 
6
8
  module IBM
7
9
  module Cloud
@@ -11,7 +13,49 @@ module IBM
11
13
  # Work with multiple VM instances.
12
14
  class Instances < BaseCollection
13
15
  def initialize(parent)
14
- super(parent, 'instances', child_class: INSTANCES::Instance)
16
+ super(parent, 'instances', child_class: Instance)
17
+ end
18
+
19
+ # A chainable method to set query filters on the collection.
20
+ # @example vpc.images.params(limit: 1).all
21
+ #
22
+ # @param start [String] A server-supplied token determining what resource to start the page on.
23
+ # @param limit [Integer] The number of resources to return on a page allowed values are between 1 and 100
24
+ # @param name [String] Filters the collection to resources with the exact specified name
25
+ # @param vpc_id [String] Filters the collection to resources in the VPC with the specified identifier
26
+ # @param vpc_crn [String] Filters the collection to resources in the VPC with the specified CRN
27
+ # @param vpc_name [String] Filters the collection to resources in the VPC with the exact specified name
28
+ # @return [BaseCollection] This class with the param instance variable set.
29
+ def params(start: nil, limit: nil, name: nil, vpc_id: nil, vpc_crn: nil, vpc_name: nil)
30
+ super(start: start, limit: limit)
31
+ @params['name'] = name if name
32
+ @params['vpc.id'] = vpc_id if vpc_id
33
+ @params['vpc.crn'] = vpc_crn if vpc_crn
34
+ @params['vpc.name'] = vpc_name if vpc_name
35
+ self
36
+ end
37
+ end
38
+
39
+ # Work with a single instance.
40
+ class Instance < BaseInstance
41
+ def actions
42
+ INSTANCE::Actions.new(self)
43
+ end
44
+
45
+ def network_interfaces
46
+ INSTANCE::NetworkInterfaces.new(self)
47
+ end
48
+
49
+ def volume_attachments
50
+ INSTANCE::VolumeAttachments.new(self)
51
+ end
52
+
53
+ def profiles
54
+ INSTANCE::Profiles.new(self)
55
+ end
56
+
57
+ def initialization
58
+ adhoc(method: 'get', path: 'initialization').json
15
59
  end
16
60
  end
17
61
  end
@@ -27,7 +27,7 @@ module IBM
27
27
  end
28
28
 
29
29
  # A single zone.
30
- class Zone < BaseVPC
30
+ class Zone < BaseInstance
31
31
  end
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm-cloud-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - IBM Cloud Developers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -75,7 +75,6 @@ files:
75
75
  - lib/ibm/cloud/sdk/vpc/helpers/response.rb
76
76
  - lib/ibm/cloud/sdk/vpc/ike_policies.rb
77
77
  - lib/ibm/cloud/sdk/vpc/images.rb
78
- - lib/ibm/cloud/sdk/vpc/instance.rb
79
78
  - lib/ibm/cloud/sdk/vpc/instance/actions.rb
80
79
  - lib/ibm/cloud/sdk/vpc/instance/floating_ips.rb
81
80
  - lib/ibm/cloud/sdk/vpc/instance/network_interfaces.rb
@@ -109,7 +108,7 @@ licenses:
109
108
  - '"Apache-2.0"'
110
109
  metadata:
111
110
  homepage_uri: https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby
112
- changelog_uri: https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby/blob/v0.1.5/CHANGELOG.md
111
+ changelog_uri: https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby/blob/v0.1.6/CHANGELOG.md
113
112
  post_install_message:
114
113
  rdoc_options: []
115
114
  require_paths:
@@ -1,35 +0,0 @@
1
- # typed: true
2
- # frozen_string_literal: true
3
-
4
- require_relative 'instance/actions'
5
- require_relative 'instance/network_interfaces'
6
- require_relative 'instance/volume_attachments'
7
-
8
- module IBM
9
- module Cloud
10
- module SDK
11
- module VPC
12
- module INSTANCES
13
- # Work with a single instance.
14
- class Instance < BaseInstance
15
- def actions
16
- Actions.new(self)
17
- end
18
-
19
- def network_interfaces
20
- NetworkInterfaces.new(self)
21
- end
22
-
23
- def volume_attachments
24
- VolumeAttachments.new(self)
25
- end
26
-
27
- def profiles
28
- Profiles.new(self)
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end