Class: OracleBMC::Core::ComputeClient
- Inherits:
-
Object
- Object
- OracleBMC::Core::ComputeClient
- Defined in:
- lib/oraclebmc/core/compute_client.rb
Instance Attribute Summary collapse
-
#api_client ⇒ OracleBMC::ApiClient
readonly
Client used to make HTTP requests.
-
#endpoint ⇒ String
readonly
Fully qualified endpoint URL.
-
#region ⇒ String
The region, which will usually correspond to a value in Regions::REGION_ENUM.
Instance Method Summary collapse
-
#attach_volume(attach_volume_details, opts = {}) ⇒ Response
Attaches the specified storage volume to the specified instance.
-
#capture_console_history(capture_console_history_details, opts = {}) ⇒ Response
Captures the most recent serial console data (up to a megabyte) for the specified instance.
-
#create_image(create_image_details, opts = {}) ⇒ Response
Creates a boot disk image for the specified instance.
-
#delete_console_history(instance_console_history_id, opts = {}) ⇒ Response
Deletes the specified console history metadata and the console history data.
-
#delete_image(image_id, opts = {}) ⇒ Response
Deletes an image.
-
#detach_volume(volume_attachment_id, opts = {}) ⇒ Response
Detaches a storage volume from an instance.
-
#get_console_history(instance_console_history_id, opts = {}) ⇒ Response
Shows the metadata for the specified console history.
-
#get_console_history_content(instance_console_history_id, opts = {}) ⇒ Response
Gets the actual console history data (not the metadata).
-
#get_image(image_id, opts = {}) ⇒ Response
Gets the specified image.
-
#get_instance(instance_id, opts = {}) ⇒ Response
Gets information about the specified instance.
-
#get_volume_attachment(volume_attachment_id, opts = {}) ⇒ Response
Gets information about the specified volume attachment.
-
#get_windows_instance_initial_credentials(instance_id, opts = {}) ⇒ Response
Gets the generated credentials for the instance.
-
#initialize(config: nil, region: nil) ⇒ ComputeClient
constructor
Creates a new ComputeClient.
-
#instance_action(instance_id, action, opts = {}) ⇒ Response
Performs one of the power actions (start, stop, softreset, or reset) on the specified instance.
-
#launch_instance(launch_instance_details, opts = {}) ⇒ Response
Creates a new instance in the specified compartment and the specified Availability Domain.
-
#list_console_histories(compartment_id, opts = {}) ⇒ Response
Lists the console history metadata for the specified compartment or instance.
-
#list_images(compartment_id, opts = {}) ⇒ Response
Lists the available images in the specified compartment.
-
#list_instances(compartment_id, opts = {}) ⇒ Response
Lists the instances in the specified compartment and the specified Availability Domain.
-
#list_shapes(compartment_id, opts = {}) ⇒ Response
Lists the shapes that can be used to launch an instance within the specified compartment.
-
#list_vnic_attachments(compartment_id, opts = {}) ⇒ Response
Lists the VNIC attachments for the specified compartment.
-
#list_volume_attachments(compartment_id, opts = {}) ⇒ Response
Lists the volume attachments in the specified compartment.
-
#logger ⇒ Logger
The logger for this client.
-
#terminate_instance(instance_id, opts = {}) ⇒ Response
Terminates the specified instance.
-
#update_image(image_id, update_image_details, opts = {}) ⇒ Response
Updates the display name of the image.
-
#update_instance(instance_id, update_instance_details, opts = {}) ⇒ Response
Updates the display name of the specified instance.
Constructor Details
#initialize(config: nil, region: nil) ⇒ ComputeClient
Creates a new ComputeClient. If a config is not specified, then the global OracleBMC.config will be used.
A region must be specified in either the config or the region parameter. If specified in both, then the region parameter will be used.
32 33 34 35 36 37 38 39 |
# File 'lib/oraclebmc/core/compute_client.rb', line 32 def initialize(config:nil, region:nil) config ||= OracleBMC.config signer = Signer.new(config.user, config.fingerprint, config.tenancy, config.key_file, pass_phrase: config.pass_phrase) @api_client = ApiClient.new(config, signer) region ||= config.region self.region = region end |
Instance Attribute Details
#api_client ⇒ OracleBMC::ApiClient (readonly)
Client used to make HTTP requests.
12 13 14 |
# File 'lib/oraclebmc/core/compute_client.rb', line 12 def api_client @api_client end |
#endpoint ⇒ String (readonly)
Fully qualified endpoint URL
16 17 18 |
# File 'lib/oraclebmc/core/compute_client.rb', line 16 def endpoint @endpoint end |
#region ⇒ String
The region, which will usually correspond to a value in Regions::REGION_ENUM.
20 21 22 |
# File 'lib/oraclebmc/core/compute_client.rb', line 20 def region @region end |
Instance Method Details
#attach_volume(attach_volume_details, opts = {}) ⇒ Response
Attaches the specified storage volume to the specified instance.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/oraclebmc/core/compute_client.rb', line 70 def attach_volume(attach_volume_details, opts = {}) logger.debug "Calling operation ComputeClient#attach_volume." if logger fail "Missing the required parameter 'attach_volume_details' when calling attach_volume." if attach_volume_details.nil? path = "/volumeAttachments/" # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token'] post_body = @api_client.object_to_http_body(attach_volume_details) return @api_client.call_api( :POST, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::VolumeAttachment') end |
#capture_console_history(capture_console_history_details, opts = {}) ⇒ Response
Captures the most recent serial console data (up to a megabyte) for the specified instance.
The ‘CaptureConsoleHistory` operation works with the other console history operations as described below.
-
Use ‘CaptureConsoleHistory` to request the capture of up to a megabyte of the
most recent console history. This call returns a ‘ConsoleHistory` object. The object will have a state of REQUESTED.
-
Wait for the capture operation to succeed by polling ‘GetConsoleHistory` with
the identifier of the console history metadata. The state of the ‘ConsoleHistory` object will go from REQUESTED to GETTING-HISTORY and then SUCCEEDED (or FAILED).
-
Use ‘GetConsoleHistoryContent` to get the actual console history data (not the
metadata).
-
Optionally, use ‘DeleteConsoleHistory` to delete the console history metadata
and the console history data.
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/oraclebmc/core/compute_client.rb', line 125 def capture_console_history(capture_console_history_details, opts = {}) logger.debug "Calling operation ComputeClient#capture_console_history." if logger fail "Missing the required parameter 'capture_console_history_details' when calling capture_console_history." if capture_console_history_details.nil? path = "/instanceConsoleHistories/" # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token'] post_body = @api_client.object_to_http_body(capture_console_history_details) return @api_client.call_api( :POST, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::ConsoleHistory') end |
#create_image(create_image_details, opts = {}) ⇒ Response
Creates a boot disk image for the specified instance. For more information about images, see [Managing Custom Images](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm).
You must provide the OCID of the instance you want to use as the basis for the image, and the OCID of the compartment containing that instance.
You may optionally specify a *display name* for the image, which is simply a friendly name or description. It does not have to be unique, and you can change it. See update_image.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/oraclebmc/core/compute_client.rb', line 171 def create_image(create_image_details, opts = {}) logger.debug "Calling operation ComputeClient#create_image." if logger fail "Missing the required parameter 'create_image_details' when calling create_image." if create_image_details.nil? path = "/images/" # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token'] post_body = @api_client.object_to_http_body(create_image_details) return @api_client.call_api( :POST, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::Image') end |
#delete_console_history(instance_console_history_id, opts = {}) ⇒ Response
Deletes the specified console history metadata and the console history data.
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/oraclebmc/core/compute_client.rb', line 207 def delete_console_history(instance_console_history_id, opts = {}) logger.debug "Calling operation ComputeClient#delete_console_history." if logger fail "Missing the required parameter 'instance_console_history_id' when calling delete_console_history." if instance_console_history_id.nil? path = "/instanceConsoleHistories/{instanceConsoleHistoryId}".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match'] post_body = nil return @api_client.call_api( :DELETE, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body) end |
#delete_image(image_id, opts = {}) ⇒ Response
Deletes an image.
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/oraclebmc/core/compute_client.rb', line 242 def delete_image(image_id, opts = {}) logger.debug "Calling operation ComputeClient#delete_image." if logger fail "Missing the required parameter 'image_id' when calling delete_image." if image_id.nil? path = "/images/{imageId}".sub('{imageId}', image_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match'] post_body = nil return @api_client.call_api( :DELETE, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body) end |
#detach_volume(volume_attachment_id, opts = {}) ⇒ Response
Detaches a storage volume from an instance. You must specify the OCID of the volume attachment.
This is an asynchronous operation; the attachment’s ‘lifecycleState` will change to DETACHING temporarily until the attachment is completely removed.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/oraclebmc/core/compute_client.rb', line 281 def detach_volume(, opts = {}) logger.debug "Calling operation ComputeClient#detach_volume." if logger fail "Missing the required parameter 'volume_attachment_id' when calling detach_volume." if .nil? path = "/volumeAttachments/{volumeAttachmentId}".sub('{volumeAttachmentId}', .to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match'] post_body = nil return @api_client.call_api( :DELETE, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body) end |
#get_console_history(instance_console_history_id, opts = {}) ⇒ Response
Shows the metadata for the specified console history. See capture_console_history for details about using the console history operations.
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/oraclebmc/core/compute_client.rb', line 315 def get_console_history(instance_console_history_id, opts = {}) logger.debug "Calling operation ComputeClient#get_console_history." if logger fail "Missing the required parameter 'instance_console_history_id' when calling get_console_history." if instance_console_history_id.nil? path = "/instanceConsoleHistories/{instanceConsoleHistoryId}".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::ConsoleHistory') end |
#get_console_history_content(instance_console_history_id, opts = {}) ⇒ Response
Gets the actual console history data (not the metadata). See capture_console_history for details about using the console history operations.
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/oraclebmc/core/compute_client.rb', line 351 def get_console_history_content(instance_console_history_id, opts = {}) logger.debug "Calling operation ComputeClient#get_console_history_content." if logger fail "Missing the required parameter 'instance_console_history_id' when calling get_console_history_content." if instance_console_history_id.nil? path = "/instanceConsoleHistories/{instanceConsoleHistoryId}/data".sub('{instanceConsoleHistoryId}', instance_console_history_id.to_s) # Query Params query_params = {} query_params[:'offset'] = opts[:'offset'] if opts[:'offset'] query_params[:'length'] = opts[:'length'] if opts[:'length'] # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'String') end |
#get_image(image_id, opts = {}) ⇒ Response
Gets the specified image.
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/oraclebmc/core/compute_client.rb', line 384 def get_image(image_id, opts = {}) logger.debug "Calling operation ComputeClient#get_image." if logger fail "Missing the required parameter 'image_id' when calling get_image." if image_id.nil? path = "/images/{imageId}".sub('{imageId}', image_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::Image') end |
#get_instance(instance_id, opts = {}) ⇒ Response
Gets information about the specified instance.
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/oraclebmc/core/compute_client.rb', line 415 def get_instance(instance_id, opts = {}) logger.debug "Calling operation ComputeClient#get_instance." if logger fail "Missing the required parameter 'instance_id' when calling get_instance." if instance_id.nil? path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::Instance') end |
#get_volume_attachment(volume_attachment_id, opts = {}) ⇒ Response
Gets information about the specified volume attachment.
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
# File 'lib/oraclebmc/core/compute_client.rb', line 446 def (, opts = {}) logger.debug "Calling operation ComputeClient#get_volume_attachment." if logger fail "Missing the required parameter 'volume_attachment_id' when calling get_volume_attachment." if .nil? path = "/volumeAttachments/{volumeAttachmentId}".sub('{volumeAttachmentId}', .to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::VolumeAttachment') end |
#get_windows_instance_initial_credentials(instance_id, opts = {}) ⇒ Response
Gets the generated credentials for the instance. Only works for Windows instances. The returned credentials are only valid for the initial login.
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/oraclebmc/core/compute_client.rb', line 479 def get_windows_instance_initial_credentials(instance_id, opts = {}) logger.debug "Calling operation ComputeClient#get_windows_instance_initial_credentials." if logger fail "Missing the required parameter 'instance_id' when calling get_windows_instance_initial_credentials." if instance_id.nil? path = "/instances/{instanceId}/initialCredentials".sub('{instanceId}', instance_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::InstanceCredentials') end |
#instance_action(instance_id, action, opts = {}) ⇒ Response
Performs one of the power actions (start, stop, softreset, or reset) on the specified instance.
start - power on
stop - power off
softreset - ACPI shutdown and power on
reset - power off and power on
Note that the stop state has no effect on the resources you consume. Billing continues for instances that you stop, and related resources continue to apply against any relevant quotas. You must terminate an instance (terminate_instance) to remove its resources from billing and quotas.
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'lib/oraclebmc/core/compute_client.rb', line 537 def instance_action(instance_id, action, opts = {}) logger.debug "Calling operation ComputeClient#instance_action." if logger fail "Missing the required parameter 'instance_id' when calling instance_action." if instance_id.nil? fail "Missing the required parameter 'action' when calling instance_action." if action.nil? unless ['STOP', 'START', 'SOFTRESET', 'RESET'].include?(action) fail "Invalid value for 'action', must be one of STOP, START, SOFTRESET, RESET." end path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s) # Query Params query_params = {} query_params[:'action'] = action # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token'] header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match'] post_body = nil return @api_client.call_api( :POST, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::Instance') end |
#launch_instance(launch_instance_details, opts = {}) ⇒ Response
Creates a new instance in the specified compartment and the specified Availability Domain. For general information about instances, see [Overview of the Compute Service](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Concepts/computeoverview.htm).
For information about access control and compartments, see [Overview of the IAM Service](docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm).
For information about Availability Domains, see [Regions and Availability Domains](docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). To get a list of Availability Domains, use the ‘ListAvailabilityDomains` operation in the Identity and Access Management Service API.
All Oracle Bare Metal Cloud Services resources, including instances, get an Oracle-assigned, unique ID called an Oracle Cloud Identifier (OCID). When you create a resource, you can find its OCID in the response. You can also retrieve a resource’s OCID by using a List API operation on that resource type, or by viewing the resource in the Console.
When you launch an instance, it is automatically attached to a Virtual Network Interface Card (VNIC) and given both a public and private IP address. To get both addresses, use the list_vnic_attachments operation to get the VNIC ID for the instance, and then call get_vnic with the VNIC ID.
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
# File 'lib/oraclebmc/core/compute_client.rb', line 604 def launch_instance(launch_instance_details, opts = {}) logger.debug "Calling operation ComputeClient#launch_instance." if logger fail "Missing the required parameter 'launch_instance_details' when calling launch_instance." if launch_instance_details.nil? path = "/instances/" # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token'] post_body = @api_client.object_to_http_body(launch_instance_details) return @api_client.call_api( :POST, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::Instance') end |
#list_console_histories(compartment_id, opts = {}) ⇒ Response
Lists the console history metadata for the specified compartment or instance.
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/oraclebmc/core/compute_client.rb', line 648 def list_console_histories(compartment_id, opts = {}) logger.debug "Calling operation ComputeClient#list_console_histories." if logger fail "Missing the required parameter 'compartment_id' when calling list_console_histories." if compartment_id.nil? path = "/instanceConsoleHistories/" # Query Params query_params = {} query_params[:'compartmentId'] = compartment_id query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain'] query_params[:'limit'] = opts[:'limit'] if opts[:'limit'] query_params[:'page'] = opts[:'page'] if opts[:'page'] query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id'] # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'Array<OracleBMC::Core::Models::ConsoleHistory>') end |
#list_images(compartment_id, opts = {}) ⇒ Response
Lists the available images in the specified compartment. For more information about images, see [Managing Custom Images](docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm).
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
# File 'lib/oraclebmc/core/compute_client.rb', line 705 def list_images(compartment_id, opts = {}) logger.debug "Calling operation ComputeClient#list_images." if logger fail "Missing the required parameter 'compartment_id' when calling list_images." if compartment_id.nil? path = "/images/" # Query Params query_params = {} query_params[:'compartmentId'] = compartment_id query_params[:'displayName'] = opts[:'display_name'] if opts[:'display_name'] query_params[:'operatingSystem'] = opts[:'operating_system'] if opts[:'operating_system'] query_params[:'operatingSystemVersion'] = opts[:'operating_system_version'] if opts[:'operating_system_version'] query_params[:'limit'] = opts[:'limit'] if opts[:'limit'] query_params[:'page'] = opts[:'page'] if opts[:'page'] # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'Array<OracleBMC::Core::Models::Image>') end |
#list_instances(compartment_id, opts = {}) ⇒ Response
Lists the instances in the specified compartment and the specified Availability Domain. You can filter the results by specifying an instance name (the list will include all the identically-named instances in the compartment).
759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'lib/oraclebmc/core/compute_client.rb', line 759 def list_instances(compartment_id, opts = {}) logger.debug "Calling operation ComputeClient#list_instances." if logger fail "Missing the required parameter 'compartment_id' when calling list_instances." if compartment_id.nil? path = "/instances/" # Query Params query_params = {} query_params[:'compartmentId'] = compartment_id query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain'] query_params[:'displayName'] = opts[:'display_name'] if opts[:'display_name'] query_params[:'limit'] = opts[:'limit'] if opts[:'limit'] query_params[:'page'] = opts[:'page'] if opts[:'page'] # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'Array<OracleBMC::Core::Models::Instance>') end |
#list_shapes(compartment_id, opts = {}) ⇒ Response
Lists the shapes that can be used to launch an instance within the specified compartment. You can filter the list by compatibility with a specific image.
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
# File 'lib/oraclebmc/core/compute_client.rb', line 808 def list_shapes(compartment_id, opts = {}) logger.debug "Calling operation ComputeClient#list_shapes." if logger fail "Missing the required parameter 'compartment_id' when calling list_shapes." if compartment_id.nil? path = "/shapes" # Query Params query_params = {} query_params[:'compartmentId'] = compartment_id query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain'] query_params[:'limit'] = opts[:'limit'] if opts[:'limit'] query_params[:'page'] = opts[:'page'] if opts[:'page'] query_params[:'imageId'] = opts[:'image_id'] if opts[:'image_id'] # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'Array<OracleBMC::Core::Models::Shape>') end |
#list_vnic_attachments(compartment_id, opts = {}) ⇒ Response
Lists the VNIC attachments for the specified compartment. The list can be filtered by instance and by VNIC.
858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 |
# File 'lib/oraclebmc/core/compute_client.rb', line 858 def (compartment_id, opts = {}) logger.debug "Calling operation ComputeClient#list_vnic_attachments." if logger fail "Missing the required parameter 'compartment_id' when calling list_vnic_attachments." if compartment_id.nil? path = "/vnicAttachments/" # Query Params query_params = {} query_params[:'compartmentId'] = compartment_id query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain'] query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id'] query_params[:'limit'] = opts[:'limit'] if opts[:'limit'] query_params[:'page'] = opts[:'page'] if opts[:'page'] query_params[:'vnicId'] = opts[:'vnic_id'] if opts[:'vnic_id'] # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'Array<OracleBMC::Core::Models::VnicAttachment>') end |
#list_volume_attachments(compartment_id, opts = {}) ⇒ Response
Lists the volume attachments in the specified compartment. You can filter the list by specifying an instance OCID, volume OCID, or both.
Currently, the only supported volume attachment type is IScsiVolumeAttachment.
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 |
# File 'lib/oraclebmc/core/compute_client.rb', line 911 def (compartment_id, opts = {}) logger.debug "Calling operation ComputeClient#list_volume_attachments." if logger fail "Missing the required parameter 'compartment_id' when calling list_volume_attachments." if compartment_id.nil? path = "/volumeAttachments/" # Query Params query_params = {} query_params[:'compartmentId'] = compartment_id query_params[:'availabilityDomain'] = opts[:'availability_domain'] if opts[:'availability_domain'] query_params[:'limit'] = opts[:'limit'] if opts[:'limit'] query_params[:'page'] = opts[:'page'] if opts[:'page'] query_params[:'instanceId'] = opts[:'instance_id'] if opts[:'instance_id'] query_params[:'volumeId'] = opts[:'volume_id'] if opts[:'volume_id'] # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' post_body = nil return @api_client.call_api( :GET, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'Array<OracleBMC::Core::Models::VolumeAttachment>') end |
#logger ⇒ Logger
Returns The logger for this client. May be nil.
54 55 56 |
# File 'lib/oraclebmc/core/compute_client.rb', line 54 def logger @api_client.config.logger end |
#terminate_instance(instance_id, opts = {}) ⇒ Response
Terminates the specified instance. Any attached VNICs and volumes are automatically detached when the instance terminates.
This is an asynchronous operation; the instance’s ‘lifecycleState` will change to TERMINATING temporarily until the instance is completely removed.
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 |
# File 'lib/oraclebmc/core/compute_client.rb', line 957 def terminate_instance(instance_id, opts = {}) logger.debug "Calling operation ComputeClient#terminate_instance." if logger fail "Missing the required parameter 'instance_id' when calling terminate_instance." if instance_id.nil? path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match'] post_body = nil return @api_client.call_api( :DELETE, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body) end |
#update_image(image_id, update_image_details, opts = {}) ⇒ Response
Updates the display name of the image.
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 |
# File 'lib/oraclebmc/core/compute_client.rb', line 999 def update_image(image_id, update_image_details, opts = {}) logger.debug "Calling operation ComputeClient#update_image." if logger fail "Missing the required parameter 'image_id' when calling update_image." if image_id.nil? fail "Missing the required parameter 'update_image_details' when calling update_image." if update_image_details.nil? path = "/images/{imageId}".sub('{imageId}', image_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token'] header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match'] post_body = @api_client.object_to_http_body(update_image_details) return @api_client.call_api( :PUT, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::Image') end |
#update_instance(instance_id, update_instance_details, opts = {}) ⇒ Response
Updates the display name of the specified instance. The OCID of the instance remains the same.
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
# File 'lib/oraclebmc/core/compute_client.rb', line 1046 def update_instance(instance_id, update_instance_details, opts = {}) logger.debug "Calling operation ComputeClient#update_instance." if logger fail "Missing the required parameter 'instance_id' when calling update_instance." if instance_id.nil? fail "Missing the required parameter 'update_instance_details' when calling update_instance." if update_instance_details.nil? path = "/instances/{instanceId}".sub('{instanceId}', instance_id.to_s) # Query Params query_params = {} # Header Params header_params = {} header_params['accept'] = 'application/json' header_params['content-type'] = 'application/json' header_params[:'opc-retry-token'] = opts[:'opc_retry_token'] if opts[:'opc_retry_token'] header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match'] post_body = @api_client.object_to_http_body(update_instance_details) return @api_client.call_api( :PUT, path, endpoint, :header_params => header_params, :query_params => query_params, :body => post_body, :return_type => 'OracleBMC::Core::Models::Instance') end |