ibm-cloud-sdk 0.1.3 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/Gemfile +2 -0
- data/ibm-cloud-sdk.gemspec +1 -0
- 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 +133 -10
- 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 +107 -0
- data/lib/ibm/cloud/sdk/vpc/base_instance.rb +23 -0
- data/lib/ibm/cloud/sdk/vpc/base_mixins/has_child.rb +27 -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 +60 -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 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e549ed1f265dba2b7b112602e225a10509451bffd348c7b04e0aefefe11a712
|
4
|
+
data.tar.gz: d342b3a1382bd87a650010b8558a1ce183eb9eb0f52081f8bfdbf4ec1ecf3bec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 689e9dd7cbb37ebea1f48f04fd587560d7b9ed39dd625e860845aee646d02fb0077ea233c2e3d88ed99a4051d22b52c485c5ebc186c190b44875ecef8c1a8862
|
7
|
+
data.tar.gz: 5ee30dca7e7d6e7a141e44094f2de5f181b50cbeecc941b81da8589e639d07bb0f39555e1fd8be1dca2263ad46dcbac7eb4c80b5164ef60b6d5005126aaf1887
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to the gem ibm-cloud-sdk-ruby will be documented here.
|
3
3
|
|
4
|
+
## v0.1.8 - 2020-10-01
|
5
|
+
- Add second level instances
|
6
|
+
|
7
|
+
## v0.1.7 - 2020-09-28
|
8
|
+
- Added Logging in IBM Cloud
|
9
|
+
- Add VCR to vpc spec
|
10
|
+
- Add exception when status of response is not in 200 range or 404
|
11
|
+
- Power IaaS Update docstrings, VM actions volumes
|
12
|
+
|
13
|
+
## v0.1.6 - 2020-09-23
|
14
|
+
- Add PowerIaaS method to get instance info
|
15
|
+
- Return region specific PowerVS storage types
|
16
|
+
- Move VPC instance into instances and add initialization method.
|
17
|
+
|
18
|
+
## v0.1.5 - 2020-09-21
|
19
|
+
- Added Enumerable based pagination support
|
20
|
+
- Move instance profiles
|
21
|
+
- Improve resource lookup by GUID
|
22
|
+
- Add support to create a PowerIaas volume
|
23
|
+
|
24
|
+
## v0.1.4 - 2020-09-17
|
25
|
+
- Added support for the IBM Virtual Private Cloud (VPC) service
|
26
|
+
|
4
27
|
## v0.1.3 - 2020-08-31
|
5
28
|
### Added the following rest api calls for Power System Virtual Server service
|
6
29
|
- Add PowerIaas 'delete_volume' method
|
data/Gemfile
CHANGED
data/ibm-cloud-sdk.gemspec
CHANGED
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,7 +184,7 @@ 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}")
|
@@ -115,11 +192,35 @@ module IBM
|
|
115
192
|
|
116
193
|
# Delete a volume
|
117
194
|
#
|
118
|
-
# @param volume_id [String]
|
195
|
+
# @param volume_id [String] Volume ID
|
119
196
|
def delete_volume(volume_id)
|
120
197
|
delete("cloud-instances/#{guid}/volumes/#{volume_id}")
|
121
198
|
end
|
122
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
|
+
|
123
224
|
# Get all networks in an IBM Power Cloud instance
|
124
225
|
#
|
125
226
|
# @return [Array<Hash>] all networks for this IBM Power Cloud instance
|
@@ -132,7 +233,7 @@ module IBM
|
|
132
233
|
|
133
234
|
# Get an IBM Power Cloud network
|
134
235
|
#
|
135
|
-
# @param network_id [String]
|
236
|
+
# @param network_id [String] Network ID
|
136
237
|
# @return [Hash] Network
|
137
238
|
def get_network(network_id)
|
138
239
|
get("cloud-instances/#{guid}/networks/#{network_id}")
|
@@ -146,42 +247,64 @@ module IBM
|
|
146
247
|
end
|
147
248
|
|
148
249
|
# Get a storage types list in IBM Power Cloud.
|
149
|
-
# note: this
|
250
|
+
# note: this method to be refactored under the common
|
150
251
|
# IBM::Cloud::SDK::PowerIaas.endpoint when the rest api become available.
|
151
252
|
#
|
152
|
-
# @return [Hash] StorageType
|
253
|
+
# @return [Array<Hash>] StorageType
|
153
254
|
def get_storage_types
|
154
|
-
JSON.parse(RestClient.get("https://#{region.sub(/-\d$/, '')}.power-iaas.cloud.ibm.com/broker/v1/storage-types", headers))
|
255
|
+
JSON.parse(RestClient.get("https://#{region.sub(/-\d$/, '')}.power-iaas.cloud.ibm.com/broker/v1/storage-types", headers))[region]
|
155
256
|
end
|
156
257
|
|
258
|
+
# Create a new network
|
259
|
+
#
|
260
|
+
# @param network_hash [Hash] New network attributes
|
261
|
+
# @return [Hash] Network
|
157
262
|
def create_network(network_hash)
|
158
263
|
post("cloud-instances/#{guid}/networks", network_hash.to_json)
|
159
264
|
end
|
160
265
|
|
266
|
+
# Delete a network
|
267
|
+
#
|
268
|
+
# @param network_id [String] Network ID
|
161
269
|
def delete_network(network_id)
|
162
270
|
delete("cloud-instances/#{guid}/networks/#{network_id}")
|
163
271
|
end
|
164
272
|
|
273
|
+
# Get all ports for a network
|
274
|
+
#
|
275
|
+
# @param network_id [String] Network ID
|
276
|
+
# @return [Array<Hash>] NetworkPort
|
165
277
|
def get_network_ports(network_id)
|
166
278
|
get("cloud-instances/#{guid}/networks/#{network_id}/ports")["ports"]
|
167
279
|
end
|
168
280
|
|
281
|
+
# List the tenant's SSH Keys
|
282
|
+
#
|
283
|
+
# @return [Array<Hash>] SSHKey
|
169
284
|
def get_ssh_keys
|
170
285
|
get("tenants/#{tenant}")["sshKeys"]
|
171
286
|
end
|
172
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
|
173
293
|
def create_key_pair(name, sshkey)
|
174
294
|
payload = {"name" => name, "sshkey" => sshkey}
|
175
295
|
post("tenants/#{tenant}/sshkeys", payload.to_json)
|
176
296
|
end
|
177
297
|
|
298
|
+
# Delete SSH key from the tenant
|
299
|
+
#
|
300
|
+
# @param sshkey_name [String] SSH Key name
|
178
301
|
def delete_key_pair(name)
|
179
302
|
delete("tenants/#{tenant}/sshkeys/#{name}")
|
180
303
|
end
|
181
304
|
|
182
305
|
# Get an SAP profile
|
183
306
|
#
|
184
|
-
# @param sap_profile_id [String]
|
307
|
+
# @param sap_profile_id [String] SAP Profile ID
|
185
308
|
# @return [Hash] SAP profile
|
186
309
|
def get_sap_profile(sap_profile_id)
|
187
310
|
get("cloud-instances/#{guid}/sap/#{sap_profile_id}")
|
@@ -204,7 +327,7 @@ module IBM
|
|
204
327
|
# instance is the standard 'PVMInstance' type and can be accessed via
|
205
328
|
# the existing *_pvm_instance methods.
|
206
329
|
#
|
207
|
-
# @param sap_profile_id [String]
|
330
|
+
# @param sap_profile_id [String] SAP Profile ID
|
208
331
|
# @return [Hash] SAP profile
|
209
332
|
def create_sap_pvm_instance(instance_hash)
|
210
333
|
post("cloud-instances/#{guid}/sap", instance_hash.to_json)
|
@@ -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
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative 'vpc/base_vpc'
|
5
|
+
require_relative 'vpc/base_collection'
|
6
|
+
require_relative 'vpc/base_instance'
|
7
|
+
require_relative 'vpc/exceptions'
|
8
|
+
|
9
|
+
require_relative 'vpc/floatingips'
|
10
|
+
require_relative 'vpc/flowlogcollectors'
|
11
|
+
require_relative 'vpc/ike_policies'
|
12
|
+
require_relative 'vpc/images'
|
13
|
+
require_relative 'vpc/instance_profiles'
|
14
|
+
require_relative 'vpc/instances'
|
15
|
+
require_relative 'vpc/ipsec_policies'
|
16
|
+
require_relative 'vpc/keys'
|
17
|
+
require_relative 'vpc/load_balancers'
|
18
|
+
require_relative 'vpc/network_acls'
|
19
|
+
require_relative 'vpc/operating_systems'
|
20
|
+
require_relative 'vpc/public_gateways'
|
21
|
+
require_relative 'vpc/regions'
|
22
|
+
require_relative 'vpc/security_groups'
|
23
|
+
require_relative 'vpc/subnets'
|
24
|
+
require_relative 'vpc/volume_profiles'
|
25
|
+
require_relative 'vpc/volumes'
|
26
|
+
require_relative 'vpc/vpcs'
|
27
|
+
require_relative 'vpc/vpn_gateways'
|
28
|
+
|
29
|
+
module IBM
|
30
|
+
module Cloud
|
31
|
+
module SDK
|
32
|
+
# Container that encapsulates the VPC API.
|
33
|
+
class Vpc < BaseVPC
|
34
|
+
# Create an API Client object for the VPC IaaS service
|
35
|
+
#
|
36
|
+
# @param region [String] the IBM Power Cloud instance region
|
37
|
+
# @param connection [IBM::Cloud::SDK::VPC::Connection] A connection object.
|
38
|
+
# @param logger [Logger] An instance of an instanciated logger.
|
39
|
+
def initialize(region, connection, logger: nil)
|
40
|
+
@region = region
|
41
|
+
@connection = connection
|
42
|
+
|
43
|
+
@logger = logger || Logger.new($stdout, level: :warn)
|
44
|
+
end
|
45
|
+
|
46
|
+
attr_reader :connection, :logger
|
47
|
+
attr_accessor :region
|
48
|
+
|
49
|
+
# The Region API endpoint.
|
50
|
+
def endpoint
|
51
|
+
"https://#{region.sub(/-\d$/, '')}.iaas.cloud.ibm.com/v1"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Entry point to the Floating IPs API.
|
55
|
+
def floating_ips
|
56
|
+
VPC::FloatingIPs.new(self)
|
57
|
+
end
|
58
|
+
|
59
|
+
def flowlog_collectors
|
60
|
+
VPC::FlowLogCollectors.new(self)
|
61
|
+
end
|
62
|
+
|
63
|
+
def ike_policies
|
64
|
+
VPC::IKEPolicies.new(self)
|
65
|
+
end
|
66
|
+
|
67
|
+
def images
|
68
|
+
VPC::Images.new(self)
|
69
|
+
end
|
70
|
+
|
71
|
+
def instance_profiles
|
72
|
+
VPC::InstanceProfiles.new(self)
|
73
|
+
end
|
74
|
+
|
75
|
+
def instances
|
76
|
+
VPC::Instances.new(self)
|
77
|
+
end
|
78
|
+
|
79
|
+
def ipsec_policies
|
80
|
+
VPC::IPSecPolicies.new(self)
|
81
|
+
end
|
82
|
+
|
83
|
+
def keys
|
84
|
+
VPC::Keys.new(self)
|
85
|
+
end
|
86
|
+
|
87
|
+
def load_balancers
|
88
|
+
VPC::LoadBalancers.new(self)
|
89
|
+
end
|
90
|
+
|
91
|
+
def network_acls
|
92
|
+
VPC::NetworkACLs.new(self)
|
93
|
+
end
|
94
|
+
|
95
|
+
def operating_systems
|
96
|
+
VPC::OperatingSystems.new(self)
|
97
|
+
end
|
98
|
+
|
99
|
+
def public_gateways
|
100
|
+
VPC::PublicGateways.new(self)
|
101
|
+
end
|
102
|
+
|
103
|
+
def regions
|
104
|
+
VPC::Regions.new(self)
|
105
|
+
end
|
106
|
+
|
107
|
+
def security_groups
|
108
|
+
VPC::SecurityGroups.new(self)
|
109
|
+
end
|
110
|
+
|
111
|
+
def subnets
|
112
|
+
VPC::Subnets.new(self)
|
113
|
+
end
|
114
|
+
|
115
|
+
def volumes_profiles
|
116
|
+
VPC::VolumeProfiles.new(self)
|
117
|
+
end
|
118
|
+
|
119
|
+
def volumes
|
120
|
+
VPC::Volumes.new(self)
|
121
|
+
end
|
122
|
+
|
123
|
+
def vpcs
|
124
|
+
VPC::Vpcs.new(self)
|
125
|
+
end
|
126
|
+
|
127
|
+
def vpn_gateways
|
128
|
+
VPC::VPNGateways.new(self)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|