Class: Google::Cloud::Compute::V1::Projects::Rest::Client
- Inherits:
-
Object
- Object
- Google::Cloud::Compute::V1::Projects::Rest::Client
- Defined in:
- lib/google/cloud/compute/v1/projects/rest/client.rb
Overview
REST client for the Projects service.
The Projects API.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#global_operations ⇒ ::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client
readonly
Get the associated client for long-running operations via GlobalOperations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the Projects Client class.
Instance Method Summary collapse
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the Projects Client instance.
-
#disable_xpn_host(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Disable this project as a shared VPC host project.
-
#disable_xpn_resource(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Disable a service resource (also known as service project) associated with this host project.
-
#enable_xpn_host(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Enable this project as a shared VPC host project.
-
#enable_xpn_resource(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.
-
#get(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::Project
Returns the specified Project resource.
-
#get_xpn_host(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Compute::V1::Project
Gets the shared VPC host project that this project links to.
-
#get_xpn_resources(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::XpnResourceId>
Gets service resources (a.k.a service project) associated with this host project.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new Projects REST client object.
-
#list_xpn_hosts(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Project>
Lists all shared VPC host projects visible to the user in an organization.
-
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#move_disk(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Moves a persistent disk from one zone to another.
-
#move_instance(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Moves an instance and its attached persistent disks from one zone to another.
-
#set_cloud_armor_tier(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets the Cloud Armor tier of the project.
-
#set_common_instance_metadata(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets metadata common to all instances within the specified project using the data included in the request.
-
#set_default_network_tier(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Sets the default network tier of the project.
-
#set_usage_export_bucket(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::GenericLRO::Operation
Enables the usage export feature and sets the usage export bucket where reports are stored.
-
#universe_domain ⇒ String
The effective universe domain.
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new Projects REST client object.
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 205 206 207 208 209 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 162 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 @global_operations = ::Google::Cloud::Compute::V1::GlobalOperations::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 @projects_stub = ::Google::Cloud::Compute::V1::Projects::Rest::ServiceStub.new( endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, credentials: credentials, logger: @config.logger ) @projects_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
#global_operations ⇒ ::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client (readonly)
Get the associated client for long-running operations via GlobalOperations.
216 217 218 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 216 def global_operations @global_operations end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the Projects 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 |
# File 'lib/google/cloud/compute/v1/projects/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.disable_xpn_host.timeout = 600.0 default_config.rpcs.disable_xpn_resource.timeout = 600.0 default_config.rpcs.enable_xpn_host.timeout = 600.0 default_config.rpcs.enable_xpn_resource.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_xpn_host.timeout = 600.0 default_config.rpcs.get_xpn_host.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_xpn_resources.timeout = 600.0 default_config.rpcs.get_xpn_resources.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.list_xpn_hosts.timeout = 600.0 default_config.rpcs.move_disk.timeout = 600.0 default_config.rpcs.move_instance.timeout = 600.0 default_config.rpcs.set_cloud_armor_tier.timeout = 600.0 default_config.rpcs..timeout = 600.0 default_config.rpcs.set_default_network_tier.timeout = 600.0 default_config.rpcs.set_usage_export_bucket.timeout = 600.0 default_config end yield @configure if block_given? @configure end |
Instance Method Details
#configure {|config| ... } ⇒ Client::Configuration
Configure the Projects 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.
132 133 134 135 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 132 def configure yield @config if block_given? @config end |
#disable_xpn_host(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #disable_xpn_host(project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Disable this project as a shared VPC host project.
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 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 274 def disable_xpn_host request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DisableXpnHostProjectRequest # 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.disable_xpn_host..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.disable_xpn_host.timeout, metadata: , retry_policy: @config.rpcs.disable_xpn_host.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.disable_xpn_host request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#disable_xpn_resource(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #disable_xpn_resource(project: nil, projects_disable_xpn_resource_request_resource: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Disable a service resource (also known as service project) associated with this host project.
365 366 367 368 369 370 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 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 365 def disable_xpn_resource request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::DisableXpnResourceProjectRequest # 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.disable_xpn_resource..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.disable_xpn_resource.timeout, metadata: , retry_policy: @config.rpcs.disable_xpn_resource.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.disable_xpn_resource request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#enable_xpn_host(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #enable_xpn_host(project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Enable this project as a shared VPC host project.
454 455 456 457 458 459 460 461 462 463 464 465 466 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 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 454 def enable_xpn_host request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::EnableXpnHostProjectRequest # 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.enable_xpn_host..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.enable_xpn_host.timeout, metadata: , retry_policy: @config.rpcs.enable_xpn_host.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.enable_xpn_host request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#enable_xpn_resource(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #enable_xpn_resource(project: nil, projects_enable_xpn_resource_request_resource: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project.
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 545 def enable_xpn_resource request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::EnableXpnResourceProjectRequest # 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.enable_xpn_resource..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.enable_xpn_resource.timeout, metadata: , retry_policy: @config.rpcs.enable_xpn_resource.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.enable_xpn_resource request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, 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::Project #get(project: nil) ⇒ ::Google::Cloud::Compute::V1::Project
Returns the specified Project resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 632 def get request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetProjectRequest # 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 @projects_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_xpn_host(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::Project #get_xpn_host(project: nil) ⇒ ::Google::Cloud::Compute::V1::Project
Gets the shared VPC host project that this project links to. May be empty if no link exists.
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 710 def get_xpn_host request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetXpnHostProjectRequest # 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_xpn_host..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_xpn_host.timeout, metadata: , retry_policy: @config.rpcs.get_xpn_host.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.get_xpn_host 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_xpn_resources(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::XpnResourceId> #get_xpn_resources(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::XpnResourceId>
Gets service resources (a.k.a service project) associated with this host project.
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 798 def get_xpn_resources request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetXpnResourcesProjectsRequest # 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_xpn_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.get_xpn_resources.timeout, metadata: , retry_policy: @config.rpcs.get_xpn_resources.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.get_xpn_resources request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @projects_stub, :get_xpn_resources, "resources", 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_xpn_hosts(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Project> #list_xpn_hosts(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, projects_list_xpn_hosts_request_resource: nil, return_partial_success: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Project>
Lists all shared VPC host projects visible to the user in an organization.
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 890 def list_xpn_hosts request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::ListXpnHostsProjectsRequest # 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_xpn_hosts..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_xpn_hosts.timeout, metadata: , retry_policy: @config.rpcs.list_xpn_hosts.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.list_xpn_hosts request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @projects_stub, :list_xpn_hosts, "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.
223 224 225 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 223 def logger @projects_stub.logger end |
#move_disk(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #move_disk(disk_move_request_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Moves a persistent disk from one zone to another.
974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 974 def move_disk request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::MoveDiskProjectRequest # 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.move_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.move_disk.timeout, metadata: , retry_policy: @config.rpcs.move_disk.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.move_disk request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#move_instance(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #move_instance(instance_move_request_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Moves an instance and its attached persistent disks from one zone to another. Note: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the known issue. [Deprecated] This method is deprecated. See moving instance across zones instead.
1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1065 def move_instance request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::MoveInstanceProjectRequest # 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.move_instance..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.move_instance.timeout, metadata: , retry_policy: @config.rpcs.move_instance.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.move_instance request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, 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_cloud_armor_tier(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_cloud_armor_tier(project: nil, projects_set_cloud_armor_tier_request_resource: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets the Cloud Armor tier of the project. To set ENTERPRISE or above the billing account of the project must be subscribed to Cloud Armor Enterprise. See Subscribing to Cloud Armor Enterprise for more information.
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1156 def set_cloud_armor_tier request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetCloudArmorTierProjectRequest # 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_cloud_armor_tier..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_cloud_armor_tier.timeout, metadata: , retry_policy: @config.rpcs.set_cloud_armor_tier.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.set_cloud_armor_tier request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, 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_common_instance_metadata(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_common_instance_metadata(metadata_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets metadata common to all instances within the specified project using the data included in the request.
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1247 def request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetCommonInstanceMetadataProjectRequest # 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 @projects_stub. request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, 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_default_network_tier(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_default_network_tier(project: nil, projects_set_default_network_tier_request_resource: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation
Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field.
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1338 def set_default_network_tier request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetDefaultNetworkTierProjectRequest # 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_default_network_tier..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_default_network_tier.timeout, metadata: , retry_policy: @config.rpcs.set_default_network_tier.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.set_default_network_tier request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, 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_usage_export_bucket(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation #set_usage_export_bucket(project: nil, request_id: nil, usage_export_location_resource: nil) ⇒ ::Gapic::GenericLRO::Operation
Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled.
1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1429 def set_usage_export_bucket request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetUsageExportBucketProjectRequest # 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_usage_export_bucket..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_usage_export_bucket.timeout, metadata: , retry_policy: @config.rpcs.set_usage_export_bucket.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @projects_stub.set_usage_export_bucket request, do |result, response| result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation( operation: result, client: global_operations, request_values: { "project" => request.project }, options: ) yield result, response if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
142 143 144 |
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 142 def universe_domain @projects_stub.universe_domain end |