Class: Google::Cloud::Compute::V1::Instances::Rest::Client
- Inherits:
-
Object
- Object
- Google::Cloud::Compute::V1::Instances::Rest::Client
- Defined in:
- lib/google/cloud/compute/v1/instances/rest/client.rb
Overview
REST client for the Instances service.
The Instances API.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#zone_operations ⇒ ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client
readonly
Get the associated client for long-running operations via ZoneOperations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the Instances Client class.
Instance Method Summary collapse
-
#add_access_config(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Adds an access config to an instance's network interface.
-
#add_resource_policies(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Adds existing resource policies to an instance.
-
#aggregated_list(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList>
Retrieves an aggregated list of all of the instances in your project across all regions and zones.
-
#attach_disk(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Attaches an existing Disk resource to an instance.
-
#bulk_insert(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Creates multiple instances.
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the Instances Client instance.
-
#delete(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Deletes the specified Instance resource.
-
#delete_access_config(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Deletes an access config from an instance's network interface.
-
#detach_disk(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Detaches a disk from an instance.
-
#get(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::Instance
Returns the specified Instance resource.
-
#get_effective_firewalls(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::InstancesGetEffectiveFirewallsResponse
Returns effective firewalls applied to an interface of the instance.
-
#get_guest_attributes(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::GuestAttributes
Returns the specified guest attributes entry.
-
#get_iam_policy(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::Policy
Gets the access control policy for a resource.
-
#get_screenshot(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::Screenshot
Returns the screenshot from the specified instance.
-
#get_serial_port_output(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::SerialPortOutput
Returns the last 1 MB of serial port output from the specified instance.
-
#get_shielded_instance_identity(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::ShieldedInstanceIdentity
Returns the Shielded Instance Identity of an instance.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new Instances REST client object.
-
#insert(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Creates an instance resource in the specified project using the data included in the request.
-
#list(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Instance>
Retrieves the list of instances contained within the specified zone.
-
#list_referrers(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Reference>
Retrieves a list of resources that refer to the VM instance specified in the request.
-
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#perform_maintenance(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Perform a manual maintenance on the instance.
-
#remove_resource_policies(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Removes resource policies from an instance.
-
#reset(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Performs a reset on the instance.
-
#resume(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Resumes an instance that was suspended using the instances().suspend method.
-
#send_diagnostic_interrupt(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceResponse
Sends diagnostic interrupt to the instance.
-
#set_deletion_protection(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets deletion protection on the instance.
-
#set_disk_auto_delete(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets the auto-delete flag for a disk attached to an instance.
-
#set_iam_policy(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::Policy
Sets the access control policy on the specified resource.
-
#set_labels(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets labels on an instance.
-
#set_machine_resources(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
-
#set_machine_type(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Changes the machine type for a stopped instance to the machine type specified in the request.
-
#set_metadata(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets metadata for the specified instance to the data included in the request.
-
#set_min_cpu_platform(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Changes the minimum CPU platform that this instance should use.
-
#set_name(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets name of an instance.
-
#set_scheduling(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets an instance's scheduling options.
-
#set_security_policy(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets the Google Cloud Armor security policy for the specified instance.
-
#set_service_account(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets the service account on the instance.
-
#set_shielded_instance_integrity_policy(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets the Shielded Instance integrity policy for an instance.
-
#set_tags(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets network tags for the specified instance to the data included in the request.
-
#simulate_maintenance_event(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Simulates a host maintenance event on a VM.
-
#start(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Starts an instance that was stopped using the instances().stop method.
-
#start_with_encryption_key(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Starts an instance that was stopped using the instances().stop method.
-
#stop(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time.
-
#suspend(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time.
-
#test_iam_permissions(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::TestPermissionsResponse
Returns permissions that a caller has on the specified resource.
-
#universe_domain ⇒ String
The effective universe domain.
-
#update(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Updates an instance only if the necessary resources are available.
-
#update_access_config(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Updates the specified access config from an instance's network interface with the data included in the request.
-
#update_display_device(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Updates the Display config for a VM instance.
-
#update_network_interface(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Updates an instance's network interface.
-
#update_shielded_instance_config(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Updates the Shielded Instance config for an instance.
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new Instances REST client object.
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 251 def initialize # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint.nil? || (@config.endpoint == Configuration::DEFAULT_ENDPOINT && !@config.endpoint.split(".").first.include?("-")) credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @zone_operations = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint config.universe_domain = @config.universe_domain end @instances_stub = ::Google::Cloud::Compute::V1::Instances::Rest::ServiceStub.new( endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, credentials: credentials, logger: @config.logger ) @instances_stub.logger(stub: true)&.info do |entry| entry.set_system_name entry.set_service entry. = "Created client for #{entry.service}" entry.set_credentials_fields credentials entry.set "customEndpoint", @config.endpoint if @config.endpoint entry.set "defaultTimeout", @config.timeout if @config.timeout entry.set "quotaProject", @quota_project_id if @quota_project_id end end |
Instance Attribute Details
#zone_operations ⇒ ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client (readonly)
Get the associated client for long-running operations via ZoneOperations.
305 306 307 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 305 def zone_operations @zone_operations end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the Instances Client class.
See Configuration for a description of the configuration fields.
63 64 65 66 67 68 69 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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 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 198 199 200 201 202 203 204 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 63 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Compute", "V1"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.rpcs.add_access_config.timeout = 600.0 default_config.rpcs.add_resource_policies.timeout = 600.0 default_config.rpcs.aggregated_list.timeout = 600.0 default_config.rpcs.aggregated_list.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.attach_disk.timeout = 600.0 default_config.rpcs.bulk_insert.timeout = 600.0 default_config.rpcs.delete.timeout = 600.0 default_config.rpcs.delete_access_config.timeout = 600.0 default_config.rpcs.detach_disk.timeout = 600.0 default_config.rpcs.get.timeout = 600.0 default_config.rpcs.get.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_effective_firewalls.timeout = 600.0 default_config.rpcs.get_effective_firewalls.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_guest_attributes.timeout = 600.0 default_config.rpcs.get_guest_attributes.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_iam_policy.timeout = 600.0 default_config.rpcs.get_iam_policy.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_screenshot.timeout = 600.0 default_config.rpcs.get_screenshot.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_serial_port_output.timeout = 600.0 default_config.rpcs.get_serial_port_output.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_shielded_instance_identity.timeout = 600.0 default_config.rpcs.get_shielded_instance_identity.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.insert.timeout = 600.0 default_config.rpcs.list.timeout = 600.0 default_config.rpcs.list.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.list_referrers.timeout = 600.0 default_config.rpcs.list_referrers.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.perform_maintenance.timeout = 600.0 default_config.rpcs.remove_resource_policies.timeout = 600.0 default_config.rpcs.reset.timeout = 600.0 default_config.rpcs.resume.timeout = 600.0 default_config.rpcs.send_diagnostic_interrupt.timeout = 600.0 default_config.rpcs.set_deletion_protection.timeout = 600.0 default_config.rpcs.set_disk_auto_delete.timeout = 600.0 default_config.rpcs.set_iam_policy.timeout = 600.0 default_config.rpcs.set_labels.timeout = 600.0 default_config.rpcs.set_machine_resources.timeout = 600.0 default_config.rpcs.set_machine_type.timeout = 600.0 default_config.rpcs..timeout = 600.0 default_config.rpcs.set_min_cpu_platform.timeout = 600.0 default_config.rpcs.set_name.timeout = 600.0 default_config.rpcs.set_scheduling.timeout = 600.0 default_config.rpcs.set_security_policy.timeout = 600.0 default_config.rpcs.set_service_account.timeout = 600.0 default_config.rpcs.set_shielded_instance_integrity_policy.timeout = 600.0 default_config.rpcs..timeout = 600.0 default_config.rpcs.simulate_maintenance_event.timeout = 600.0 default_config.rpcs.start.timeout = 600.0 default_config.rpcs.start_with_encryption_key.timeout = 600.0 default_config.rpcs.stop.timeout = 600.0 default_config.rpcs.suspend.timeout = 600.0 default_config.rpcs..timeout = 600.0 default_config.rpcs.update.timeout = 600.0 default_config.rpcs.update_access_config.timeout = 600.0 default_config.rpcs.update_display_device.timeout = 600.0 default_config.rpcs.update_network_interface.timeout = 600.0 default_config.rpcs.update_shielded_instance_config.timeout = 600.0 default_config end yield @configure if block_given? @configure end |
Instance Method Details
#add_access_config(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #add_access_config(access_config_resource: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Adds an access config to an instance's network interface.
371 372 373 374 375 376 377 378 379 380 381 382 383 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 410 411 412 413 414 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 371 def add_access_config request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::AddAccessConfigInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.add_access_config..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.add_access_config.timeout, metadata: , retry_policy: @config.rpcs.add_access_config.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.add_access_config request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#add_resource_policies(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #add_resource_policies(instance: nil, instances_add_resource_policies_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
467 468 469 470 471 472 473 474 475 476 477 478 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 505 506 507 508 509 510 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 467 def add_resource_policies request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::AddResourcePoliciesInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.add_resource_policies..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.add_resource_policies.timeout, metadata: , retry_policy: @config.rpcs.add_resource_policies.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.add_resource_policies request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#aggregated_list(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList> #aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, service_project_number: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::String, ::Google::Cloud::Compute::V1::InstancesScopedList>
Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. To prevent failure, Google recommends that you set the returnPartialSuccess
parameter to true
.
569 570 571 572 573 574 575 576 577 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 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 569 def aggregated_list request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::AggregatedListInstancesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.aggregated_list..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.aggregated_list.timeout, metadata: , retry_policy: @config.rpcs.aggregated_list.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.aggregated_list request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @instances_stub, :aggregated_list, "items", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#attach_disk(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #attach_disk(attached_disk_resource: nil, force_attach: nil, instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 659 def attach_disk request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::AttachDiskInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.attach_disk..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.attach_disk.timeout, metadata: , retry_policy: @config.rpcs.attach_disk.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.attach_disk request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#bulk_insert(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #bulk_insert(bulk_insert_instance_resource_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
753 754 755 756 757 758 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 790 791 792 793 794 795 796 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 753 def bulk_insert request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::BulkInsertInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.bulk_insert..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.bulk_insert.timeout, metadata: , retry_policy: @config.rpcs.bulk_insert.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.bulk_insert request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#configure {|config| ... } ⇒ Client::Configuration
Configure the Instances Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.
See Configuration for a description of the configuration fields.
221 222 223 224 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 221 def configure yield @config if block_given? @config end |
#delete(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #delete(instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Deletes the specified Instance resource. For more information, see Deleting an instance.
847 848 849 850 851 852 853 854 855 856 857 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 890 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 847 def delete request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DeleteInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete.timeout, metadata: , retry_policy: @config.rpcs.delete.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.delete request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_access_config(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #delete_access_config(access_config: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Deletes an access config from an instance's network interface.
945 946 947 948 949 950 951 952 953 954 955 956 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 983 984 985 986 987 988 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 945 def delete_access_config request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DeleteAccessConfigInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_access_config..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_access_config.timeout, metadata: , retry_policy: @config.rpcs.delete_access_config.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.delete_access_config request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#detach_disk(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #detach_disk(device_name: nil, instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Detaches a disk from an instance.
1041 1042 1043 1044 1045 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 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1041 def detach_disk request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DetachDiskInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.detach_disk..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.detach_disk.timeout, metadata: , retry_policy: @config.rpcs.detach_disk.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.detach_disk request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::Instance #get(instance: nil, project: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::Instance
Returns the specified Instance resource.
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1133 def get request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get.timeout, metadata: , retry_policy: @config.rpcs.get.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.get request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_effective_firewalls(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::InstancesGetEffectiveFirewallsResponse #get_effective_firewalls(instance: nil, network_interface: nil, project: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::InstancesGetEffectiveFirewallsResponse
Returns effective firewalls applied to an interface of the instance.
1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1217 def get_effective_firewalls request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetEffectiveFirewallsInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_effective_firewalls..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_effective_firewalls.timeout, metadata: , retry_policy: @config.rpcs.get_effective_firewalls.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.get_effective_firewalls request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_guest_attributes(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::GuestAttributes #get_guest_attributes(instance: nil, project: nil, query_path: nil, variable_key: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::GuestAttributes
Returns the specified guest attributes entry.
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1303 def get_guest_attributes request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetGuestAttributesInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_guest_attributes..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_guest_attributes.timeout, metadata: , retry_policy: @config.rpcs.get_guest_attributes.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.get_guest_attributes request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_iam_policy(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::Policy #get_iam_policy(options_requested_policy_version: nil, project: nil, resource: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::Policy
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1387 def get_iam_policy request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetIamPolicyInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_iam_policy..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_iam_policy.timeout, metadata: , retry_policy: @config.rpcs.get_iam_policy.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.get_iam_policy request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_screenshot(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::Screenshot #get_screenshot(instance: nil, project: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::Screenshot
Returns the screenshot from the specified instance.
1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1469 def get_screenshot request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetScreenshotInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_screenshot..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_screenshot.timeout, metadata: , retry_policy: @config.rpcs.get_screenshot.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.get_screenshot request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_serial_port_output(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::SerialPortOutput #get_serial_port_output(instance: nil, port: nil, project: nil, start: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::SerialPortOutput
Returns the last 1 MB of serial port output from the specified instance.
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1555 def get_serial_port_output request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetSerialPortOutputInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_serial_port_output..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_serial_port_output.timeout, metadata: , retry_policy: @config.rpcs.get_serial_port_output.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.get_serial_port_output request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_shielded_instance_identity(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::ShieldedInstanceIdentity #get_shielded_instance_identity(instance: nil, project: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::ShieldedInstanceIdentity
Returns the Shielded Instance Identity of an instance
1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1637 def get_shielded_instance_identity request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetShieldedInstanceIdentityInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_shielded_instance_identity..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_shielded_instance_identity.timeout, metadata: , retry_policy: @config.rpcs.get_shielded_instance_identity.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.get_shielded_instance_identity request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#insert(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #insert(instance_resource: nil, project: nil, request_id: nil, source_instance_template: nil, source_machine_image: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Creates an instance resource in the specified project using the data included in the request.
1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1725 def insert request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::InsertInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.insert..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.insert.timeout, metadata: , retry_policy: @config.rpcs.insert.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.insert request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Instance> #list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Instance>
Retrieves the list of instances contained within the specified zone.
1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1825 def list request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListInstancesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list.timeout, metadata: , retry_policy: @config.rpcs.list.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.list request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @instances_stub, :list, "items", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_referrers(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Reference> #list_referrers(filter: nil, instance: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Reference>
Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 1919 def list_referrers request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListReferrersInstancesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_referrers..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_referrers.timeout, metadata: , retry_policy: @config.rpcs.list_referrers.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.list_referrers request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @instances_stub, :list_referrers, "items", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#logger ⇒ Logger
The logger used for request/response debug logging.
312 313 314 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 312 def logger @instances_stub.logger end |
#perform_maintenance(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #perform_maintenance(instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Perform a manual maintenance on the instance.
2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2005 def perform_maintenance request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::PerformMaintenanceInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.perform_maintenance..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.perform_maintenance.timeout, metadata: , retry_policy: @config.rpcs.perform_maintenance.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.perform_maintenance request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#remove_resource_policies(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #remove_resource_policies(instance: nil, instances_remove_resource_policies_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Removes resource policies from an instance.
2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2101 def remove_resource_policies request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::RemoveResourcePoliciesInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.remove_resource_policies..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.remove_resource_policies.timeout, metadata: , retry_policy: @config.rpcs.remove_resource_policies.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.remove_resource_policies request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#reset(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #reset(instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2195 def reset request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ResetInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.reset..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.reset.timeout, metadata: , retry_policy: @config.rpcs.reset.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.reset request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#resume(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #resume(instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Resumes an instance that was suspended using the instances().suspend method.
2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2289 def resume request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ResumeInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.resume..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.resume.timeout, metadata: , retry_policy: @config.rpcs.resume.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.resume request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#send_diagnostic_interrupt(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceResponse #send_diagnostic_interrupt(instance: nil, project: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceResponse
Sends diagnostic interrupt to the instance.
2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2381 def send_diagnostic_interrupt request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SendDiagnosticInterruptInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.send_diagnostic_interrupt..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.send_diagnostic_interrupt.timeout, metadata: , retry_policy: @config.rpcs.send_diagnostic_interrupt.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.send_diagnostic_interrupt request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_deletion_protection(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_deletion_protection(deletion_protection: nil, project: nil, request_id: nil, resource: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets deletion protection on the instance.
2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2467 def set_deletion_protection request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetDeletionProtectionInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_deletion_protection..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_deletion_protection.timeout, metadata: , retry_policy: @config.rpcs.set_deletion_protection.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_deletion_protection request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_disk_auto_delete(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_disk_auto_delete(auto_delete: nil, device_name: nil, instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets the auto-delete flag for a disk attached to an instance.
2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2565 def set_disk_auto_delete request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetDiskAutoDeleteInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_disk_auto_delete..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_disk_auto_delete.timeout, metadata: , retry_policy: @config.rpcs.set_disk_auto_delete.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_disk_auto_delete request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_iam_policy(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::Policy #set_iam_policy(project: nil, resource: nil, zone: nil, zone_set_policy_request_resource: nil) ⇒ ::Google::Cloud::Compute::V1::Policy
Sets the access control policy on the specified resource. Replaces any existing policy.
2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2659 def set_iam_policy request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetIamPolicyInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_iam_policy..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_iam_policy.timeout, metadata: , retry_policy: @config.rpcs.set_iam_policy.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_iam_policy request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_labels(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_labels(instance: nil, instances_set_labels_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2745 def set_labels request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetLabelsInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_labels..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_labels.timeout, metadata: , retry_policy: @config.rpcs.set_labels.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_labels request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_machine_resources(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_machine_resources(instance: nil, instances_set_machine_resources_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2841 def set_machine_resources request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetMachineResourcesInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_machine_resources..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_machine_resources.timeout, metadata: , retry_policy: @config.rpcs.set_machine_resources.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_machine_resources request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_machine_type(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_machine_type(instance: nil, instances_set_machine_type_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Changes the machine type for a stopped instance to the machine type specified in the request.
2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 2937 def set_machine_type request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetMachineTypeInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_machine_type..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_machine_type.timeout, metadata: , retry_policy: @config.rpcs.set_machine_type.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_machine_type request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_metadata(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_metadata(instance: nil, metadata_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets metadata for the specified instance to the data included in the request.
3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3033 def request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetMetadataInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs...to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs..timeout, metadata: , retry_policy: @config.rpcs..retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub. request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_min_cpu_platform(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_min_cpu_platform(instance: nil, instances_set_min_cpu_platform_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3129 def set_min_cpu_platform request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetMinCpuPlatformInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_min_cpu_platform..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_min_cpu_platform.timeout, metadata: , retry_policy: @config.rpcs.set_min_cpu_platform.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_min_cpu_platform request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_name(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_name(instance: nil, instances_set_name_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets name of an instance.
3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3225 def set_name request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetNameInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_name..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_name.timeout, metadata: , retry_policy: @config.rpcs.set_name.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_name request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_scheduling(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_scheduling(instance: nil, project: nil, request_id: nil, scheduling_resource: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED
state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.
3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3321 def set_scheduling request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetSchedulingInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_scheduling..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_scheduling.timeout, metadata: , retry_policy: @config.rpcs.set_scheduling.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_scheduling request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_security_policy(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_security_policy(instance: nil, instances_set_security_policy_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview
3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3417 def set_security_policy request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetSecurityPolicyInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_security_policy..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_security_policy.timeout, metadata: , retry_policy: @config.rpcs.set_security_policy.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_security_policy request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_service_account(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_service_account(instance: nil, instances_set_service_account_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3513 def set_service_account request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetServiceAccountInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_service_account..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_service_account.timeout, metadata: , retry_policy: @config.rpcs.set_service_account.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_service_account request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_shielded_instance_integrity_policy(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_shielded_instance_integrity_policy(instance: nil, project: nil, request_id: nil, shielded_instance_integrity_policy_resource: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3609 def set_shielded_instance_integrity_policy request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetShieldedInstanceIntegrityPolicyInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_shielded_instance_integrity_policy..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_shielded_instance_integrity_policy.timeout, metadata: , retry_policy: @config.rpcs.set_shielded_instance_integrity_policy.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.set_shielded_instance_integrity_policy request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_tags(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_tags(instance: nil, project: nil, request_id: nil, tags_resource: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets network tags for the specified instance to the data included in the request.
3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3705 def request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetTagsInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs...to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs..timeout, metadata: , retry_policy: @config.rpcs..retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub. request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#simulate_maintenance_event(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #simulate_maintenance_event(instance: nil, project: nil, request_id: nil, with_extended_notifications: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3801 def simulate_maintenance_event request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SimulateMaintenanceEventInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.simulate_maintenance_event..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.simulate_maintenance_event.timeout, metadata: , retry_policy: @config.rpcs.simulate_maintenance_event.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.simulate_maintenance_event request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#start(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #start(instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3895 def start request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::StartInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.start..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.start.timeout, metadata: , retry_policy: @config.rpcs.start.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.start request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#start_with_encryption_key(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #start_with_encryption_key(instance: nil, instances_start_with_encryption_key_request_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 3991 def start_with_encryption_key request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::StartWithEncryptionKeyInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.start_with_encryption_key..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.start_with_encryption_key.timeout, metadata: , retry_policy: @config.rpcs.start_with_encryption_key.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.start_with_encryption_key request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#stop(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #stop(discard_local_ssd: nil, instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 4087 def stop request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::StopInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.stop..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.stop.timeout, metadata: , retry_policy: @config.rpcs.stop.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.stop request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#suspend(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #suspend(discard_local_ssd: nil, instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 4183 def suspend request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SuspendInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.suspend..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.suspend.timeout, metadata: , retry_policy: @config.rpcs.suspend.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.suspend request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#test_iam_permissions(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::TestPermissionsResponse #test_iam_permissions(project: nil, resource: nil, test_permissions_request_resource: nil, zone: nil) ⇒ ::Google::Cloud::Compute::V1::TestPermissionsResponse
Returns permissions that a caller has on the specified resource.
4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 4277 def request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::TestIamPermissionsInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs...to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs..timeout, metadata: , retry_policy: @config.rpcs..retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub. request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
231 232 233 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 231 def universe_domain @instances_stub.universe_domain end |
#update(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #update(instance: nil, instance_resource: nil, minimal_action: nil, most_disruptive_allowed_action: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 4369 def update request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::UpdateInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update.timeout, metadata: , retry_policy: @config.rpcs.update.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.update request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#update_access_config(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #update_access_config(access_config_resource: nil, instance: nil, network_interface: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 4467 def update_access_config request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::UpdateAccessConfigInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_access_config..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update_access_config.timeout, metadata: , retry_policy: @config.rpcs.update_access_config.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.update_access_config request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#update_display_device(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #update_display_device(display_device_resource: nil, instance: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 4563 def update_display_device request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::UpdateDisplayDeviceInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_display_device..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update_display_device.timeout, metadata: , retry_policy: @config.rpcs.update_display_device.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.update_display_device request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#update_network_interface(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #update_network_interface(instance: nil, network_interface: nil, network_interface_resource: nil, project: nil, request_id: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 4661 def update_network_interface request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::UpdateNetworkInterfaceInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_network_interface..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update_network_interface.timeout, metadata: , retry_policy: @config.rpcs.update_network_interface.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.update_network_interface request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#update_shielded_instance_config(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #update_shielded_instance_config(instance: nil, project: nil, request_id: nil, shielded_instance_config_resource: nil, zone: nil) ⇒ ::Gapic::GenericLRO::Operation
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 |
# File 'lib/google/cloud/compute/v1/instances/rest/client.rb', line 4757 def update_shielded_instance_config request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::UpdateShieldedInstanceConfigInstanceRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_shielded_instance_config..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Compute::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update_shielded_instance_config.timeout, metadata: , retry_policy: @config.rpcs.update_shielded_instance_config.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @instances_stub.update_shielded_instance_config request, do |result, response| result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( operation: result, client: zone_operations, request_values: { "project" => request.project, "zone" => request.zone }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |