ibm-cloud-sdk 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -1
  3. data/ibm-cloud-sdk.gemspec +1 -1
  4. data/lib/ibm/cloud/sdk.rb +2 -1
  5. data/lib/ibm/cloud/sdk/iam.rb +5 -0
  6. data/lib/ibm/cloud/sdk/resource_controller.rb +4 -0
  7. data/lib/ibm/cloud/sdk/tags.rb +28 -0
  8. data/lib/ibm/cloud/sdk/tags/http.rb +5 -0
  9. data/lib/ibm/cloud/sdk/tags/http/tag_collection.rb +99 -0
  10. data/lib/ibm/cloud/sdk/version.rb +1 -1
  11. data/lib/ibm/cloud/sdk/vpc.rb +8 -7
  12. data/lib/ibm/cloud/sdk/vpc/floatingips.rb +2 -2
  13. data/lib/ibm/cloud/sdk/vpc/flowlogcollectors.rb +2 -2
  14. data/lib/ibm/cloud/sdk/vpc/http.rb +7 -0
  15. data/lib/ibm/cloud/sdk/vpc/http/vpc_collection.rb +82 -0
  16. data/lib/ibm/cloud/sdk/vpc/http/vpc_http.rb +29 -0
  17. data/lib/ibm/cloud/sdk/vpc/http/vpc_instance.rb +30 -0
  18. data/lib/ibm/cloud/sdk/vpc/ike_policies.rb +2 -2
  19. data/lib/ibm/cloud/sdk/vpc/images.rb +2 -2
  20. data/lib/ibm/cloud/sdk/vpc/instance/actions.rb +1 -1
  21. data/lib/ibm/cloud/sdk/vpc/instance/floating_ips.rb +2 -2
  22. data/lib/ibm/cloud/sdk/vpc/instance/network_interfaces.rb +2 -2
  23. data/lib/ibm/cloud/sdk/vpc/instance/volume_attachments.rb +2 -2
  24. data/lib/ibm/cloud/sdk/vpc/instance_profiles.rb +3 -3
  25. data/lib/ibm/cloud/sdk/vpc/instances.rb +2 -2
  26. data/lib/ibm/cloud/sdk/vpc/ipsec_policies.rb +2 -2
  27. data/lib/ibm/cloud/sdk/vpc/keys.rb +2 -24
  28. data/lib/ibm/cloud/sdk/vpc/load_balancer.rb +1 -1
  29. data/lib/ibm/cloud/sdk/vpc/load_balancer/listeners.rb +2 -2
  30. data/lib/ibm/cloud/sdk/vpc/load_balancer/members.rb +2 -2
  31. data/lib/ibm/cloud/sdk/vpc/load_balancer/policies.rb +2 -2
  32. data/lib/ibm/cloud/sdk/vpc/load_balancer/pools.rb +2 -2
  33. data/lib/ibm/cloud/sdk/vpc/load_balancer/rules.rb +2 -2
  34. data/lib/ibm/cloud/sdk/vpc/load_balancers.rb +1 -1
  35. data/lib/ibm/cloud/sdk/vpc/network_acls.rb +4 -4
  36. data/lib/ibm/cloud/sdk/vpc/operating_systems.rb +2 -2
  37. data/lib/ibm/cloud/sdk/vpc/public_gateways.rb +2 -2
  38. data/lib/ibm/cloud/sdk/vpc/regions.rb +4 -4
  39. data/lib/ibm/cloud/sdk/vpc/security_groups.rb +6 -6
  40. data/lib/ibm/cloud/sdk/vpc/subnets.rb +2 -2
  41. data/lib/ibm/cloud/sdk/vpc/volume_profiles.rb +2 -2
  42. data/lib/ibm/cloud/sdk/vpc/volumes.rb +2 -2
  43. data/lib/ibm/cloud/sdk/vpc/vpcs.rb +6 -6
  44. data/lib/ibm/cloud/sdk/vpc/vpn_gateway/connections.rb +2 -2
  45. data/lib/ibm/cloud/sdk/vpc/vpn_gateway/local_cidrs.rb +2 -2
  46. data/lib/ibm/cloud/sdk/vpc/vpn_gateway/peer_cidrs.rb +2 -2
  47. data/lib/ibm/cloud/sdk/vpc/vpn_gateways.rb +2 -2
  48. data/lib/ibm/cloud/sdk_http.rb +16 -0
  49. data/lib/ibm/cloud/sdk_http/base_collection.rb +121 -0
  50. data/lib/ibm/cloud/sdk_http/base_http_mixin.rb +63 -0
  51. data/lib/ibm/cloud/sdk_http/base_instance.rb +55 -0
  52. data/lib/ibm/cloud/sdk_http/connection.rb +32 -0
  53. data/lib/ibm/cloud/sdk_http/exceptions.rb +31 -0
  54. data/lib/ibm/cloud/{sdk/vpc/base_mixins → sdk_http}/has_child.rb +3 -7
  55. data/lib/ibm/cloud/sdk_http/iam_token.rb +53 -0
  56. data/lib/ibm/cloud/sdk_http/sdk_response.rb +132 -0
  57. data/lib/ibm/cloud_sdk.rb +39 -0
  58. metadata +21 -12
  59. data/lib/ibm/cloud/sdk/vpc/base_collection.rb +0 -107
  60. data/lib/ibm/cloud/sdk/vpc/base_instance.rb +0 -23
  61. data/lib/ibm/cloud/sdk/vpc/base_vpc.rb +0 -61
  62. data/lib/ibm/cloud/sdk/vpc/cloud_sdk.rb +0 -33
  63. data/lib/ibm/cloud/sdk/vpc/exceptions.rb +0 -33
  64. data/lib/ibm/cloud/sdk/vpc/helpers/connection.rb +0 -96
  65. data/lib/ibm/cloud/sdk/vpc/helpers/response.rb +0 -134
@@ -6,14 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # A list of IKEPolicy
9
- class IKEPolicies < BaseCollection
9
+ class IKEPolicies < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'ike_policies', child_class: IKEPolicy)
12
12
  end
13
13
  end
14
14
 
15
15
  # A single IKEPolicy
16
- class IKEPolicy < BaseInstance
16
+ class IKEPolicy < VPCInstance
17
17
  def connections
18
18
  get('connections')
19
19
  end
@@ -6,14 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # Work with multiple images.
9
- class Images < BaseCollection
9
+ class Images < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'images', child_class: Image)
12
12
  end
13
13
  end
14
14
 
15
15
  # Work with a single image.
16
- class Image < BaseInstance
16
+ class Image < VPCInstance
17
17
  end
18
18
  end
19
19
  end
@@ -7,7 +7,7 @@ module IBM
7
7
  module VPC
8
8
  module INSTANCE
9
9
  # Actions for an instance.
10
- class Actions < BaseCollection
10
+ class Actions < VPCCollection
11
11
  def initialize(parent)
12
12
  super(parent, 'actions')
13
13
  end
@@ -7,14 +7,14 @@ module IBM
7
7
  module VPC
8
8
  module INSTANCE
9
9
  # Get a Floating IP.
10
- class FloatingIps < BaseCollection
10
+ class FloatingIps < VPCCollection
11
11
  def initialize(parent)
12
12
  super(parent, 'floating_ips', child_class: FloatingIp)
13
13
  end
14
14
  end
15
15
 
16
16
  # Get a single floating IP.
17
- class FloatingIp < BaseInstance
17
+ class FloatingIp < VPCInstance
18
18
  end
19
19
  end
20
20
  end
@@ -9,14 +9,14 @@ module IBM
9
9
  module VPC
10
10
  module INSTANCE
11
11
  # All netowrk interfaces.
12
- class NetworkInterfaces < BaseCollection
12
+ class NetworkInterfaces < VPCCollection
13
13
  def initialize(parent)
14
14
  super(parent, 'network_interfaces', child_class: NetworkInterface)
15
15
  end
16
16
  end
17
17
 
18
18
  # A single network insterface.
19
- class NetworkInterface < BaseInstance
19
+ class NetworkInterface < VPCInstance
20
20
  def floating_ips
21
21
  FloatingIps.new(self)
22
22
  end
@@ -7,14 +7,14 @@ module IBM
7
7
  module VPC
8
8
  module INSTANCE
9
9
  # Get all attached volumes.
10
- class VolumeAttachments < BaseCollection
10
+ class VolumeAttachments < VPCCollection
11
11
  def initialize(parent)
12
12
  super(parent, 'volume_attachments', child_class: VolumeAttachment)
13
13
  end
14
14
  end
15
15
 
16
16
  # A single attached volume.
17
- class VolumeAttachment < BaseInstance
17
+ class VolumeAttachment < VPCInstance
18
18
  end
19
19
  end
20
20
  end
@@ -6,14 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # Work with multiple profiles.
9
- class InstanceProfiles < BaseCollection
9
+ class InstanceProfiles < VPCCollection
10
10
  def initialize(parent)
11
- super(parent, 'instance/profiles', child_class: Profile, array_key: 'profiles')
11
+ super(parent, 'instance/profiles', child_class: InstanceProfile, array_key: 'profiles')
12
12
  end
13
13
  end
14
14
 
15
15
  # Get a single profile.
16
- class Profile < BaseInstance
16
+ class InstanceProfile < VPCInstance
17
17
  end
18
18
  end
19
19
  end
@@ -11,7 +11,7 @@ module IBM
11
11
  # Work with VPC instances.
12
12
  module VPC
13
13
  # Work with multiple VM instances.
14
- class Instances < BaseCollection
14
+ class Instances < VPCCollection
15
15
  def initialize(parent)
16
16
  super(parent, 'instances', child_class: Instance)
17
17
  end
@@ -37,7 +37,7 @@ module IBM
37
37
  end
38
38
 
39
39
  # Work with a single instance.
40
- class Instance < BaseInstance
40
+ class Instance < VPCInstance
41
41
  def actions
42
42
  INSTANCE::Actions.new(self)
43
43
  end
@@ -6,14 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # A list of IPSecPolicy
9
- class IPSecPolicies < BaseCollection
9
+ class IPSecPolicies < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'ike_policies', child_class: IPSecPolicy)
12
12
  end
13
13
  end
14
14
 
15
15
  # A single IPSecPolicy
16
- class IPSecPolicy < BaseInstance
16
+ class IPSecPolicy < VPCInstance
17
17
  def connections
18
18
  get('connections')
19
19
  end
@@ -6,36 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # A collection of SSH keys.
9
- class Keys < BaseCollection
9
+ class Keys < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'keys', child_class: Key)
12
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
13
  end
36
14
 
37
15
  # A single key.
38
- class Key < BaseInstance
16
+ class Key < VPCInstance
39
17
  end
40
18
  end
41
19
  end
@@ -8,7 +8,7 @@ module IBM
8
8
  module SDK
9
9
  module VPC
10
10
  # A single LoadBalancer
11
- class LoadBalancer < BaseInstance
11
+ class LoadBalancer < VPCInstance
12
12
  def statistics
13
13
  get('statistics')
14
14
  end
@@ -9,7 +9,7 @@ module IBM
9
9
  module VPC
10
10
  module LOADBALANCER
11
11
  # A list of Listener
12
- class Listeners < BaseCollection
12
+ class Listeners < VPCCollection
13
13
  def initialize(parent)
14
14
  @array_key = 'listeners'
15
15
  @instance = Listener
@@ -18,7 +18,7 @@ module IBM
18
18
  end
19
19
 
20
20
  # A single Listener
21
- class Listener < BaseInstance
21
+ class Listener < VPCInstance
22
22
  def policies
23
23
  LOADBALANCER::Policies.new(self)
24
24
  end
@@ -6,7 +6,7 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # A list of Member
9
- class Members < BaseCollection
9
+ class Members < VPCCollection
10
10
  def initialize(parent)
11
11
  @array_key = 'members'
12
12
  @instance = Member
@@ -15,7 +15,7 @@ module IBM
15
15
  end
16
16
 
17
17
  # A single Member
18
- class Member < BaseInstance
18
+ class Member < VPCInstance
19
19
  end
20
20
  end
21
21
  end
@@ -9,7 +9,7 @@ module IBM
9
9
  module VPC
10
10
  module LOADBALANCER
11
11
  # A list of Policies
12
- class Policies < BaseCollection
12
+ class Policies < VPCCollection
13
13
  def initialize(parent)
14
14
  @array_key = 'policies'
15
15
  @instance = Policy
@@ -18,7 +18,7 @@ module IBM
18
18
  end
19
19
 
20
20
  # A single Policy
21
- class Policy < BaseInstance
21
+ class Policy < VPCInstance
22
22
  def rules
23
23
  Rules.new(self)
24
24
  end
@@ -8,7 +8,7 @@ module IBM
8
8
  module SDK
9
9
  module VPC
10
10
  # A list of Pool
11
- class Pools < BaseCollection
11
+ class Pools < VPCCollection
12
12
  def initialize(parent)
13
13
  @array_key = 'pools'
14
14
  @instance = Pool
@@ -17,7 +17,7 @@ module IBM
17
17
  end
18
18
 
19
19
  # A single Pool
20
- class Pool < BaseInstance
20
+ class Pool < VPCInstance
21
21
  def members
22
22
  Members.new(self)
23
23
  end
@@ -7,7 +7,7 @@ module IBM
7
7
  module VPC
8
8
  module LOADBALANCER
9
9
  # A list of Rule
10
- class Rules < BaseCollection
10
+ class Rules < VPCCollection
11
11
  def initialize(parent)
12
12
  @array_key = 'rules'
13
13
  @instance = Rule
@@ -16,7 +16,7 @@ module IBM
16
16
  end
17
17
 
18
18
  # A single Rule
19
- class Rule < BaseInstance
19
+ class Rule < VPCInstance
20
20
  end
21
21
  end
22
22
  end
@@ -8,7 +8,7 @@ module IBM
8
8
  module SDK
9
9
  module VPC
10
10
  # A list of LoadBalancer
11
- class LoadBalancers < BaseCollection
11
+ class LoadBalancers < VPCCollection
12
12
  def initialize(parent)
13
13
  super(parent, 'load_balancers', child_class: LoadBalancer)
14
14
  end
@@ -6,14 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # A list of NetworkACL
9
- class NetworkACLs < BaseCollection
9
+ class NetworkACLs < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'network_acls', child_class: NetworkACL)
12
12
  end
13
13
  end
14
14
 
15
15
  # A single NetworkACL
16
- class NetworkACL < BaseInstance
16
+ class NetworkACL < VPCInstance
17
17
  def rules
18
18
  NETWORKACL::Rules.new(self)
19
19
  end
@@ -21,7 +21,7 @@ module IBM
21
21
 
22
22
  module NETWORKACL
23
23
  # A list of NetworkACL
24
- class Rules < BaseCollection
24
+ class Rules < VPCCollection
25
25
  def initialize(parent)
26
26
  @array_key = 'network_acls'
27
27
  @instance = NetworkACL
@@ -30,7 +30,7 @@ module IBM
30
30
  end
31
31
 
32
32
  # A single NetworkACL
33
- class Rule < BaseInstance
33
+ class Rule < VPCInstance
34
34
  end
35
35
  end
36
36
  end
@@ -6,14 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # A list of OperatingSystem
9
- class OperatingSystems < BaseCollection
9
+ class OperatingSystems < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'operating_systems', child_class: OperatingSystem)
12
12
  end
13
13
  end
14
14
 
15
15
  # A single OperatingSystem
16
- class OperatingSystem < BaseInstance
16
+ class OperatingSystem < VPCInstance
17
17
  end
18
18
  end
19
19
  end
@@ -6,14 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # A list of PublicGateway
9
- class PublicGateways < BaseCollection
9
+ class PublicGateways < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'public_gateways', child_class: PublicGateway)
12
12
  end
13
13
  end
14
14
 
15
15
  # A single PublicGateway
16
- class PublicGateway < BaseInstance
16
+ class PublicGateway < VPCInstance
17
17
  end
18
18
  end
19
19
  end
@@ -6,28 +6,28 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # Work with VPC reqions
9
- class Regions < BaseCollection
9
+ class Regions < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'regions', child_class: Region)
12
12
  end
13
13
  end
14
14
 
15
15
  # Work with a single region
16
- class Region < BaseInstance
16
+ class Region < VPCInstance
17
17
  def zones
18
18
  Zones.new(self)
19
19
  end
20
20
  end
21
21
 
22
22
  # Zones are included within a region.
23
- class Zones < BaseCollection
23
+ class Zones < VPCCollection
24
24
  def initialize(parent)
25
25
  super(parent, 'zones', child_class: Zone)
26
26
  end
27
27
  end
28
28
 
29
29
  # A single zone.
30
- class Zone < BaseInstance
30
+ class Zone < VPCInstance
31
31
  end
32
32
  end
33
33
  end
@@ -6,14 +6,14 @@ module IBM
6
6
  module SDK
7
7
  module VPC
8
8
  # Work with VPC reqions
9
- class SecurityGroups < BaseCollection
9
+ class SecurityGroups < VPCCollection
10
10
  def initialize(parent)
11
11
  super(parent, 'security_groups', child_class: SecurityGroup)
12
12
  end
13
13
  end
14
14
 
15
15
  # Work with VPC reqions
16
- class SecurityGroup < BaseCollection
16
+ class SecurityGroup < VPCInstance
17
17
  def network_interfaces
18
18
  SECURITYGROUP::NetworkInterfaces.new(self)
19
19
  end
@@ -21,25 +21,25 @@ module IBM
21
21
 
22
22
  module SECURITYGROUP
23
23
  # Work with interfaces associated with parent group.
24
- class NetworkInterfaces < BaseCollection
24
+ class NetworkInterfaces < VPCCollection
25
25
  def initialize(parent)
26
26
  super(parent, 'network_interfaces', child_class: NetworkInterface)
27
27
  end
28
28
  end
29
29
 
30
30
  # Work with a single rule.
31
- class NetworkInterface < BaseInstance
31
+ class NetworkInterface < VPCInstance
32
32
  end
33
33
 
34
34
  # Work with rules associated with parent group.
35
- class Rules < BaseCollection
35
+ class Rules < VPCCollection
36
36
  def initialize(parent)
37
37
  super(parent, 'rules', child_class: Rule)
38
38
  end
39
39
  end
40
40
 
41
41
  # Work with a single rule.
42
- class Rule < BaseInstance
42
+ class Rule < VPCInstance
43
43
  end
44
44
  end
45
45
  end