ibm-cloud-sdk 0.1.2 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/Gemfile +2 -0
- data/ibm-cloud-sdk.gemspec +3 -1
- data/lib/ibm/cloud/sdk.rb +3 -0
- data/lib/ibm/cloud/sdk/logging.rb +21 -0
- data/lib/ibm/cloud/sdk/null_logger.rb +19 -0
- data/lib/ibm/cloud/sdk/power_iaas.rb +181 -4
- data/lib/ibm/cloud/sdk/resource_controller.rb +2 -8
- data/lib/ibm/cloud/sdk/version.rb +1 -1
- data/lib/ibm/cloud/sdk/vpc.rb +133 -0
- data/lib/ibm/cloud/sdk/vpc/base_collection.rb +108 -0
- data/lib/ibm/cloud/sdk/vpc/base_instance.rb +23 -0
- data/lib/ibm/cloud/sdk/vpc/base_vpc.rb +61 -0
- data/lib/ibm/cloud/sdk/vpc/cloud_sdk.rb +33 -0
- data/lib/ibm/cloud/sdk/vpc/exceptions.rb +33 -0
- data/lib/ibm/cloud/sdk/vpc/floatingips.rb +20 -0
- data/lib/ibm/cloud/sdk/vpc/flowlogcollectors.rb +20 -0
- data/lib/ibm/cloud/sdk/vpc/helpers/connection.rb +96 -0
- data/lib/ibm/cloud/sdk/vpc/helpers/response.rb +134 -0
- data/lib/ibm/cloud/sdk/vpc/ike_policies.rb +24 -0
- data/lib/ibm/cloud/sdk/vpc/images.rb +21 -0
- data/lib/ibm/cloud/sdk/vpc/instance/actions.rb +19 -0
- data/lib/ibm/cloud/sdk/vpc/instance/floating_ips.rb +23 -0
- data/lib/ibm/cloud/sdk/vpc/instance/network_interfaces.rb +28 -0
- data/lib/ibm/cloud/sdk/vpc/instance/volume_attachments.rb +23 -0
- data/lib/ibm/cloud/sdk/vpc/instance_profiles.rb +21 -0
- data/lib/ibm/cloud/sdk/vpc/instances.rb +64 -0
- data/lib/ibm/cloud/sdk/vpc/ipsec_policies.rb +24 -0
- data/lib/ibm/cloud/sdk/vpc/keys.rb +43 -0
- data/lib/ibm/cloud/sdk/vpc/load_balancer.rb +23 -0
- data/lib/ibm/cloud/sdk/vpc/load_balancer/listeners.rb +30 -0
- data/lib/ibm/cloud/sdk/vpc/load_balancer/members.rb +23 -0
- data/lib/ibm/cloud/sdk/vpc/load_balancer/policies.rb +30 -0
- data/lib/ibm/cloud/sdk/vpc/load_balancer/pools.rb +28 -0
- data/lib/ibm/cloud/sdk/vpc/load_balancer/rules.rb +25 -0
- data/lib/ibm/cloud/sdk/vpc/load_balancers.rb +19 -0
- data/lib/ibm/cloud/sdk/vpc/network_acls.rb +39 -0
- data/lib/ibm/cloud/sdk/vpc/operating_systems.rb +21 -0
- data/lib/ibm/cloud/sdk/vpc/public_gateways.rb +21 -0
- data/lib/ibm/cloud/sdk/vpc/regions.rb +35 -0
- data/lib/ibm/cloud/sdk/vpc/security_groups.rb +48 -0
- data/lib/ibm/cloud/sdk/vpc/subnets.rb +21 -0
- data/lib/ibm/cloud/sdk/vpc/volume_profiles.rb +21 -0
- data/lib/ibm/cloud/sdk/vpc/volumes.rb +21 -0
- data/lib/ibm/cloud/sdk/vpc/vpcs.rb +60 -0
- data/lib/ibm/cloud/sdk/vpc/vpn_gateway/connections.rb +35 -0
- data/lib/ibm/cloud/sdk/vpc/vpn_gateway/local_cidrs.rb +32 -0
- data/lib/ibm/cloud/sdk/vpc/vpn_gateway/peer_cidrs.rb +32 -0
- data/lib/ibm/cloud/sdk/vpc/vpn_gateways.rb +25 -0
- metadata +60 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49b6c34b47c964d6025eb8ca01efc3221fe33603c1c56b3e86167925f6132f60
|
4
|
+
data.tar.gz: df5e08b1f01c0e05fbec5e8f5887139dde7210be53b2cf538b0357b7efe5f0a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afe2bfaae5cb2a853cd7ba2523a2aed7f0da6f6c319d1c2d730993ab5dc93613e928a423a0a7e0310023e96ad71aaa2f8129b5908d0c767e3679fdae8fa063ec
|
7
|
+
data.tar.gz: 91d9e41682d13a1671d63c57fb2a4620b8b5f4d001c055036b7942b60a1e57b9e8a348a4615866851ff09389f6ed868ce7a62eff15b85c7bc8d564559f1180c2
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to the gem ibm-cloud-sdk-ruby will be documented here.
|
3
|
+
|
4
|
+
## v0.1.7 - 2020-09-28
|
5
|
+
- Added Logging in IBM Cloud
|
6
|
+
- Add VCR to vpc spec
|
7
|
+
- Add exception when status of response is not in 200 range or 404
|
8
|
+
- Power IaaS Update docstrings, VM actions volumes
|
9
|
+
|
10
|
+
## v0.1.6 - 2020-09-23
|
11
|
+
- Add PowerIaaS method to get instance info
|
12
|
+
- Return region specific PowerVS storage types
|
13
|
+
- Move VPC instance into instances and add initialization method.
|
14
|
+
|
15
|
+
## v0.1.5 - 2020-09-21
|
16
|
+
- Added Enumerable based pagination support
|
17
|
+
- Move instance profiles
|
18
|
+
- Improve resource lookup by GUID
|
19
|
+
- Add support to create a PowerIaas volume
|
20
|
+
|
21
|
+
## v0.1.4 - 2020-09-17
|
22
|
+
- Added support for the IBM Virtual Private Cloud (VPC) service
|
23
|
+
|
24
|
+
## v0.1.3 - 2020-08-31
|
25
|
+
### Added the following rest api calls for Power System Virtual Server service
|
26
|
+
- Add PowerIaas 'delete_volume' method
|
27
|
+
- Add PowerVS SAP API calls
|
28
|
+
- get list of available system pools within a particular data center
|
29
|
+
- get list of all storage type availble in the data center. There may be
|
30
|
+
update to the call once PowerVS service updates the storage type rest api
|
31
|
+
for Power System Virtual Server service .
|
32
|
+
|
data/Gemfile
CHANGED
data/ibm-cloud-sdk.gemspec
CHANGED
@@ -11,7 +11,8 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.licenses = %w["Apache-2.0"]
|
12
12
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
13
|
|
14
|
-
spec.metadata["homepage_uri"]
|
14
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
15
|
+
spec.metadata["changelog_uri"] = "https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby/blob/v#{spec.version}/CHANGELOG.md"
|
15
16
|
|
16
17
|
# Specify which files should be added to the gem when it is released.
|
17
18
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -23,4 +24,5 @@ Gem::Specification.new do |spec|
|
|
23
24
|
spec.require_paths = ["lib"]
|
24
25
|
|
25
26
|
spec.add_dependency "rest-client"
|
27
|
+
spec.add_dependency "http"
|
26
28
|
end
|
data/lib/ibm/cloud/sdk.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
require "json"
|
2
3
|
require "rest-client"
|
3
4
|
|
@@ -6,6 +7,8 @@ require "ibm/cloud/sdk/iam"
|
|
6
7
|
require "ibm/cloud/sdk/power_iaas"
|
7
8
|
require "ibm/cloud/sdk/resource_controller"
|
8
9
|
require "ibm/cloud/sdk/version"
|
10
|
+
require "ibm/cloud/sdk/vpc/cloud_sdk"
|
11
|
+
require "ibm/cloud/sdk/logging"
|
9
12
|
|
10
13
|
module IBM
|
11
14
|
module Cloud
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'null_logger'
|
2
|
+
|
3
|
+
module IBM
|
4
|
+
module Cloud
|
5
|
+
module SDK
|
6
|
+
class << self
|
7
|
+
attr_writer :logger
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.logger
|
11
|
+
@logger ||= NullLogger.new
|
12
|
+
end
|
13
|
+
|
14
|
+
module Logging
|
15
|
+
def logger
|
16
|
+
IBM::Cloud::SDK.logger
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,7 +1,11 @@
|
|
1
|
+
require_relative 'logging'
|
2
|
+
|
1
3
|
module IBM
|
2
4
|
module Cloud
|
3
5
|
module SDK
|
4
6
|
class PowerIaas < BaseService
|
7
|
+
include Logging
|
8
|
+
|
5
9
|
# Create an API Client object for the Power IaaS service
|
6
10
|
#
|
7
11
|
# @param region [String] the IBM Power Cloud instance region
|
@@ -15,12 +19,23 @@ module IBM
|
|
15
19
|
@region = region
|
16
20
|
@token = token
|
17
21
|
@tenant = tenant
|
22
|
+
RestClient.log = logger
|
18
23
|
end
|
19
24
|
|
25
|
+
# Get the API service Endpoint URL
|
26
|
+
#
|
27
|
+
# @return [String] Endpoint URL
|
20
28
|
def endpoint
|
21
29
|
"https://#{region.sub(/-\d$/, '')}.power-iaas.cloud.ibm.com/pcloud/v1"
|
22
30
|
end
|
23
31
|
|
32
|
+
# Get Power Cloud Instance information
|
33
|
+
#
|
34
|
+
# @return [Hash] CloudInstance
|
35
|
+
def get_pcloud_instance
|
36
|
+
get("cloud-instances/#{guid}")
|
37
|
+
end
|
38
|
+
|
24
39
|
# Get all PVM instances in an IBM Power Cloud instance
|
25
40
|
#
|
26
41
|
# @return [Array<Hash>] all PVM Instances for this instance
|
@@ -34,12 +49,15 @@ module IBM
|
|
34
49
|
|
35
50
|
# Get an IBM Power Cloud PVM instance
|
36
51
|
#
|
37
|
-
# @param pvm_instance_id [String]
|
52
|
+
# @param pvm_instance_id [String] PVM instance ID
|
38
53
|
# @return [Hash] PVM Instances
|
39
54
|
def get_pvm_instance(instance_id)
|
40
55
|
get("cloud-instances/#{guid}/pvm-instances/#{instance_id}")
|
41
56
|
end
|
42
57
|
|
58
|
+
# Perform 'start' action on a PVMInstance
|
59
|
+
#
|
60
|
+
# @param pvm_instance_id [String] PVM instance ID
|
43
61
|
def start_pvm_instance(instance_id)
|
44
62
|
post(
|
45
63
|
"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action",
|
@@ -47,6 +65,9 @@ module IBM
|
|
47
65
|
)
|
48
66
|
end
|
49
67
|
|
68
|
+
# Perform 'stop' action on a PVMInstance
|
69
|
+
#
|
70
|
+
# @param pvm_instance_id [String] PVM instance ID
|
50
71
|
def stop_pvm_instance(instance_id)
|
51
72
|
post(
|
52
73
|
"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action",
|
@@ -54,6 +75,22 @@ module IBM
|
|
54
75
|
)
|
55
76
|
end
|
56
77
|
|
78
|
+
# Perform 'immediate-shutdown' action on a PVMInstance
|
79
|
+
#
|
80
|
+
# @param pvm_instance_id [String] PVM instance ID
|
81
|
+
def immediate_shutdown_pvm_instance(instance_id)
|
82
|
+
post(
|
83
|
+
"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action",
|
84
|
+
{"action" => "immediate-shutdown"}.to_json
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Perform 'reboot' action on a PVMInstance
|
89
|
+
#
|
90
|
+
# This action has been deprecated and replaced by 'soft-reboot'
|
91
|
+
# and 'hard-reboot'
|
92
|
+
#
|
93
|
+
# @param pvm_instance_id [String] PVM instance ID
|
57
94
|
def reboot_pvm_instance(instance_id)
|
58
95
|
post(
|
59
96
|
"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action",
|
@@ -61,10 +98,47 @@ module IBM
|
|
61
98
|
)
|
62
99
|
end
|
63
100
|
|
101
|
+
# Perform 'soft-reboot' action on a PVMInstance
|
102
|
+
#
|
103
|
+
# @param pvm_instance_id [String] PVM instance ID
|
104
|
+
def soft_reboot_pvm_instance(instance_id)
|
105
|
+
post(
|
106
|
+
"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action",
|
107
|
+
{"action" => "soft-reboot"}.to_json
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Perform 'hard-reboot' action on a PVMInstance
|
112
|
+
#
|
113
|
+
# @param pvm_instance_id [String] PVM instance ID
|
114
|
+
def hard_reboot_pvm_instance(instance_id)
|
115
|
+
post(
|
116
|
+
"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action",
|
117
|
+
{"action" => "hard-reboot"}.to_json
|
118
|
+
)
|
119
|
+
end
|
120
|
+
|
121
|
+
# Perform 'reset-state' action on a PVMInstance
|
122
|
+
#
|
123
|
+
# @param pvm_instance_id [String] PVM instance ID
|
124
|
+
def reset_state_pvm_instance(instance_id)
|
125
|
+
post(
|
126
|
+
"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action",
|
127
|
+
{"action" => "reset-state"}.to_json
|
128
|
+
)
|
129
|
+
end
|
130
|
+
|
131
|
+
# Create a new PVM instance
|
132
|
+
#
|
133
|
+
# @param instance_hash [Hash] New instance attributes
|
134
|
+
# @return [Hash] PVMInstance
|
64
135
|
def create_pvm_instance(instance_hash)
|
65
136
|
post("cloud-instances/#{guid}/pvm-instances", instance_hash.to_json)
|
66
137
|
end
|
67
138
|
|
139
|
+
# Delete a PVM instance
|
140
|
+
#
|
141
|
+
# @param pvm_instance_id [String] PVM instance ID
|
68
142
|
def delete_pvm_instance(instance_id)
|
69
143
|
delete("cloud-instances/#{guid}/pvm-instances/#{instance_id}")
|
70
144
|
end
|
@@ -82,7 +156,7 @@ module IBM
|
|
82
156
|
|
83
157
|
# Get an IBM Power Cloud image
|
84
158
|
#
|
85
|
-
# @param image_id [String]
|
159
|
+
# @param image_id [String] Image ID
|
86
160
|
# @return [Hash] Image
|
87
161
|
def get_image(image_id)
|
88
162
|
get("cloud-instances/#{guid}/images/#{image_id}")
|
@@ -90,6 +164,9 @@ module IBM
|
|
90
164
|
nil
|
91
165
|
end
|
92
166
|
|
167
|
+
# Delete an image from a cloud instance
|
168
|
+
#
|
169
|
+
# @param image_id [String] Image ID
|
93
170
|
def delete_image(image_id)
|
94
171
|
delete("cloud-instances/#{guid}/images/#{image_id}")
|
95
172
|
end
|
@@ -107,12 +184,43 @@ module IBM
|
|
107
184
|
|
108
185
|
# Get a specific volume
|
109
186
|
#
|
110
|
-
# @param volume_id [String]
|
187
|
+
# @param volume_id [String] Image ID
|
111
188
|
# @return [Hash] Volume
|
112
189
|
def get_volume(volume_id)
|
113
190
|
get("cloud-instances/#{guid}/volumes/#{volume_id}")
|
114
191
|
end
|
115
192
|
|
193
|
+
# Delete a volume
|
194
|
+
#
|
195
|
+
# @param volume_id [String] Volume ID
|
196
|
+
def delete_volume(volume_id)
|
197
|
+
delete("cloud-instances/#{guid}/volumes/#{volume_id}")
|
198
|
+
end
|
199
|
+
|
200
|
+
# Create a volume
|
201
|
+
#
|
202
|
+
# @param volume_hash [Hash] New volume attributes
|
203
|
+
# @return [Hash] Volume
|
204
|
+
def create_volume(volume_hash)
|
205
|
+
post("cloud-instances/#{guid}/volumes", volume_hash.to_json)
|
206
|
+
end
|
207
|
+
|
208
|
+
# Attach a volume
|
209
|
+
#
|
210
|
+
# @param pvm_instance_id [String] PVM Instance ID
|
211
|
+
# @param volume_id [String] Volume ID
|
212
|
+
def attach_volume(pvm_instance_id, volume_id)
|
213
|
+
post("cloud-instances/#{guid}/volumes/#{volumd_id}")
|
214
|
+
end
|
215
|
+
|
216
|
+
# Detach a volume
|
217
|
+
#
|
218
|
+
# @param pvm_instance_id [String] PVM Instance ID
|
219
|
+
# @param volume_id [String] Volume ID
|
220
|
+
def detach_volume(pvm_instance_id, volume_id)
|
221
|
+
delete("cloud-instances/#{guid}/volumes/#{volumd_id}")
|
222
|
+
end
|
223
|
+
|
116
224
|
# Get all networks in an IBM Power Cloud instance
|
117
225
|
#
|
118
226
|
# @return [Array<Hash>] all networks for this IBM Power Cloud instance
|
@@ -125,37 +233,106 @@ module IBM
|
|
125
233
|
|
126
234
|
# Get an IBM Power Cloud network
|
127
235
|
#
|
128
|
-
# @param network_id [String]
|
236
|
+
# @param network_id [String] Network ID
|
129
237
|
# @return [Hash] Network
|
130
238
|
def get_network(network_id)
|
131
239
|
get("cloud-instances/#{guid}/networks/#{network_id}")
|
132
240
|
end
|
133
241
|
|
242
|
+
# Get a available system pools list for IBM Power Cloud DC
|
243
|
+
#
|
244
|
+
# @return [Hash] SystemPool
|
245
|
+
def get_system_pool
|
246
|
+
get("cloud-instances/#{guid}/system-pools")
|
247
|
+
end
|
248
|
+
|
249
|
+
# Get a storage types list in IBM Power Cloud.
|
250
|
+
# note: this method to be refactored under the common
|
251
|
+
# IBM::Cloud::SDK::PowerIaas.endpoint when the rest api become available.
|
252
|
+
#
|
253
|
+
# @return [Array<Hash>] StorageType
|
254
|
+
def get_storage_types
|
255
|
+
JSON.parse(RestClient.get("https://#{region.sub(/-\d$/, '')}.power-iaas.cloud.ibm.com/broker/v1/storage-types", headers))[region]
|
256
|
+
end
|
257
|
+
|
258
|
+
# Create a new network
|
259
|
+
#
|
260
|
+
# @param network_hash [Hash] New network attributes
|
261
|
+
# @return [Hash] Network
|
134
262
|
def create_network(network_hash)
|
135
263
|
post("cloud-instances/#{guid}/networks", network_hash.to_json)
|
136
264
|
end
|
137
265
|
|
266
|
+
# Delete a network
|
267
|
+
#
|
268
|
+
# @param network_id [String] Network ID
|
138
269
|
def delete_network(network_id)
|
139
270
|
delete("cloud-instances/#{guid}/networks/#{network_id}")
|
140
271
|
end
|
141
272
|
|
273
|
+
# Get all ports for a network
|
274
|
+
#
|
275
|
+
# @param network_id [String] Network ID
|
276
|
+
# @return [Array<Hash>] NetworkPort
|
142
277
|
def get_network_ports(network_id)
|
143
278
|
get("cloud-instances/#{guid}/networks/#{network_id}/ports")["ports"]
|
144
279
|
end
|
145
280
|
|
281
|
+
# List the tenant's SSH Keys
|
282
|
+
#
|
283
|
+
# @return [Array<Hash>] SSHKey
|
146
284
|
def get_ssh_keys
|
147
285
|
get("tenants/#{tenant}")["sshKeys"]
|
148
286
|
end
|
149
287
|
|
288
|
+
# Add a new SSH key to the tenant
|
289
|
+
#
|
290
|
+
# @param name [String] User defined name for the SSH key
|
291
|
+
# @param sshkey [String] SSH RSA key
|
292
|
+
# @return [Hash] SSHKey
|
150
293
|
def create_key_pair(name, sshkey)
|
151
294
|
payload = {"name" => name, "sshkey" => sshkey}
|
152
295
|
post("tenants/#{tenant}/sshkeys", payload.to_json)
|
153
296
|
end
|
154
297
|
|
298
|
+
# Delete SSH key from the tenant
|
299
|
+
#
|
300
|
+
# @param sshkey_name [String] SSH Key name
|
155
301
|
def delete_key_pair(name)
|
156
302
|
delete("tenants/#{tenant}/sshkeys/#{name}")
|
157
303
|
end
|
158
304
|
|
305
|
+
# Get an SAP profile
|
306
|
+
#
|
307
|
+
# @param sap_profile_id [String] SAP Profile ID
|
308
|
+
# @return [Hash] SAP profile
|
309
|
+
def get_sap_profile(sap_profile_id)
|
310
|
+
get("cloud-instances/#{guid}/sap/#{sap_profile_id}")
|
311
|
+
end
|
312
|
+
|
313
|
+
# Get list of all SAP profiles
|
314
|
+
#
|
315
|
+
# @return [Array<Hash>] all SAP profiles available to this instance
|
316
|
+
def get_sap_profiles
|
317
|
+
sap_profiles = get("cloud-instances/#{guid}/sap")["profiles"] || []
|
318
|
+
|
319
|
+
sap_profiles.map do |sap_profile|
|
320
|
+
get_sap_profile(sap_profile["profileID"])
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
# Create a new SAP PVM Instance
|
325
|
+
#
|
326
|
+
# Create a new PVM instance using an SAP profile. The resultant PVM
|
327
|
+
# instance is the standard 'PVMInstance' type and can be accessed via
|
328
|
+
# the existing *_pvm_instance methods.
|
329
|
+
#
|
330
|
+
# @param sap_profile_id [String] SAP Profile ID
|
331
|
+
# @return [Hash] SAP profile
|
332
|
+
def create_sap_pvm_instance(instance_hash)
|
333
|
+
post("cloud-instances/#{guid}/sap", instance_hash.to_json)
|
334
|
+
end
|
335
|
+
|
159
336
|
private
|
160
337
|
|
161
338
|
attr_reader :crn, :guid, :region, :tenant, :token
|
@@ -2,6 +2,7 @@ module IBM
|
|
2
2
|
module Cloud
|
3
3
|
module SDK
|
4
4
|
class ResourceController < BaseService
|
5
|
+
require "ibm/cloud/sdk/resource_controller/resource"
|
5
6
|
def endpoint
|
6
7
|
"https://resource-controller.cloud.ibm.com/v2"
|
7
8
|
end
|
@@ -10,15 +11,8 @@ module IBM
|
|
10
11
|
@token = token
|
11
12
|
end
|
12
13
|
|
13
|
-
def get_resources
|
14
|
-
resources = get("resource_instances")["resources"] || []
|
15
|
-
|
16
|
-
require "ibm/cloud/sdk/resource_controller/resource"
|
17
|
-
resources.map { |instance| Resource.new(instance) }
|
18
|
-
end
|
19
|
-
|
20
14
|
def get_resource(guid)
|
21
|
-
|
15
|
+
Resource.new(get("resource_instances/#{guid}"))
|
22
16
|
end
|
23
17
|
|
24
18
|
private
|