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.
-
#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.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/oraclebmc/core/compute_client.rb', line 74 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.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/oraclebmc/core/compute_client.rb', line 129 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.
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/oraclebmc/core/compute_client.rb', line 175 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.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/oraclebmc/core/compute_client.rb', line 211 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.
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/oraclebmc/core/compute_client.rb', line 246 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.
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/oraclebmc/core/compute_client.rb', line 285 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.
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/oraclebmc/core/compute_client.rb', line 319 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.
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/oraclebmc/core/compute_client.rb', line 355 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.
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/oraclebmc/core/compute_client.rb', line 388 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.
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/oraclebmc/core/compute_client.rb', line 419 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.
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/oraclebmc/core/compute_client.rb', line 450 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 |
#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.
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
# File 'lib/oraclebmc/core/compute_client.rb', line 508 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.
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
# File 'lib/oraclebmc/core/compute_client.rb', line 578 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 = {} query_params[:'opc-host-serial'] = opts[:'opc_host_serial'] if opts[:'opc_host_serial'] query_params[:'opc-pool-name'] = opts[:'opc_pool_name'] if opts[:'opc_pool_name'] query_params[:'opc-vnic-id'] = opts[:'opc_vnic_id'] if opts[:'opc_vnic_id'] # 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.
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 |
# File 'lib/oraclebmc/core/compute_client.rb', line 625 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).
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 |
# File 'lib/oraclebmc/core/compute_client.rb', line 682 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).
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 |
# File 'lib/oraclebmc/core/compute_client.rb', line 736 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.
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
# File 'lib/oraclebmc/core/compute_client.rb', line 785 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.
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 |
# File 'lib/oraclebmc/core/compute_client.rb', line 835 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.
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 |
# File 'lib/oraclebmc/core/compute_client.rb', line 888 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.
58 59 60 |
# File 'lib/oraclebmc/core/compute_client.rb', line 58 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.
934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
# File 'lib/oraclebmc/core/compute_client.rb', line 934 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.
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 |
# File 'lib/oraclebmc/core/compute_client.rb', line 976 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.
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 |
# File 'lib/oraclebmc/core/compute_client.rb', line 1023 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 |