oraclebmc 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
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,1053 @@
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::ComputeClient
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 ComputeClient.
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, :ComputeClient) + '/20160918'
54
+ logger.info "ComputeClient 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
+ # Attaches the specified storage volume to the specified instance.
64
+ #
65
+ # @param [AttachVolumeDetails] attach_volume_details Attach volume request
66
+ # @param [Hash] opts the optional parameters
67
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
68
+ # server error without risk of executing that same action again. Retry tokens expire after 24
69
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
70
+ # has been deleted and purged from the system, then a retry of the original creation request
71
+ # may be rejected).
72
+ #
73
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::VolumeAttachment
74
+ def attach_volume(attach_volume_details, opts = {})
75
+ logger.debug "Calling operation ComputeClient#attach_volume." if logger
76
+
77
+ fail "Missing the required parameter 'attach_volume_details' when calling attach_volume." if attach_volume_details.nil?
78
+
79
+ path = "/volumeAttachments/"
80
+
81
+ # Query Params
82
+ query_params = {}
83
+
84
+ # Header Params
85
+ header_params = {}
86
+ header_params['accept'] = 'application/json'
87
+ header_params['content-type'] = 'application/json'
88
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
89
+
90
+ post_body = @api_client.object_to_http_body(attach_volume_details)
91
+
92
+ return @api_client.call_api(
93
+ :POST,
94
+ path,
95
+ endpoint,
96
+ :header_params => header_params,
97
+ :query_params => query_params,
98
+ :body => post_body,
99
+ :return_type => 'OracleBMC::Core::Models::VolumeAttachment')
100
+ end
101
+
102
+ # Captures the most recent serial console data (up to a megabyte) for the
103
+ # specified instance.
104
+ #
105
+ # The `CaptureConsoleHistory` operation works with the other console history operations
106
+ # as described below.
107
+ #
108
+ # 1. Use `CaptureConsoleHistory` to request the capture of up to a megabyte of the
109
+ # most recent console history. This call returns a `ConsoleHistory`
110
+ # object. The object will have a state of REQUESTED.
111
+ # 2. Wait for the capture operation to succeed by polling `GetConsoleHistory` with
112
+ # the identifier of the console history metadata. The state of the
113
+ # `ConsoleHistory` object will go from REQUESTED to GETTING-HISTORY and
114
+ # then SUCCEEDED (or FAILED).
115
+ # 3. Use `GetConsoleHistoryContent` to get the actual console history data (not the
116
+ # metadata).
117
+ # 4. Optionally, use `DeleteConsoleHistory` to delete the console history metadata
118
+ # and the console history data.
119
+ #
120
+ # @param [CaptureConsoleHistoryDetails] capture_console_history_details Console history details
121
+ # @param [Hash] opts the optional parameters
122
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
123
+ # server error without risk of executing that same action again. Retry tokens expire after 24
124
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
125
+ # has been deleted and purged from the system, then a retry of the original creation request
126
+ # may be rejected).
127
+ #
128
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::ConsoleHistory
129
+ def capture_console_history(capture_console_history_details, opts = {})
130
+ logger.debug "Calling operation ComputeClient#capture_console_history." if logger
131
+
132
+ fail "Missing the required parameter 'capture_console_history_details' when calling capture_console_history." if capture_console_history_details.nil?
133
+
134
+ path = "/instanceConsoleHistories/"
135
+
136
+ # Query Params
137
+ query_params = {}
138
+
139
+ # Header Params
140
+ header_params = {}
141
+ header_params['accept'] = 'application/json'
142
+ header_params['content-type'] = 'application/json'
143
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
144
+
145
+ post_body = @api_client.object_to_http_body(capture_console_history_details)
146
+
147
+ return @api_client.call_api(
148
+ :POST,
149
+ path,
150
+ endpoint,
151
+ :header_params => header_params,
152
+ :query_params => query_params,
153
+ :body => post_body,
154
+ :return_type => 'OracleBMC::Core::Models::ConsoleHistory')
155
+ end
156
+
157
+ # Creates a boot disk image for the specified instance. For more information about images, see
158
+ # [Managing Custom Images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm).
159
+ #
160
+ # You must provide the OCID of the instance you want to use as the basis for the image, and
161
+ # the OCID of the compartment containing that instance.
162
+ #
163
+ # You may optionally specify a *display name* for the image, which is simply a friendly name or description.
164
+ # It does not have to be unique, and you can change it. See {#update_image update_image}.
165
+ #
166
+ # @param [CreateImageDetails] create_image_details Image creation details
167
+ # @param [Hash] opts the optional parameters
168
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
169
+ # server error without risk of executing that same action again. Retry tokens expire after 24
170
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
171
+ # has been deleted and purged from the system, then a retry of the original creation request
172
+ # may be rejected).
173
+ #
174
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Image
175
+ def create_image(create_image_details, opts = {})
176
+ logger.debug "Calling operation ComputeClient#create_image." if logger
177
+
178
+ fail "Missing the required parameter 'create_image_details' when calling create_image." if create_image_details.nil?
179
+
180
+ path = "/images/"
181
+
182
+ # Query Params
183
+ query_params = {}
184
+
185
+ # Header Params
186
+ header_params = {}
187
+ header_params['accept'] = 'application/json'
188
+ header_params['content-type'] = 'application/json'
189
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
190
+
191
+ post_body = @api_client.object_to_http_body(create_image_details)
192
+
193
+ return @api_client.call_api(
194
+ :POST,
195
+ path,
196
+ endpoint,
197
+ :header_params => header_params,
198
+ :query_params => query_params,
199
+ :body => post_body,
200
+ :return_type => 'OracleBMC::Core::Models::Image')
201
+ end
202
+
203
+ # Deletes the specified console history metadata and the console history data.
204
+ # @param [String] instance_console_history_id The OCID of the console history.
205
+ # @param [Hash] opts the optional parameters
206
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
207
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
208
+ # will be updated or deleted only if the etag you provide matches the resource's current etag value.
209
+ #
210
+ # @return [Response] A Response object with data of type nil
211
+ def delete_console_history(instance_console_history_id, opts = {})
212
+ logger.debug "Calling operation ComputeClient#delete_console_history." if logger
213
+
214
+ fail "Missing the required parameter 'instance_console_history_id' when calling delete_console_history." if instance_console_history_id.nil?
215
+
216
+ path = "/instanceConsoleHistories/{instanceConsoleHistoryId}".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s)
217
+
218
+ # Query Params
219
+ query_params = {}
220
+
221
+ # Header Params
222
+ header_params = {}
223
+ header_params['accept'] = 'application/json'
224
+ header_params['content-type'] = 'application/json'
225
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
226
+
227
+ post_body = nil
228
+
229
+ return @api_client.call_api(
230
+ :DELETE,
231
+ path,
232
+ endpoint,
233
+ :header_params => header_params,
234
+ :query_params => query_params,
235
+ :body => post_body)
236
+ end
237
+
238
+ # Deletes an image.
239
+ # @param [String] image_id The OCID of the image.
240
+ # @param [Hash] opts the optional parameters
241
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
242
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
243
+ # will be updated or deleted only if the etag you provide matches the resource's current etag value.
244
+ #
245
+ # @return [Response] A Response object with data of type nil
246
+ def delete_image(image_id, opts = {})
247
+ logger.debug "Calling operation ComputeClient#delete_image." if logger
248
+
249
+ fail "Missing the required parameter 'image_id' when calling delete_image." if image_id.nil?
250
+
251
+ path = "/images/{imageId}".sub('{imageId}', image_id.to_s)
252
+
253
+ # Query Params
254
+ query_params = {}
255
+
256
+ # Header Params
257
+ header_params = {}
258
+ header_params['accept'] = 'application/json'
259
+ header_params['content-type'] = 'application/json'
260
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
261
+
262
+ post_body = nil
263
+
264
+ return @api_client.call_api(
265
+ :DELETE,
266
+ path,
267
+ endpoint,
268
+ :header_params => header_params,
269
+ :query_params => query_params,
270
+ :body => post_body)
271
+ end
272
+
273
+ # Detaches a storage volume from an instance. You must specify the OCID of the volume attachment.
274
+ #
275
+ # This is an asynchronous operation; the attachment's `lifecycleState` will change to DETACHING temporarily
276
+ # until the attachment is completely removed.
277
+ #
278
+ # @param [String] volume_attachment_id The OCID of the volume attachment.
279
+ # @param [Hash] opts the optional parameters
280
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
281
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
282
+ # will be updated or deleted only if the etag you provide matches the resource's current etag value.
283
+ #
284
+ # @return [Response] A Response object with data of type nil
285
+ def detach_volume(volume_attachment_id, opts = {})
286
+ logger.debug "Calling operation ComputeClient#detach_volume." if logger
287
+
288
+ fail "Missing the required parameter 'volume_attachment_id' when calling detach_volume." if volume_attachment_id.nil?
289
+
290
+ path = "/volumeAttachments/{volumeAttachmentId}".sub('{volumeAttachmentId}', volume_attachment_id.to_s)
291
+
292
+ # Query Params
293
+ query_params = {}
294
+
295
+ # Header Params
296
+ header_params = {}
297
+ header_params['accept'] = 'application/json'
298
+ header_params['content-type'] = 'application/json'
299
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
300
+
301
+ post_body = nil
302
+
303
+ return @api_client.call_api(
304
+ :DELETE,
305
+ path,
306
+ endpoint,
307
+ :header_params => header_params,
308
+ :query_params => query_params,
309
+ :body => post_body)
310
+ end
311
+
312
+ # Shows the metadata for the specified console history.
313
+ # See {#capture_console_history capture_console_history}
314
+ # for details about using the console history operations.
315
+ #
316
+ # @param [String] instance_console_history_id The OCID of the console history.
317
+ # @param [Hash] opts the optional parameters
318
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::ConsoleHistory
319
+ def get_console_history(instance_console_history_id, opts = {})
320
+ logger.debug "Calling operation ComputeClient#get_console_history." if logger
321
+
322
+ fail "Missing the required parameter 'instance_console_history_id' when calling get_console_history." if instance_console_history_id.nil?
323
+
324
+ path = "/instanceConsoleHistories/{instanceConsoleHistoryId}".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s)
325
+
326
+ # Query Params
327
+ query_params = {}
328
+
329
+ # Header Params
330
+ header_params = {}
331
+ header_params['accept'] = 'application/json'
332
+ header_params['content-type'] = 'application/json'
333
+
334
+ post_body = nil
335
+
336
+ return @api_client.call_api(
337
+ :GET,
338
+ path,
339
+ endpoint,
340
+ :header_params => header_params,
341
+ :query_params => query_params,
342
+ :body => post_body,
343
+ :return_type => 'OracleBMC::Core::Models::ConsoleHistory')
344
+ end
345
+
346
+ # Gets the actual console history data (not the metadata).
347
+ # See {#capture_console_history capture_console_history}
348
+ # for details about using the console history operations.
349
+ #
350
+ # @param [String] instance_console_history_id The OCID of the console history.
351
+ # @param [Hash] opts the optional parameters
352
+ # @option opts [Integer] :offset Offset of the snapshot data to retrieve.
353
+ # @option opts [Integer] :length Length of the snapshot data to retrieve.
354
+ # @return [Response] A Response object with data of type String
355
+ def get_console_history_content(instance_console_history_id, opts = {})
356
+ logger.debug "Calling operation ComputeClient#get_console_history_content." if logger
357
+
358
+ fail "Missing the required parameter 'instance_console_history_id' when calling get_console_history_content." if instance_console_history_id.nil?
359
+
360
+ path = "/instanceConsoleHistories/{instanceConsoleHistoryId}/data".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s)
361
+
362
+ # Query Params
363
+ query_params = {}
364
+ query_params[:'offset'] = opts[:'offset'] if opts[:'offset']
365
+ query_params[:'length'] = opts[:'length'] if opts[:'length']
366
+
367
+ # Header Params
368
+ header_params = {}
369
+ header_params['accept'] = 'application/json'
370
+ header_params['content-type'] = 'application/json'
371
+
372
+ post_body = nil
373
+
374
+ return @api_client.call_api(
375
+ :GET,
376
+ path,
377
+ endpoint,
378
+ :header_params => header_params,
379
+ :query_params => query_params,
380
+ :body => post_body,
381
+ :return_type => 'String')
382
+ end
383
+
384
+ # Gets the specified image.
385
+ # @param [String] image_id The OCID of the image.
386
+ # @param [Hash] opts the optional parameters
387
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Image
388
+ def get_image(image_id, opts = {})
389
+ logger.debug "Calling operation ComputeClient#get_image." if logger
390
+
391
+ fail "Missing the required parameter 'image_id' when calling get_image." if image_id.nil?
392
+
393
+ path = "/images/{imageId}".sub('{imageId}', image_id.to_s)
394
+
395
+ # Query Params
396
+ query_params = {}
397
+
398
+ # Header Params
399
+ header_params = {}
400
+ header_params['accept'] = 'application/json'
401
+ header_params['content-type'] = 'application/json'
402
+
403
+ post_body = nil
404
+
405
+ return @api_client.call_api(
406
+ :GET,
407
+ path,
408
+ endpoint,
409
+ :header_params => header_params,
410
+ :query_params => query_params,
411
+ :body => post_body,
412
+ :return_type => 'OracleBMC::Core::Models::Image')
413
+ end
414
+
415
+ # Gets information about the specified instance.
416
+ # @param [String] instance_id The OCID of the instance.
417
+ # @param [Hash] opts the optional parameters
418
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Instance
419
+ def get_instance(instance_id, opts = {})
420
+ logger.debug "Calling operation ComputeClient#get_instance." if logger
421
+
422
+ fail "Missing the required parameter 'instance_id' when calling get_instance." if instance_id.nil?
423
+
424
+ path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s)
425
+
426
+ # Query Params
427
+ query_params = {}
428
+
429
+ # Header Params
430
+ header_params = {}
431
+ header_params['accept'] = 'application/json'
432
+ header_params['content-type'] = 'application/json'
433
+
434
+ post_body = nil
435
+
436
+ return @api_client.call_api(
437
+ :GET,
438
+ path,
439
+ endpoint,
440
+ :header_params => header_params,
441
+ :query_params => query_params,
442
+ :body => post_body,
443
+ :return_type => 'OracleBMC::Core::Models::Instance')
444
+ end
445
+
446
+ # Gets information about the specified volume attachment.
447
+ # @param [String] volume_attachment_id The OCID of the volume attachment.
448
+ # @param [Hash] opts the optional parameters
449
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::VolumeAttachment
450
+ def get_volume_attachment(volume_attachment_id, opts = {})
451
+ logger.debug "Calling operation ComputeClient#get_volume_attachment." if logger
452
+
453
+ fail "Missing the required parameter 'volume_attachment_id' when calling get_volume_attachment." if volume_attachment_id.nil?
454
+
455
+ path = "/volumeAttachments/{volumeAttachmentId}".sub('{volumeAttachmentId}', volume_attachment_id.to_s)
456
+
457
+ # Query Params
458
+ query_params = {}
459
+
460
+ # Header Params
461
+ header_params = {}
462
+ header_params['accept'] = 'application/json'
463
+ header_params['content-type'] = 'application/json'
464
+
465
+ post_body = nil
466
+
467
+ return @api_client.call_api(
468
+ :GET,
469
+ path,
470
+ endpoint,
471
+ :header_params => header_params,
472
+ :query_params => query_params,
473
+ :body => post_body,
474
+ :return_type => 'OracleBMC::Core::Models::VolumeAttachment')
475
+ end
476
+
477
+ # Performs one of the power actions (start, stop, softreset, or reset)
478
+ # on the specified instance.
479
+ #
480
+ # **start** - power on
481
+ #
482
+ # **stop** - power off
483
+ #
484
+ # **softreset** - ACPI shutdown and power on
485
+ #
486
+ # **reset** - power off and power on
487
+ #
488
+ # Note that the **stop** state has no effect on the resources you consume.
489
+ # Billing continues for instances that you stop, and related resources continue
490
+ # to apply against any relevant quotas. You must terminate an instance
491
+ # ({#terminate_instance terminate_instance})
492
+ # to remove its resources from billing and quotas.
493
+ #
494
+ # @param [String] instance_id The OCID of the instance.
495
+ # @param [String] action The action to perform on the instance.
496
+ # @param [Hash] opts the optional parameters
497
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
498
+ # server error without risk of executing that same action again. Retry tokens expire after 24
499
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
500
+ # has been deleted and purged from the system, then a retry of the original creation request
501
+ # may be rejected).
502
+ #
503
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
504
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
505
+ # will be updated or deleted only if the etag you provide matches the resource's current etag value.
506
+ #
507
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Instance
508
+ def instance_action(instance_id, action, opts = {})
509
+ logger.debug "Calling operation ComputeClient#instance_action." if logger
510
+
511
+ fail "Missing the required parameter 'instance_id' when calling instance_action." if instance_id.nil?
512
+ fail "Missing the required parameter 'action' when calling instance_action." if action.nil?
513
+ unless ['STOP', 'START', 'SOFTRESET', 'RESET'].include?(action)
514
+ fail "Invalid value for 'action', must be one of STOP, START, SOFTRESET, RESET."
515
+ end
516
+
517
+ path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s)
518
+
519
+ # Query Params
520
+ query_params = {}
521
+ query_params[:'action'] = action
522
+
523
+ # Header Params
524
+ header_params = {}
525
+ header_params['accept'] = 'application/json'
526
+ header_params['content-type'] = 'application/json'
527
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
528
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
529
+
530
+ post_body = nil
531
+
532
+ return @api_client.call_api(
533
+ :POST,
534
+ path,
535
+ endpoint,
536
+ :header_params => header_params,
537
+ :query_params => query_params,
538
+ :body => post_body,
539
+ :return_type => 'OracleBMC::Core::Models::Instance')
540
+ end
541
+
542
+ # Creates a new instance in the specified compartment and the specified Availability Domain.
543
+ # For general information about instances, see
544
+ # [Overview of the Compute Service](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Concepts/computeoverview.htm).
545
+ #
546
+ # For information about access control and compartments, see
547
+ # [Overview of the IAM Service](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm).
548
+ #
549
+ # For information about Availability Domains, see
550
+ # [Regions and Availability Domains](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm).
551
+ # To get a list of Availability Domains, use the `ListAvailabilityDomains` operation
552
+ # in the Identity and Access Management Service API.
553
+ #
554
+ # All Oracle Bare Metal Cloud Services resources, including instances, get an Oracle-assigned,
555
+ # unique ID called an Oracle Cloud Identifier (OCID).
556
+ # When you create a resource, you can find its OCID in the response. You can
557
+ # also retrieve a resource's OCID by using a List API operation
558
+ # on that resource type, or by viewing the resource in the Console.
559
+ #
560
+ # When you launch an instance, it is automatically attached to a Virtual
561
+ # Network Interface Card (VNIC) and given both a public and private IP address.
562
+ # To get both addresses, use the {#list_vnic_attachments list_vnic_attachments}
563
+ # operation to get the VNIC ID for the instance, and then call
564
+ # {#get_vnic get_vnic} with the VNIC ID.
565
+ #
566
+ # @param [LaunchInstanceDetails] launch_instance_details Instance details
567
+ # @param [Hash] opts the optional parameters
568
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
569
+ # server error without risk of executing that same action again. Retry tokens expire after 24
570
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
571
+ # has been deleted and purged from the system, then a retry of the original creation request
572
+ # may be rejected).
573
+ #
574
+ # @option opts [String] :opc_host_serial For Oracle internal use only.
575
+ # @option opts [String] :opc_pool_name For Oracle internal use only.
576
+ # @option opts [String] :opc_vnic_id For Oracle internal use only.
577
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Instance
578
+ def launch_instance(launch_instance_details, opts = {})
579
+ logger.debug "Calling operation ComputeClient#launch_instance." if logger
580
+
581
+ fail "Missing the required parameter 'launch_instance_details' when calling launch_instance." if launch_instance_details.nil?
582
+
583
+ path = "/instances/"
584
+
585
+ # Query Params
586
+ query_params = {}
587
+ query_params[:'opc-host-serial'] = opts[:'opc_host_serial'] if opts[:'opc_host_serial']
588
+ query_params[:'opc-pool-name'] = opts[:'opc_pool_name'] if opts[:'opc_pool_name']
589
+ query_params[:'opc-vnic-id'] = opts[:'opc_vnic_id'] if opts[:'opc_vnic_id']
590
+
591
+ # Header Params
592
+ header_params = {}
593
+ header_params['accept'] = 'application/json'
594
+ header_params['content-type'] = 'application/json'
595
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
596
+
597
+ post_body = @api_client.object_to_http_body(launch_instance_details)
598
+
599
+ return @api_client.call_api(
600
+ :POST,
601
+ path,
602
+ endpoint,
603
+ :header_params => header_params,
604
+ :query_params => query_params,
605
+ :body => post_body,
606
+ :return_type => 'OracleBMC::Core::Models::Instance')
607
+ end
608
+
609
+ # Lists the console history metadata for the specified compartment or instance.
610
+ #
611
+ # @param [String] compartment_id The OCID of the compartment.
612
+ # @param [Hash] opts the optional parameters
613
+ # @option opts [String] :availability_domain The name of the Availability Domain.
614
+ #
615
+ # Example: `Uocm:PHX-AD-1`
616
+ #
617
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \"List\" call.
618
+ #
619
+ # Example: `500`
620
+ #
621
+ # @option opts [String] :page The value of the `opc-next-page` response header from the previous \"List\" call.
622
+ #
623
+ # @option opts [String] :instance_id The OCID of the instance.
624
+ # @return [Response] A Response object with data of type Array<OracleBMC::Core::Models::ConsoleHistory>
625
+ def list_console_histories(compartment_id, opts = {})
626
+ logger.debug "Calling operation ComputeClient#list_console_histories." if logger
627
+
628
+ fail "Missing the required parameter 'compartment_id' when calling list_console_histories." if compartment_id.nil?
629
+
630
+ path = "/instanceConsoleHistories/"
631
+
632
+ # Query Params
633
+ query_params = {}
634
+ query_params[:'compartmentId'] = compartment_id
635
+ query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
636
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
637
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
638
+ query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id']
639
+
640
+ # Header Params
641
+ header_params = {}
642
+ header_params['accept'] = 'application/json'
643
+ header_params['content-type'] = 'application/json'
644
+
645
+ post_body = nil
646
+
647
+ return @api_client.call_api(
648
+ :GET,
649
+ path,
650
+ endpoint,
651
+ :header_params => header_params,
652
+ :query_params => query_params,
653
+ :body => post_body,
654
+ :return_type => 'Array<OracleBMC::Core::Models::ConsoleHistory>')
655
+ end
656
+
657
+ # Lists the available images in the specified compartment. For more
658
+ # information about images, see
659
+ # [Managing Custom Images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm).
660
+ #
661
+ # @param [String] compartment_id The OCID of the compartment.
662
+ # @param [Hash] opts the optional parameters
663
+ # @option opts [String] :display_name A user-friendly name. Does not have to be unique, and it&#39;s changeable.
664
+ #
665
+ # Example: `My new resource`
666
+ #
667
+ # @option opts [String] :operating_system The image&#39;s operating system.
668
+ #
669
+ # Example: `Oracle Linux`
670
+ #
671
+ # @option opts [String] :operating_system_version The image&#39;s operating system version.
672
+ #
673
+ # Example: `7.2`
674
+ #
675
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \&quot;List\&quot; call.
676
+ #
677
+ # Example: `500`
678
+ #
679
+ # @option opts [String] :page The value of the `opc-next-page` response header from the previous \&quot;List\&quot; call.
680
+ #
681
+ # @return [Response] A Response object with data of type Array<OracleBMC::Core::Models::Image>
682
+ def list_images(compartment_id, opts = {})
683
+ logger.debug "Calling operation ComputeClient#list_images." if logger
684
+
685
+ fail "Missing the required parameter 'compartment_id' when calling list_images." if compartment_id.nil?
686
+
687
+ path = "/images/"
688
+
689
+ # Query Params
690
+ query_params = {}
691
+ query_params[:'compartmentId'] = compartment_id
692
+ query_params[:'displayName'] = opts[:'display_name'] if opts[:'display_name']
693
+ query_params[:'operatingSystem'] = opts[:'operating_system'] if opts[:'operating_system']
694
+ query_params[:'operatingSystemVersion'] = opts[:'operating_system_version'] if opts[:'operating_system_version']
695
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
696
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
697
+
698
+ # Header Params
699
+ header_params = {}
700
+ header_params['accept'] = 'application/json'
701
+ header_params['content-type'] = 'application/json'
702
+
703
+ post_body = nil
704
+
705
+ return @api_client.call_api(
706
+ :GET,
707
+ path,
708
+ endpoint,
709
+ :header_params => header_params,
710
+ :query_params => query_params,
711
+ :body => post_body,
712
+ :return_type => 'Array<OracleBMC::Core::Models::Image>')
713
+ end
714
+
715
+ # Lists the instances in the specified compartment and the specified Availability Domain.
716
+ # You can filter the results by specifying an instance name (the list will include all the identically-named
717
+ # instances in the compartment).
718
+ #
719
+ # @param [String] compartment_id The OCID of the compartment.
720
+ # @param [Hash] opts the optional parameters
721
+ # @option opts [String] :availability_domain The name of the Availability Domain.
722
+ #
723
+ # Example: `Uocm:PHX-AD-1`
724
+ #
725
+ # @option opts [String] :display_name A user-friendly name. Does not have to be unique, and it&#39;s changeable.
726
+ #
727
+ # Example: `My new resource`
728
+ #
729
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \&quot;List\&quot; call.
730
+ #
731
+ # Example: `500`
732
+ #
733
+ # @option opts [String] :page The value of the `opc-next-page` response header from the previous \&quot;List\&quot; call.
734
+ #
735
+ # @return [Response] A Response object with data of type Array<OracleBMC::Core::Models::Instance>
736
+ def list_instances(compartment_id, opts = {})
737
+ logger.debug "Calling operation ComputeClient#list_instances." if logger
738
+
739
+ fail "Missing the required parameter 'compartment_id' when calling list_instances." if compartment_id.nil?
740
+
741
+ path = "/instances/"
742
+
743
+ # Query Params
744
+ query_params = {}
745
+ query_params[:'compartmentId'] = compartment_id
746
+ query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
747
+ query_params[:'displayName'] = opts[:'display_name'] if opts[:'display_name']
748
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
749
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
750
+
751
+ # Header Params
752
+ header_params = {}
753
+ header_params['accept'] = 'application/json'
754
+ header_params['content-type'] = 'application/json'
755
+
756
+ post_body = nil
757
+
758
+ return @api_client.call_api(
759
+ :GET,
760
+ path,
761
+ endpoint,
762
+ :header_params => header_params,
763
+ :query_params => query_params,
764
+ :body => post_body,
765
+ :return_type => 'Array<OracleBMC::Core::Models::Instance>')
766
+ end
767
+
768
+ # Lists the shapes that can be used to launch an instance within the specified compartment. You can
769
+ # filter the list by compatibility with a specific image.
770
+ #
771
+ # @param [String] compartment_id The OCID of the compartment.
772
+ # @param [Hash] opts the optional parameters
773
+ # @option opts [String] :availability_domain The name of the Availability Domain.
774
+ #
775
+ # Example: `Uocm:PHX-AD-1`
776
+ #
777
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \&quot;List\&quot; call.
778
+ #
779
+ # Example: `500`
780
+ #
781
+ # @option opts [String] :page The value of the `opc-next-page` response header from the previous \&quot;List\&quot; call.
782
+ #
783
+ # @option opts [String] :image_id The OCID of an image.
784
+ # @return [Response] A Response object with data of type Array<OracleBMC::Core::Models::Shape>
785
+ def list_shapes(compartment_id, opts = {})
786
+ logger.debug "Calling operation ComputeClient#list_shapes." if logger
787
+
788
+ fail "Missing the required parameter 'compartment_id' when calling list_shapes." if compartment_id.nil?
789
+
790
+ path = "/shapes"
791
+
792
+ # Query Params
793
+ query_params = {}
794
+ query_params[:'compartmentId'] = compartment_id
795
+ query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
796
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
797
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
798
+ query_params[:'imageId'] = opts[:'image_id'] if opts[:'image_id']
799
+
800
+ # Header Params
801
+ header_params = {}
802
+ header_params['accept'] = 'application/json'
803
+ header_params['content-type'] = 'application/json'
804
+
805
+ post_body = nil
806
+
807
+ return @api_client.call_api(
808
+ :GET,
809
+ path,
810
+ endpoint,
811
+ :header_params => header_params,
812
+ :query_params => query_params,
813
+ :body => post_body,
814
+ :return_type => 'Array<OracleBMC::Core::Models::Shape>')
815
+ end
816
+
817
+ # Lists the VNIC attachments for the specified compartment. The list can be filtered by
818
+ # instance and by VNIC.
819
+ #
820
+ # @param [String] compartment_id The OCID of the compartment.
821
+ # @param [Hash] opts the optional parameters
822
+ # @option opts [String] :availability_domain The name of the Availability Domain.
823
+ #
824
+ # Example: `Uocm:PHX-AD-1`
825
+ #
826
+ # @option opts [String] :instance_id The OCID of the instance.
827
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \&quot;List\&quot; call.
828
+ #
829
+ # Example: `500`
830
+ #
831
+ # @option opts [String] :page The value of the `opc-next-page` response header from the previous \&quot;List\&quot; call.
832
+ #
833
+ # @option opts [String] :vnic_id The OCID of the VNIC.
834
+ # @return [Response] A Response object with data of type Array<OracleBMC::Core::Models::VnicAttachment>
835
+ def list_vnic_attachments(compartment_id, opts = {})
836
+ logger.debug "Calling operation ComputeClient#list_vnic_attachments." if logger
837
+
838
+ fail "Missing the required parameter 'compartment_id' when calling list_vnic_attachments." if compartment_id.nil?
839
+
840
+ path = "/vnicAttachments/"
841
+
842
+ # Query Params
843
+ query_params = {}
844
+ query_params[:'compartmentId'] = compartment_id
845
+ query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
846
+ query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id']
847
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
848
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
849
+ query_params[:'vnicId'] = opts[:'vnic_id'] if opts[:'vnic_id']
850
+
851
+ # Header Params
852
+ header_params = {}
853
+ header_params['accept'] = 'application/json'
854
+ header_params['content-type'] = 'application/json'
855
+
856
+ post_body = nil
857
+
858
+ return @api_client.call_api(
859
+ :GET,
860
+ path,
861
+ endpoint,
862
+ :header_params => header_params,
863
+ :query_params => query_params,
864
+ :body => post_body,
865
+ :return_type => 'Array<OracleBMC::Core::Models::VnicAttachment>')
866
+ end
867
+
868
+ # Lists the volume attachments in the specified compartment. You can filter the
869
+ # list by specifying an instance OCID, volume OCID, or both.
870
+ #
871
+ # Currently, the only supported volume attachment type is {IScsiVolumeAttachment}.
872
+ #
873
+ # @param [String] compartment_id The OCID of the compartment.
874
+ # @param [Hash] opts the optional parameters
875
+ # @option opts [String] :availability_domain The name of the Availability Domain.
876
+ #
877
+ # Example: `Uocm:PHX-AD-1`
878
+ #
879
+ # @option opts [Integer] :limit The maximum number of items to return in a paginated \&quot;List\&quot; call.
880
+ #
881
+ # Example: `500`
882
+ #
883
+ # @option opts [String] :page The value of the `opc-next-page` response header from the previous \&quot;List\&quot; call.
884
+ #
885
+ # @option opts [String] :instance_id The OCID of the instance.
886
+ # @option opts [String] :volume_id The OCID of the volume.
887
+ # @return [Response] A Response object with data of type Array<OracleBMC::Core::Models::VolumeAttachment>
888
+ def list_volume_attachments(compartment_id, opts = {})
889
+ logger.debug "Calling operation ComputeClient#list_volume_attachments." if logger
890
+
891
+ fail "Missing the required parameter 'compartment_id' when calling list_volume_attachments." if compartment_id.nil?
892
+
893
+ path = "/volumeAttachments/"
894
+
895
+ # Query Params
896
+ query_params = {}
897
+ query_params[:'compartmentId'] = compartment_id
898
+ query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain']
899
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
900
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
901
+ query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id']
902
+ query_params[:'volumeId'] = opts[:'volume_id'] if opts[:'volume_id']
903
+
904
+ # Header Params
905
+ header_params = {}
906
+ header_params['accept'] = 'application/json'
907
+ header_params['content-type'] = 'application/json'
908
+
909
+ post_body = nil
910
+
911
+ return @api_client.call_api(
912
+ :GET,
913
+ path,
914
+ endpoint,
915
+ :header_params => header_params,
916
+ :query_params => query_params,
917
+ :body => post_body,
918
+ :return_type => 'Array<OracleBMC::Core::Models::VolumeAttachment>')
919
+ end
920
+
921
+ # Terminates the specified instance. Any attached VNICs and volumes are automatically detached
922
+ # when the instance terminates.
923
+ #
924
+ # This is an asynchronous operation; the instance's `lifecycleState` will change to TERMINATING temporarily
925
+ # until the instance is completely removed.
926
+ #
927
+ # @param [String] instance_id The OCID of the instance.
928
+ # @param [Hash] opts the optional parameters
929
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
930
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
931
+ # will be updated or deleted only if the etag you provide matches the resource&#39;s current etag value.
932
+ #
933
+ # @return [Response] A Response object with data of type nil
934
+ def terminate_instance(instance_id, opts = {})
935
+ logger.debug "Calling operation ComputeClient#terminate_instance." if logger
936
+
937
+ fail "Missing the required parameter 'instance_id' when calling terminate_instance." if instance_id.nil?
938
+
939
+ path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s)
940
+
941
+ # Query Params
942
+ query_params = {}
943
+
944
+ # Header Params
945
+ header_params = {}
946
+ header_params['accept'] = 'application/json'
947
+ header_params['content-type'] = 'application/json'
948
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
949
+
950
+ post_body = nil
951
+
952
+ return @api_client.call_api(
953
+ :DELETE,
954
+ path,
955
+ endpoint,
956
+ :header_params => header_params,
957
+ :query_params => query_params,
958
+ :body => post_body)
959
+ end
960
+
961
+ # Updates the display name of the image.
962
+ # @param [String] image_id The OCID of the image.
963
+ # @param [UpdateImageDetails] update_image_details Updates the image display name field.
964
+ # @param [Hash] opts the optional parameters
965
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
966
+ # server error without risk of executing that same action again. Retry tokens expire after 24
967
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
968
+ # has been deleted and purged from the system, then a retry of the original creation request
969
+ # may be rejected).
970
+ #
971
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
972
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
973
+ # will be updated or deleted only if the etag you provide matches the resource&#39;s current etag value.
974
+ #
975
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Image
976
+ def update_image(image_id, update_image_details, opts = {})
977
+ logger.debug "Calling operation ComputeClient#update_image." if logger
978
+
979
+ fail "Missing the required parameter 'image_id' when calling update_image." if image_id.nil?
980
+ fail "Missing the required parameter 'update_image_details' when calling update_image." if update_image_details.nil?
981
+
982
+ path = "/images/{imageId}".sub('{imageId}', image_id.to_s)
983
+
984
+ # Query Params
985
+ query_params = {}
986
+
987
+ # Header Params
988
+ header_params = {}
989
+ header_params['accept'] = 'application/json'
990
+ header_params['content-type'] = 'application/json'
991
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
992
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
993
+
994
+ post_body = @api_client.object_to_http_body(update_image_details)
995
+
996
+ return @api_client.call_api(
997
+ :PUT,
998
+ path,
999
+ endpoint,
1000
+ :header_params => header_params,
1001
+ :query_params => query_params,
1002
+ :body => post_body,
1003
+ :return_type => 'OracleBMC::Core::Models::Image')
1004
+ end
1005
+
1006
+ # Updates the display name of the specified instance. The OCID of the instance
1007
+ # remains the same.
1008
+ #
1009
+ # @param [String] instance_id The OCID of the instance.
1010
+ # @param [UpdateInstanceDetails] update_instance_details Update instance fields
1011
+ # @param [Hash] opts the optional parameters
1012
+ # @option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case of a timeout or
1013
+ # server error without risk of executing that same action again. Retry tokens expire after 24
1014
+ # hours, but can be invalidated before then due to conflicting operations (e.g., if a resource
1015
+ # has been deleted and purged from the system, then a retry of the original creation request
1016
+ # may be rejected).
1017
+ #
1018
+ # @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
1019
+ # parameter to the value of the etag from a previous GET or POST response for that resource. The resource
1020
+ # will be updated or deleted only if the etag you provide matches the resource&#39;s current etag value.
1021
+ #
1022
+ # @return [Response] A Response object with data of type OracleBMC::Core::Models::Instance
1023
+ def update_instance(instance_id, update_instance_details, opts = {})
1024
+ logger.debug "Calling operation ComputeClient#update_instance." if logger
1025
+
1026
+ fail "Missing the required parameter 'instance_id' when calling update_instance." if instance_id.nil?
1027
+ fail "Missing the required parameter 'update_instance_details' when calling update_instance." if update_instance_details.nil?
1028
+
1029
+ path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s)
1030
+
1031
+ # Query Params
1032
+ query_params = {}
1033
+
1034
+ # Header Params
1035
+ header_params = {}
1036
+ header_params['accept'] = 'application/json'
1037
+ header_params['content-type'] = 'application/json'
1038
+ header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token']
1039
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
1040
+
1041
+ post_body = @api_client.object_to_http_body(update_instance_details)
1042
+
1043
+ return @api_client.call_api(
1044
+ :PUT,
1045
+ path,
1046
+ endpoint,
1047
+ :header_params => header_params,
1048
+ :query_params => query_params,
1049
+ :body => post_body,
1050
+ :return_type => 'OracleBMC::Core::Models::Instance')
1051
+ end
1052
+ end
1053
+ end