oraclebmc 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +82 -0
  3. data/README.md +220 -0
  4. data/lib/oraclebmc/api_client.rb +349 -0
  5. data/lib/oraclebmc/config.rb +80 -0
  6. data/lib/oraclebmc/config_file_loader.rb +85 -0
  7. data/lib/oraclebmc/core/blockstorage_client.rb +459 -0
  8. data/lib/oraclebmc/core/compute_client.rb +1053 -0
  9. data/lib/oraclebmc/core/core.rb +82 -0
  10. data/lib/oraclebmc/core/models/attach_i_scsi_volume_details.rb +179 -0
  11. data/lib/oraclebmc/core/models/attach_volume_details.rb +206 -0
  12. data/lib/oraclebmc/core/models/capture_console_history_details.rb +162 -0
  13. data/lib/oraclebmc/core/models/console_history.rb +252 -0
  14. data/lib/oraclebmc/core/models/cpe.rb +209 -0
  15. data/lib/oraclebmc/core/models/create_cpe_details.rb +187 -0
  16. data/lib/oraclebmc/core/models/create_dhcp_details.rb +195 -0
  17. data/lib/oraclebmc/core/models/create_drg_attachment_details.rb +184 -0
  18. data/lib/oraclebmc/core/models/create_drg_details.rb +173 -0
  19. data/lib/oraclebmc/core/models/create_image_details.rb +188 -0
  20. data/lib/oraclebmc/core/models/create_internet_gateway_details.rb +195 -0
  21. data/lib/oraclebmc/core/models/create_ip_sec_connection_details.rb +210 -0
  22. data/lib/oraclebmc/core/models/create_route_table_details.rb +195 -0
  23. data/lib/oraclebmc/core/models/create_security_list_details.rb +206 -0
  24. data/lib/oraclebmc/core/models/create_subnet_details.rb +253 -0
  25. data/lib/oraclebmc/core/models/create_vcn_details.rb +187 -0
  26. data/lib/oraclebmc/core/models/create_volume_backup_details.rb +173 -0
  27. data/lib/oraclebmc/core/models/create_volume_details.rb +211 -0
  28. data/lib/oraclebmc/core/models/dhcp_dns_option.rb +203 -0
  29. data/lib/oraclebmc/core/models/dhcp_option.rb +171 -0
  30. data/lib/oraclebmc/core/models/dhcp_options.rb +246 -0
  31. data/lib/oraclebmc/core/models/drg.rb +224 -0
  32. data/lib/oraclebmc/core/models/drg_attachment.rb +246 -0
  33. data/lib/oraclebmc/core/models/egress_security_rule.rb +240 -0
  34. data/lib/oraclebmc/core/models/i_scsi_volume_attachment.rb +254 -0
  35. data/lib/oraclebmc/core/models/icmp_options.rb +173 -0
  36. data/lib/oraclebmc/core/models/image.rb +282 -0
  37. data/lib/oraclebmc/core/models/ingress_security_rule.rb +240 -0
  38. data/lib/oraclebmc/core/models/instance.rb +326 -0
  39. data/lib/oraclebmc/core/models/internet_gateway.rb +248 -0
  40. data/lib/oraclebmc/core/models/ip_sec_connection.rb +261 -0
  41. data/lib/oraclebmc/core/models/ip_sec_connection_device_config.rb +195 -0
  42. data/lib/oraclebmc/core/models/ip_sec_connection_device_status.rb +198 -0
  43. data/lib/oraclebmc/core/models/launch_instance_details.rb +327 -0
  44. data/lib/oraclebmc/core/models/port_range.rb +175 -0
  45. data/lib/oraclebmc/core/models/route_rule.rb +177 -0
  46. data/lib/oraclebmc/core/models/route_table.rb +246 -0
  47. data/lib/oraclebmc/core/models/security_list.rb +257 -0
  48. data/lib/oraclebmc/core/models/shape.rb +164 -0
  49. data/lib/oraclebmc/core/models/subnet.rb +325 -0
  50. data/lib/oraclebmc/core/models/tcp_options.rb +177 -0
  51. data/lib/oraclebmc/core/models/tunnel_config.rb +193 -0
  52. data/lib/oraclebmc/core/models/tunnel_status.rb +218 -0
  53. data/lib/oraclebmc/core/models/udp_options.rb +177 -0
  54. data/lib/oraclebmc/core/models/update_cpe_details.rb +162 -0
  55. data/lib/oraclebmc/core/models/update_dhcp_details.rb +172 -0
  56. data/lib/oraclebmc/core/models/update_drg_attachment_details.rb +162 -0
  57. data/lib/oraclebmc/core/models/update_drg_details.rb +162 -0
  58. data/lib/oraclebmc/core/models/update_image_details.rb +165 -0
  59. data/lib/oraclebmc/core/models/update_instance_details.rb +165 -0
  60. data/lib/oraclebmc/core/models/update_internet_gateway_details.rb +173 -0
  61. data/lib/oraclebmc/core/models/update_ip_sec_connection_details.rb +162 -0
  62. data/lib/oraclebmc/core/models/update_route_table_details.rb +173 -0
  63. data/lib/oraclebmc/core/models/update_security_list_details.rb +184 -0
  64. data/lib/oraclebmc/core/models/update_subnet_details.rb +162 -0
  65. data/lib/oraclebmc/core/models/update_vcn_details.rb +162 -0
  66. data/lib/oraclebmc/core/models/update_volume_backup_details.rb +162 -0
  67. data/lib/oraclebmc/core/models/update_volume_details.rb +163 -0
  68. data/lib/oraclebmc/core/models/vcn.rb +272 -0
  69. data/lib/oraclebmc/core/models/vnic.rb +274 -0
  70. data/lib/oraclebmc/core/models/vnic_attachment.rb +271 -0
  71. data/lib/oraclebmc/core/models/volume.rb +249 -0
  72. data/lib/oraclebmc/core/models/volume_attachment.rb +284 -0
  73. data/lib/oraclebmc/core/models/volume_backup.rb +273 -0
  74. data/lib/oraclebmc/core/util.rb +1 -0
  75. data/lib/oraclebmc/core/virtual_network_client.rb +2263 -0
  76. data/lib/oraclebmc/errors.rb +62 -0
  77. data/lib/oraclebmc/global_context.rb +21 -0
  78. data/lib/oraclebmc/identity/identity.rb +38 -0
  79. data/lib/oraclebmc/identity/identity_client.rb +1462 -0
  80. data/lib/oraclebmc/identity/models/add_user_to_group_details.rb +173 -0
  81. data/lib/oraclebmc/identity/models/api_key.rb +251 -0
  82. data/lib/oraclebmc/identity/models/availability_domain.rb +173 -0
  83. data/lib/oraclebmc/identity/models/compartment.rb +251 -0
  84. data/lib/oraclebmc/identity/models/create_api_key_details.rb +162 -0
  85. data/lib/oraclebmc/identity/models/create_compartment_details.rb +187 -0
  86. data/lib/oraclebmc/identity/models/create_group_details.rb +186 -0
  87. data/lib/oraclebmc/identity/models/create_policy_details.rb +215 -0
  88. data/lib/oraclebmc/identity/models/create_swift_password_details.rb +163 -0
  89. data/lib/oraclebmc/identity/models/create_user_details.rb +186 -0
  90. data/lib/oraclebmc/identity/models/group.rb +251 -0
  91. data/lib/oraclebmc/identity/models/policy.rb +277 -0
  92. data/lib/oraclebmc/identity/models/swift_password.rb +266 -0
  93. data/lib/oraclebmc/identity/models/ui_password.rb +227 -0
  94. data/lib/oraclebmc/identity/models/update_compartment_details.rb +162 -0
  95. data/lib/oraclebmc/identity/models/update_group_details.rb +162 -0
  96. data/lib/oraclebmc/identity/models/update_policy_details.rb +190 -0
  97. data/lib/oraclebmc/identity/models/update_state_details.rb +163 -0
  98. data/lib/oraclebmc/identity/models/update_swift_password_details.rb +162 -0
  99. data/lib/oraclebmc/identity/models/update_user_details.rb +162 -0
  100. data/lib/oraclebmc/identity/models/user.rb +257 -0
  101. data/lib/oraclebmc/identity/models/user_group_membership.rb +249 -0
  102. data/lib/oraclebmc/identity/util.rb +1 -0
  103. data/lib/oraclebmc/load_balancer/load_balancer.rb +45 -0
  104. data/lib/oraclebmc/load_balancer/load_balancer_client.rb +1218 -0
  105. data/lib/oraclebmc/load_balancer/models/backend.rb +262 -0
  106. data/lib/oraclebmc/load_balancer/models/backend_details.rb +248 -0
  107. data/lib/oraclebmc/load_balancer/models/backend_set.rb +211 -0
  108. data/lib/oraclebmc/load_balancer/models/backend_set_details.rb +197 -0
  109. data/lib/oraclebmc/load_balancer/models/certificate.rb +209 -0
  110. data/lib/oraclebmc/load_balancer/models/certificate_details.rb +245 -0
  111. data/lib/oraclebmc/load_balancer/models/create_backend_details.rb +248 -0
  112. data/lib/oraclebmc/load_balancer/models/create_backend_set_details.rb +210 -0
  113. data/lib/oraclebmc/load_balancer/models/create_certificate_details.rb +245 -0
  114. data/lib/oraclebmc/load_balancer/models/create_listener_details.rb +216 -0
  115. data/lib/oraclebmc/load_balancer/models/create_load_balancer_details.rb +233 -0
  116. data/lib/oraclebmc/load_balancer/models/health_checker.rb +265 -0
  117. data/lib/oraclebmc/load_balancer/models/health_checker_details.rb +264 -0
  118. data/lib/oraclebmc/load_balancer/models/ip_address.rb +165 -0
  119. data/lib/oraclebmc/load_balancer/models/listener.rb +216 -0
  120. data/lib/oraclebmc/load_balancer/models/listener_details.rb +202 -0
  121. data/lib/oraclebmc/load_balancer/models/load_balancer.rb +296 -0
  122. data/lib/oraclebmc/load_balancer/models/load_balancer_policy.rb +162 -0
  123. data/lib/oraclebmc/load_balancer/models/load_balancer_protocol.rb +162 -0
  124. data/lib/oraclebmc/load_balancer/models/load_balancer_shape.rb +162 -0
  125. data/lib/oraclebmc/load_balancer/models/ssl_configuration.rb +195 -0
  126. data/lib/oraclebmc/load_balancer/models/ssl_configuration_details.rb +195 -0
  127. data/lib/oraclebmc/load_balancer/models/update_backend_details.rb +220 -0
  128. data/lib/oraclebmc/load_balancer/models/update_backend_set_details.rb +197 -0
  129. data/lib/oraclebmc/load_balancer/models/update_health_checker_details.rb +263 -0
  130. data/lib/oraclebmc/load_balancer/models/update_listener_details.rb +202 -0
  131. data/lib/oraclebmc/load_balancer/models/update_load_balancer_details.rb +165 -0
  132. data/lib/oraclebmc/load_balancer/models/work_request.rb +269 -0
  133. data/lib/oraclebmc/load_balancer/models/work_request_error.rb +185 -0
  134. data/lib/oraclebmc/load_balancer/util.rb +55 -0
  135. data/lib/oraclebmc/regions.rb +41 -0
  136. data/lib/oraclebmc/response.rb +86 -0
  137. data/lib/oraclebmc/signer.rb +119 -0
  138. data/lib/oraclebmc/version.rb +5 -0
  139. data/lib/oraclebmc/waiter.rb +111 -0
  140. data/lib/oraclebmc.rb +20 -0
  141. metadata +265 -0
@@ -0,0 +1,80 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'uri'
4
+
5
+ module OracleBMC
6
+ class Config
7
+
8
+ # OCID of the user to use for authentication.
9
+ # Example: ocidv1:user:oc1:phx:1460406592659:aaaaaaaawcbqrkycbolrirg2n3xjl5fabc
10
+ #
11
+ # @return [String]
12
+ attr_accessor :user
13
+
14
+ # SSL Fingerprint to use for authentication.
15
+ # Example: 20:3b:97:13:55:1c:1c:0d:d3:37:d8:50:4e:c5:3a:12
16
+ #
17
+ # @return [String]
18
+ attr_accessor :fingerprint
19
+
20
+ # OCID of the tenancy to use for authentication.
21
+ # Example: ocid1.tenancy.oc1..aaaaaaaaba3pv6wkcr4jqae5f15p2b2m2yt2j6rx32uzr4h25vqstifsfdsq
22
+ #
23
+ # @return [String]
24
+ attr_accessor :tenancy
25
+
26
+ # Client private key file.
27
+ # Example: ~/.ssh/bmc_key
28
+ #
29
+ # @return [String]
30
+ attr_accessor :key_file
31
+
32
+ # Pass phrase used for key file, if it is encrypted.
33
+ #
34
+ # @return [String]
35
+ attr_accessor :pass_phrase
36
+
37
+ # A region to use for APIs created with this Config.
38
+ #
39
+ # @return [OracleBMC::Regions::REGION_ENUM]
40
+ attr_accessor :region
41
+
42
+ # Defines the logger used for debugging.
43
+ # For example, log to STDOUT by setting this to Logger.new(STDOUT).
44
+ # This property cannot be set from a config file.
45
+ #
46
+ # @return [Logger]
47
+ attr_accessor :logger
48
+
49
+ # Whether to log detailed request and response
50
+ # data. This will always write to STDOUT.
51
+ # Defaults to false.
52
+ #
53
+ # @return [true, false]
54
+ attr_accessor :log_requests
55
+
56
+ # The time limit for HTTP request in seconds.
57
+ # Defaults to 0 (never times out).
58
+ #
59
+ # @return [Integer]
60
+ attr_accessor :timeout
61
+
62
+ # The time limit for the connection phase in seconds.
63
+ # Defaults to 10 seconds.
64
+ #
65
+ # @return [Integer]
66
+ attr_accessor :connection_timeout
67
+
68
+ # If set, then this string will be added to the
69
+ # user agent sent with each request.
70
+ #
71
+ # @return [String]
72
+ attr_accessor :additional_user_agent
73
+
74
+ def initialize
75
+ @timeout = 0
76
+ @connection_timeout = 10
77
+ @log_requests = false
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,85 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'inifile'
4
+ require_relative 'config'
5
+
6
+ module OracleBMC
7
+
8
+ module ConfigFileLoader
9
+
10
+ module Errors
11
+ class ConfigFileNotFoundError < RuntimeError; end
12
+ class ProfileNotFoundError < RuntimeError; end
13
+ class DefaultProfileDoesNotExistError < RuntimeError; end
14
+ end
15
+
16
+ # Name of the default profile to load from a config file
17
+ DEFAULT_PROFILE = 'DEFAULT'
18
+
19
+ # Default config file name and location
20
+ DEFAULT_CONFIG_FILE = '~/.oraclebmc/config'
21
+
22
+ # Loads the a Config from the specified file and profile.
23
+ #
24
+ # @param [String] config_file_location Filename and path of the config file. Defaults to "~/.oraclebmc/config"
25
+ # @param [String] profile_name Name of the profile from the file. Defaults to "DEFAULT".
26
+ # @return [Config] A Config
27
+ def self.load_config(config_file_location: DEFAULT_CONFIG_FILE, profile_name: DEFAULT_PROFILE)
28
+ configs = load_configs(config_file_location)
29
+
30
+ if configs && configs.key?(profile_name)
31
+ return configs[profile_name]
32
+ else
33
+ raise Errors::ProfileNotFoundError.new("Profile not found in the given config file.")
34
+ end
35
+ end
36
+
37
+ # Loads all of the Configs from the specified file.
38
+ #
39
+ # @param [String] config_file_location Filename and path of the config file.
40
+ # @return [Array<Config>] An array containing all the configs found in the given file.
41
+ def self.load_configs(config_file_location)
42
+ config_file_location = File.expand_path(config_file_location)
43
+
44
+ unless File.file?(config_file_location)
45
+ raise Errors::ConfigFileNotFoundError.new("Config file does not exist.")
46
+ end
47
+
48
+ config_file = IniFile.load(config_file_location)
49
+ configs = {}
50
+
51
+ if config_file.nil? || !config_file.has_section?(DEFAULT_PROFILE)
52
+ raise Errors::DefaultProfileDoesNotExistError.new("The DEFAULT profile does not exist.")
53
+ end
54
+
55
+ config_file.each_section do |section|
56
+ config = Config.new
57
+
58
+ unless section.equal? DEFAULT_PROFILE
59
+ load_section(config_file[DEFAULT_PROFILE], config)
60
+ end
61
+ load_section(config_file[section], config)
62
+
63
+ configs[section] = config
64
+ end
65
+
66
+ return configs
67
+ end
68
+
69
+ def self.load_section(section, config)
70
+ section.each_key do |key|
71
+ value = section[key]
72
+
73
+ if key == "key_file"
74
+ value = File.expand_path(value)
75
+ end
76
+
77
+ config.instance_variable_set("@" + key, value)
78
+ end
79
+ end
80
+
81
+ private_class_method :load_section
82
+
83
+ end
84
+
85
+ end
@@ -0,0 +1,459 @@
1
+ # Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require "uri"
4
+ require "logger"
5
+
6
+ module OracleBMC
7
+
8
+ class Core::BlockstorageClient
9
+
10
+ # Client used to make HTTP requests.
11
+ # @return [OracleBMC::ApiClient]
12
+ attr_reader :api_client
13
+
14
+ # Fully qualified endpoint URL
15
+ # @return [String]
16
+ attr_reader :endpoint
17
+
18
+ # The region, which will usually correspond to a value in {OracleBMC::Regions::REGION_ENUM}.
19
+ # @return [String]
20
+ attr_accessor :region
21
+
22
+ # Creates a new BlockstorageClient.
23
+ # If a config is not specified, then the global OracleBMC.config will be used.
24
+ #
25
+ # A region must be specified in either the config or the region parameter. If specified
26
+ # in both, then the region parameter will be used.
27
+ #
28
+ # @param [Config] config A Config object.
29
+ # @param [String] region A region used to determine the service endpoint. This will usually
30
+ # correspond to a value in {OracleBMC::Regions::REGION_ENUM}, but may be an arbitrary string.
31
+ #
32
+ def initialize(config:nil, region:nil)
33
+ config ||= OracleBMC.config
34
+ signer = Signer.new(config.user, config.fingerprint, config.tenancy, config.key_file, pass_phrase: config.pass_phrase)
35
+ @api_client = ApiClient.new(config, signer)
36
+
37
+ region ||= config.region
38
+ self.region = region
39
+ end
40
+
41
+ # Set the region that will be used to determine the service endpoint.
42
+ # This will usually correspond to a value in {OracleBMC::Regions::REGION_ENUM},
43
+ # but may be an arbitrary string.
44
+ def region=(r)
45
+ @region = r
46
+
47
+ fail 'A region must be specified.' unless @region
48
+
49
+ if not OracleBMC::Regions.valid_region? region
50
+ logger.info "Unknown region '#{@region}', falling back to default endpoint format." if logger
51
+ end
52
+
53
+ @endpoint = OracleBMC::Regions.get_service_endpoint(@region, :BlockstorageClient) + '/20160918'
54
+ logger.info "BlockstorageClient endpoint set to '#{endpoint}'." if logger
55
+ end
56
+
57
+ # @return [Logger] The logger for this client. May be nil.
58
+ def logger
59
+ @api_client.config.logger
60
+ end
61
+
62
+
63
+ # Creates a new volume in the specified compartment. The size of a volume can be either 256 GB or 2 TB.
64
+ # For general information about block volumes, see
65
+ # [Overview of Block Volume Service](https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/overview.htm).
66
+ #
67
+ # A volume and instance can be in separate compartments but must be in the same Availability Domain.
68
+ # For information about access control and compartments, see
69
+ # [Overview of the IAM Service](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). For information about
70
+ # Availability Domains, see [Regions and Availability Domains](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm).
71
+ # To get a list of Availability Domains, use the `ListAvailabilityDomains` operation
72
+ # in the Identity and Access Management Service API.
73
+ #
74
+ # You may optionally specify a *display name* for the volume, which is simply a friendly name or
75
+ # description. It does not have to be unique, and you can change it.
76
+ #
77
+ # @param [CreateVolumeDetails] create_volume_details Request to create a new volume.
78
+ # @param [Hash] opts the optional parameters
79
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
80
+ # server error without risk of executing that same action again. Retry tokens expire after 24
81
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
82
+ # has been deleted and purged from the system, then a retry of the original creation request
83
+ # may be rejected).
84
+ #
85
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Volume
86
+ def create_volume(create_volume_details, opts = {})
87
+ logger.debug "Calling operation BlockstorageClient#create_volume." if logger
88
+
89
+ fail "Missing the required parameter 'create_volume_details' when calling create_volume." if create_volume_details.nil?
90
+
91
+ path = "/volumes"
92
+
93
+ # Query Params
94
+ query_params = {}
95
+
96
+ # Header Params
97
+ header_params = {}
98
+ header_params['accept'] = 'application/json'
99
+ header_params['content-type'] = 'application/json'
100
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
101
+
102
+ post_body = @api_client.object_to_http_body(create_volume_details)
103
+
104
+ return @api_client.call_api(
105
+ :POST,
106
+ path,
107
+ endpoint,
108
+ :header_params => header_params,
109
+ :query_params => query_params,
110
+ :body => post_body,
111
+ :return_type => 'OracleBMC::Core::Models::Volume')
112
+ end
113
+
114
+ # Creates a new backup of the specified volume. For general information about volume backups,
115
+ # see [Overview of Block Volume Service Backups](https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/blockvolumebackups.htm)
116
+ #
117
+ # When the request is received, the backup object is in a REQUEST_RECEIVED state.
118
+ # When the data is imaged, it goes into a CREATING state.
119
+ # After the backup is fully uploaded to the cloud, it goes into an AVAILABLE state.
120
+ #
121
+ # @param [CreateVolumeBackupDetails] create_volume_backup_details Request to create a new backup of given volume.
122
+ # @param [Hash] opts the optional parameters
123
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
124
+ # server error without risk of executing that same action again. Retry tokens expire after 24
125
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
126
+ # has been deleted and purged from the system, then a retry of the original creation request
127
+ # may be rejected).
128
+ #
129
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::VolumeBackup
130
+ def create_volume_backup(create_volume_backup_details, opts = {})
131
+ logger.debug "Calling operation BlockstorageClient#create_volume_backup." if logger
132
+
133
+ fail "Missing the required parameter 'create_volume_backup_details' when calling create_volume_backup." if create_volume_backup_details.nil?
134
+
135
+ path = "/volumeBackups"
136
+
137
+ # Query Params
138
+ query_params = {}
139
+
140
+ # Header Params
141
+ header_params = {}
142
+ header_params['accept'] = 'application/json'
143
+ header_params['content-type'] = 'application/json'
144
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
145
+
146
+ post_body = @api_client.object_to_http_body(create_volume_backup_details)
147
+
148
+ return @api_client.call_api(
149
+ :POST,
150
+ path,
151
+ endpoint,
152
+ :header_params => header_params,
153
+ :query_params => query_params,
154
+ :body => post_body,
155
+ :return_type => 'OracleBMC::Core::Models::VolumeBackup')
156
+ end
157
+
158
+ # Deletes the specified volume. The volume cannot have an active connection to an instance.
159
+ # To disconnect the volume from a connected instance, see
160
+ # [Disconnecting From a Volume](https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/disconnectingfromavolume.htm).
161
+ # **Warning:** All data on the volume will be permanently lost when the volume is deleted.
162
+ #
163
+ # @param [String] volume_id The OCID of the volume.
164
+ # @param [Hash] opts the optional parameters
165
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
166
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
167
+ # will be updated or deleted only if the etag you provide matches the resource&#39;s current etag value.
168
+ #
169
+ # @return [Response] A Response object with data of type nil
170
+ def delete_volume(volume_id, opts = {})
171
+ logger.debug "Calling operation BlockstorageClient#delete_volume." if logger
172
+
173
+ fail "Missing the required parameter 'volume_id' when calling delete_volume." if volume_id.nil?
174
+
175
+ path = "/volumes/{volumeId}".sub('{volumeId}', volume_id.to_s)
176
+
177
+ # Query Params
178
+ query_params = {}
179
+
180
+ # Header Params
181
+ header_params = {}
182
+ header_params['accept'] = 'application/json'
183
+ header_params['content-type'] = 'application/json'
184
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
185
+
186
+ post_body = nil
187
+
188
+ return @api_client.call_api(
189
+ :DELETE,
190
+ path,
191
+ endpoint,
192
+ :header_params => header_params,
193
+ :query_params => query_params,
194
+ :body => post_body)
195
+ end
196
+
197
+ # Deletes a volume backup.
198
+ # @param [String] volume_backup_id The OCID of the volume backup.
199
+ # @param [Hash] opts the optional parameters
200
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
201
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
202
+ # will be updated or deleted only if the etag you provide matches the resource&#39;s current etag value.
203
+ #
204
+ # @return [Response] A Response object with data of type nil
205
+ def delete_volume_backup(volume_backup_id, opts = {})
206
+ logger.debug "Calling operation BlockstorageClient#delete_volume_backup." if logger
207
+
208
+ fail "Missing the required parameter 'volume_backup_id' when calling delete_volume_backup." if volume_backup_id.nil?
209
+
210
+ path = "/volumeBackups/{volumeBackupId}".sub('{volumeBackupId}', volume_backup_id.to_s)
211
+
212
+ # Query Params
213
+ query_params = {}
214
+
215
+ # Header Params
216
+ header_params = {}
217
+ header_params['accept'] = 'application/json'
218
+ header_params['content-type'] = 'application/json'
219
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
220
+
221
+ post_body = nil
222
+
223
+ return @api_client.call_api(
224
+ :DELETE,
225
+ path,
226
+ endpoint,
227
+ :header_params => header_params,
228
+ :query_params => query_params,
229
+ :body => post_body)
230
+ end
231
+
232
+ # Gets information for the specified volume.
233
+ # @param [String] volume_id The OCID of the volume.
234
+ # @param [Hash] opts the optional parameters
235
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Volume
236
+ def get_volume(volume_id, opts = {})
237
+ logger.debug "Calling operation BlockstorageClient#get_volume." if logger
238
+
239
+ fail "Missing the required parameter 'volume_id' when calling get_volume." if volume_id.nil?
240
+
241
+ path = "/volumes/{volumeId}".sub('{volumeId}', volume_id.to_s)
242
+
243
+ # Query Params
244
+ query_params = {}
245
+
246
+ # Header Params
247
+ header_params = {}
248
+ header_params['accept'] = 'application/json'
249
+ header_params['content-type'] = 'application/json'
250
+
251
+ post_body = nil
252
+
253
+ return @api_client.call_api(
254
+ :GET,
255
+ path,
256
+ endpoint,
257
+ :header_params => header_params,
258
+ :query_params => query_params,
259
+ :body => post_body,
260
+ :return_type => 'OracleBMC::Core::Models::Volume')
261
+ end
262
+
263
+ # Gets information for the specified volume backup.
264
+ # @param [String] volume_backup_id The OCID of the volume backup.
265
+ # @param [Hash] opts the optional parameters
266
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::VolumeBackup
267
+ def get_volume_backup(volume_backup_id, opts = {})
268
+ logger.debug "Calling operation BlockstorageClient#get_volume_backup." if logger
269
+
270
+ fail "Missing the required parameter 'volume_backup_id' when calling get_volume_backup." if volume_backup_id.nil?
271
+
272
+ path = "/volumeBackups/{volumeBackupId}".sub('{volumeBackupId}', volume_backup_id.to_s)
273
+
274
+ # Query Params
275
+ query_params = {}
276
+
277
+ # Header Params
278
+ header_params = {}
279
+ header_params['accept'] = 'application/json'
280
+ header_params['content-type'] = 'application/json'
281
+
282
+ post_body = nil
283
+
284
+ return @api_client.call_api(
285
+ :GET,
286
+ path,
287
+ endpoint,
288
+ :header_params => header_params,
289
+ :query_params => query_params,
290
+ :body => post_body,
291
+ :return_type => 'OracleBMC::Core::Models::VolumeBackup')
292
+ end
293
+
294
+ # Lists the volume backups in the specified compartment. You can filter the results by volume.
295
+ #
296
+ # @param [String] compartment_id The OCID of the compartment.
297
+ # @param [Hash] opts the optional parameters
298
+ # @option opts [String] :volume_id The OCID of the volume.
299
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \&quot;List\&quot; call.
300
+ #
301
+ # Example: `500`
302
+ #
303
+ # @option opts [String] :page The value of the `opc-next-page` response header from the previous \&quot;List\&quot; call.
304
+ #
305
+ # @return [Response] A Response object with data of type Array<OracleBMC::Core::Models::VolumeBackup>
306
+ def list_volume_backups(compartment_id, opts = {})
307
+ logger.debug "Calling operation BlockstorageClient#list_volume_backups." if logger
308
+
309
+ fail "Missing the required parameter 'compartment_id' when calling list_volume_backups." if compartment_id.nil?
310
+
311
+ path = "/volumeBackups"
312
+
313
+ # Query Params
314
+ query_params = {}
315
+ query_params[:'compartmentId'] = compartment_id
316
+ query_params[:'volumeId'] = opts[:'volume_id'] if opts[:'volume_id']
317
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
318
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
319
+
320
+ # Header Params
321
+ header_params = {}
322
+ header_params['accept'] = 'application/json'
323
+ header_params['content-type'] = 'application/json'
324
+
325
+ post_body = nil
326
+
327
+ return @api_client.call_api(
328
+ :GET,
329
+ path,
330
+ endpoint,
331
+ :header_params => header_params,
332
+ :query_params => query_params,
333
+ :body => post_body,
334
+ :return_type => 'Array<OracleBMC::Core::Models::VolumeBackup>')
335
+ end
336
+
337
+ # Lists the volumes in the specified compartment and Availability Domain.
338
+ #
339
+ # @param [String] compartment_id The OCID of the compartment.
340
+ # @param [Hash] opts the optional parameters
341
+ # @option opts [String] :availability_domain The name of the Availability Domain.
342
+ #
343
+ # Example: `Uocm:PHX-AD-1`
344
+ #
345
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \&quot;List\&quot; call.
346
+ #
347
+ # Example: `500`
348
+ #
349
+ # @option opts [String] :page The value of the `opc-next-page` response header from the previous \&quot;List\&quot; call.
350
+ #
351
+ # @return [Response] A Response object with data of type Array<OracleBMC::Core::Models::Volume>
352
+ def list_volumes(compartment_id, opts = {})
353
+ logger.debug "Calling operation BlockstorageClient#list_volumes." if logger
354
+
355
+ fail "Missing the required parameter 'compartment_id' when calling list_volumes." if compartment_id.nil?
356
+
357
+ path = "/volumes"
358
+
359
+ # Query Params
360
+ query_params = {}
361
+ query_params[:'compartmentId'] = compartment_id
362
+ query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
363
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
364
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
365
+
366
+ # Header Params
367
+ header_params = {}
368
+ header_params['accept'] = 'application/json'
369
+ header_params['content-type'] = 'application/json'
370
+
371
+ post_body = nil
372
+
373
+ return @api_client.call_api(
374
+ :GET,
375
+ path,
376
+ endpoint,
377
+ :header_params => header_params,
378
+ :query_params => query_params,
379
+ :body => post_body,
380
+ :return_type => 'Array<OracleBMC::Core::Models::Volume>')
381
+ end
382
+
383
+ # Updates the specified volume's display name.
384
+ # @param [String] volume_id The OCID of the volume.
385
+ # @param [UpdateVolumeDetails] update_volume_details Update volume&#39;s display name.
386
+ # @param [Hash] opts the optional parameters
387
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
388
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
389
+ # will be updated or deleted only if the etag you provide matches the resource&#39;s current etag value.
390
+ #
391
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Volume
392
+ def update_volume(volume_id, update_volume_details, opts = {})
393
+ logger.debug "Calling operation BlockstorageClient#update_volume." if logger
394
+
395
+ fail "Missing the required parameter 'volume_id' when calling update_volume." if volume_id.nil?
396
+ fail "Missing the required parameter 'update_volume_details' when calling update_volume." if update_volume_details.nil?
397
+
398
+ path = "/volumes/{volumeId}".sub('{volumeId}', volume_id.to_s)
399
+
400
+ # Query Params
401
+ query_params = {}
402
+
403
+ # Header Params
404
+ header_params = {}
405
+ header_params['accept'] = 'application/json'
406
+ header_params['content-type'] = 'application/json'
407
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
408
+
409
+ post_body = @api_client.object_to_http_body(update_volume_details)
410
+
411
+ return @api_client.call_api(
412
+ :PUT,
413
+ path,
414
+ endpoint,
415
+ :header_params => header_params,
416
+ :query_params => query_params,
417
+ :body => post_body,
418
+ :return_type => 'OracleBMC::Core::Models::Volume')
419
+ end
420
+
421
+ # Updates the display name for the specified volume backup.
422
+ # @param [String] volume_backup_id The OCID of the volume backup.
423
+ # @param [UpdateVolumeBackupDetails] update_volume_backup_details Update volume backup fields
424
+ # @param [Hash] opts the optional parameters
425
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
426
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
427
+ # will be updated or deleted only if the etag you provide matches the resource&#39;s current etag value.
428
+ #
429
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::VolumeBackup
430
+ def update_volume_backup(volume_backup_id, update_volume_backup_details, opts = {})
431
+ logger.debug "Calling operation BlockstorageClient#update_volume_backup." if logger
432
+
433
+ fail "Missing the required parameter 'volume_backup_id' when calling update_volume_backup." if volume_backup_id.nil?
434
+ fail "Missing the required parameter 'update_volume_backup_details' when calling update_volume_backup." if update_volume_backup_details.nil?
435
+
436
+ path = "/volumeBackups/{volumeBackupId}".sub('{volumeBackupId}', volume_backup_id.to_s)
437
+
438
+ # Query Params
439
+ query_params = {}
440
+
441
+ # Header Params
442
+ header_params = {}
443
+ header_params['accept'] = 'application/json'
444
+ header_params['content-type'] = 'application/json'
445
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
446
+
447
+ post_body = @api_client.object_to_http_body(update_volume_backup_details)
448
+
449
+ return @api_client.call_api(
450
+ :PUT,
451
+ path,
452
+ endpoint,
453
+ :header_params => header_params,
454
+ :query_params => query_params,
455
+ :body => post_body,
456
+ :return_type => 'OracleBMC::Core::Models::VolumeBackup')
457
+ end
458
+ end
459
+ end