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
@@ -0,0 +1,24 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
# A list of IKEPolicy
|
9
|
+
class IKEPolicies < BaseCollection
|
10
|
+
def initialize(parent)
|
11
|
+
super(parent, 'ike_policies', child_class: IKEPolicy)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# A single IKEPolicy
|
16
|
+
class IKEPolicy < BaseInstance
|
17
|
+
def connections
|
18
|
+
get('connections')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
# Work with multiple images.
|
9
|
+
class Images < BaseCollection
|
10
|
+
def initialize(parent)
|
11
|
+
super(parent, 'images', child_class: Image)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Work with a single image.
|
16
|
+
class Image < BaseInstance
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
module INSTANCE
|
9
|
+
# Actions for an instance.
|
10
|
+
class Actions < BaseCollection
|
11
|
+
def initialize(parent)
|
12
|
+
super(parent, 'actions')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
module INSTANCE
|
9
|
+
# Get a Floating IP.
|
10
|
+
class FloatingIps < BaseCollection
|
11
|
+
def initialize(parent)
|
12
|
+
super(parent, 'floating_ips', child_class: FloatingIp)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get a single floating IP.
|
17
|
+
class FloatingIp < BaseInstance
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative('floating_ips')
|
5
|
+
|
6
|
+
module IBM
|
7
|
+
module Cloud
|
8
|
+
module SDK
|
9
|
+
module VPC
|
10
|
+
module INSTANCE
|
11
|
+
# All netowrk interfaces.
|
12
|
+
class NetworkInterfaces < BaseCollection
|
13
|
+
def initialize(parent)
|
14
|
+
super(parent, 'network_interfaces', child_class: NetworkInterface)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# A single network insterface.
|
19
|
+
class NetworkInterface < BaseInstance
|
20
|
+
def floating_ips
|
21
|
+
FloatingIps.new(self)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
module INSTANCE
|
9
|
+
# Get all attached volumes.
|
10
|
+
class VolumeAttachments < BaseCollection
|
11
|
+
def initialize(parent)
|
12
|
+
super(parent, 'volume_attachments', child_class: VolumeAttachment)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# A single attached volume.
|
17
|
+
class VolumeAttachment < BaseInstance
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
# Work with multiple profiles.
|
9
|
+
class InstanceProfiles < BaseCollection
|
10
|
+
def initialize(parent)
|
11
|
+
super(parent, 'instance/profiles', child_class: Profile, array_key: 'profiles')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get a single profile.
|
16
|
+
class Profile < BaseInstance
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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
|
+
# Work with VPC instances.
|
12
|
+
module VPC
|
13
|
+
# Work with multiple VM instances.
|
14
|
+
class Instances < BaseCollection
|
15
|
+
def initialize(parent)
|
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 initialization
|
54
|
+
adhoc(method: 'get', path: 'initialization').json
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
# A list of IPSecPolicy
|
9
|
+
class IPSecPolicies < BaseCollection
|
10
|
+
def initialize(parent)
|
11
|
+
super(parent, 'ike_policies', child_class: IPSecPolicy)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# A single IPSecPolicy
|
16
|
+
class IPSecPolicy < BaseInstance
|
17
|
+
def connections
|
18
|
+
get('connections')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
# A collection of SSH keys.
|
9
|
+
class Keys < BaseCollection
|
10
|
+
def initialize(parent)
|
11
|
+
super(parent, 'keys', child_class: Key)
|
12
|
+
end
|
13
|
+
|
14
|
+
def fetch(resource_id: nil)
|
15
|
+
params = {}
|
16
|
+
params['resource_group.id'] = resource_id if resource_id
|
17
|
+
get(params: params)
|
18
|
+
end
|
19
|
+
|
20
|
+
def all(resource_id = nil)
|
21
|
+
fetch(resource_id: resource_id).subkey(@array_key)
|
22
|
+
end
|
23
|
+
|
24
|
+
# :reek:FeatureEnvy
|
25
|
+
def create(name, public_key, resource_group: nil, type: nil)
|
26
|
+
payload = { name: name, public_key: public_key }
|
27
|
+
payload[:resource_group] = resource_group if resource_group
|
28
|
+
payload[:type] = type if type
|
29
|
+
post(payload)
|
30
|
+
end
|
31
|
+
|
32
|
+
def key(id)
|
33
|
+
Key.new(self, id)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# A single key.
|
38
|
+
class Key < BaseInstance
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative('load_balancer/listeners')
|
5
|
+
|
6
|
+
module IBM
|
7
|
+
module Cloud
|
8
|
+
module SDK
|
9
|
+
module VPC
|
10
|
+
# A single LoadBalancer
|
11
|
+
class LoadBalancer < BaseInstance
|
12
|
+
def statistics
|
13
|
+
get('statistics')
|
14
|
+
end
|
15
|
+
|
16
|
+
def listeners
|
17
|
+
LOADBALANCER::Listeners.new(self)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative('policies')
|
5
|
+
|
6
|
+
module IBM
|
7
|
+
module Cloud
|
8
|
+
module SDK
|
9
|
+
module VPC
|
10
|
+
module LOADBALANCER
|
11
|
+
# A list of Listener
|
12
|
+
class Listeners < BaseCollection
|
13
|
+
def initialize(parent)
|
14
|
+
@array_key = 'listeners'
|
15
|
+
@instance = Listener
|
16
|
+
super(parent, @array_key)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# A single Listener
|
21
|
+
class Listener < BaseInstance
|
22
|
+
def policies
|
23
|
+
LOADBALANCER::Policies.new(self)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
# A list of Member
|
9
|
+
class Members < BaseCollection
|
10
|
+
def initialize(parent)
|
11
|
+
@array_key = 'members'
|
12
|
+
@instance = Member
|
13
|
+
super(parent, @array_key)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# A single Member
|
18
|
+
class Member < BaseInstance
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative('rules')
|
5
|
+
|
6
|
+
module IBM
|
7
|
+
module Cloud
|
8
|
+
module SDK
|
9
|
+
module VPC
|
10
|
+
module LOADBALANCER
|
11
|
+
# A list of Policies
|
12
|
+
class Policies < BaseCollection
|
13
|
+
def initialize(parent)
|
14
|
+
@array_key = 'policies'
|
15
|
+
@instance = Policy
|
16
|
+
super(parent, @array_key)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# A single Policy
|
21
|
+
class Policy < BaseInstance
|
22
|
+
def rules
|
23
|
+
Rules.new(self)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative('members')
|
5
|
+
|
6
|
+
module IBM
|
7
|
+
module Cloud
|
8
|
+
module SDK
|
9
|
+
module VPC
|
10
|
+
# A list of Pool
|
11
|
+
class Pools < BaseCollection
|
12
|
+
def initialize(parent)
|
13
|
+
@array_key = 'pools'
|
14
|
+
@instance = Pool
|
15
|
+
super(parent, @array_key)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# A single Pool
|
20
|
+
class Pool < BaseInstance
|
21
|
+
def members
|
22
|
+
Members.new(self)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: true
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module IBM
|
5
|
+
module Cloud
|
6
|
+
module SDK
|
7
|
+
module VPC
|
8
|
+
module LOADBALANCER
|
9
|
+
# A list of Rule
|
10
|
+
class Rules < BaseCollection
|
11
|
+
def initialize(parent)
|
12
|
+
@array_key = 'rules'
|
13
|
+
@instance = Rule
|
14
|
+
super(parent, @array_key)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# A single Rule
|
19
|
+
class Rule < BaseInstance
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|