Class: Google::Cloud::Compute::V1::Projects::Rest::Client

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new Projects REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Compute::V1::Projects::Rest::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Projects client.

Yield Parameters:



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
# 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
  )
end

Instance Attribute Details

#global_operations::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client (readonly)

Get the associated client for long-running operations via GlobalOperations.



205
206
207
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 205

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.

Examples:


# Modify the configuration for all Projects clients
::Google::Cloud::Compute::V1::Projects::Rest::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



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.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::DisableXpnHostProjectRequest.new

# Call the disable_xpn_host method.
result = client.disable_xpn_host request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #disable_xpn_host(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to disable_xpn_host via a request object, either of type DisableXpnHostProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::DisableXpnHostProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #disable_xpn_host(project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to disable_xpn_host via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 254

def disable_xpn_host request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.disable_xpn_host.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.disable_xpn_host.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.disable_xpn_host request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::DisableXpnResourceProjectRequest.new

# Call the disable_xpn_resource method.
result = client.disable_xpn_resource request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #disable_xpn_resource(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to disable_xpn_resource via a request object, either of type DisableXpnResourceProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::DisableXpnResourceProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #disable_xpn_resource(project: nil, projects_disable_xpn_resource_request_resource: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to disable_xpn_resource via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • projects_disable_xpn_resource_request_resource (::Google::Cloud::Compute::V1::ProjectsDisableXpnResourceRequest, ::Hash) (defaults to: nil)

      The body resource for this request

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 345

def disable_xpn_resource request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.disable_xpn_resource.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.disable_xpn_resource.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.disable_xpn_resource request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::EnableXpnHostProjectRequest.new

# Call the enable_xpn_host method.
result = client.enable_xpn_host request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #enable_xpn_host(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to enable_xpn_host via a request object, either of type EnableXpnHostProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::EnableXpnHostProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #enable_xpn_host(project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to enable_xpn_host via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 434

def enable_xpn_host request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.enable_xpn_host.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.enable_xpn_host.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.enable_xpn_host request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::EnableXpnResourceProjectRequest.new

# Call the enable_xpn_resource method.
result = client.enable_xpn_resource request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #enable_xpn_resource(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to enable_xpn_resource via a request object, either of type EnableXpnResourceProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::EnableXpnResourceProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #enable_xpn_resource(project: nil, projects_enable_xpn_resource_request_resource: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to enable_xpn_resource via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • projects_enable_xpn_resource_request_resource (::Google::Cloud::Compute::V1::ProjectsEnableXpnResourceRequest, ::Hash) (defaults to: nil)

      The body resource for this request

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 525

def enable_xpn_resource request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.enable_xpn_resource.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.enable_xpn_resource.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.enable_xpn_resource request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetProjectRequest.new

# Call the get method.
result = client.get request

# The returned object is of type Google::Cloud::Compute::V1::Project.
p result

Overloads:

  • #get(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::Project

    Pass arguments to get via a request object, either of type GetProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::GetProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get(project: nil) ⇒ ::Google::Cloud::Compute::V1::Project

    Pass arguments to get via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 612

def get request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.get.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.get request, options do |result, operation|
    yield result, operation if block_given?
    return result
  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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetXpnHostProjectRequest.new

# Call the get_xpn_host method.
result = client.get_xpn_host request

# The returned object is of type Google::Cloud::Compute::V1::Project.
p result

Overloads:

  • #get_xpn_host(request, options = nil) ⇒ ::Google::Cloud::Compute::V1::Project

    Pass arguments to get_xpn_host via a request object, either of type GetXpnHostProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::GetXpnHostProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_xpn_host(project: nil) ⇒ ::Google::Cloud::Compute::V1::Project

    Pass arguments to get_xpn_host via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 691

def get_xpn_host request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.get_xpn_host.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_xpn_host.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.get_xpn_host request, options do |result, operation|
    yield result, operation if block_given?
    return result
  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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::GetXpnResourcesProjectsRequest.new

# Call the get_xpn_resources method.
result = client.get_xpn_resources request

# The returned object is of type Google::Cloud::Compute::V1::ProjectsGetXpnResources.
p result

Overloads:

  • #get_xpn_resources(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::XpnResourceId>

    Pass arguments to get_xpn_resources via a request object, either of type GetXpnResourcesProjectsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::GetXpnResourcesProjectsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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>

    Pass arguments to get_xpn_resources via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • filter (::String) (defaults to: nil)

      A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either =, !=, >, <, <=, >= or :. For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. The :* comparison can be used to test whether a key has been defined. For example, to find all objects with owner label use: labels.owner:* You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example: (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) If you want to use a regular expression, use the eq (equal) or ne (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: fieldname eq unquoted literal fieldname eq 'single quoted literal' fieldname eq "double quoted literal" (fieldname1 eq literal) (fieldname2 ne "literal") The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use name ne .*instance. You cannot combine constraints on multiple fields using regular expressions.

    • max_results (::Integer) (defaults to: nil)

      The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500)

    • order_by (::String) (defaults to: nil)

      Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.

    • page_token (::String) (defaults to: nil)

      Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • return_partial_success (::Boolean) (defaults to: nil)

      Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 780

def get_xpn_resources request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.get_xpn_resources.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_xpn_resources.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.get_xpn_resources request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @projects_stub, :get_xpn_resources, "resources", request, result, options
    yield result, operation if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::ListXpnHostsProjectsRequest.new

# Call the list_xpn_hosts method.
result = client.list_xpn_hosts request

# The returned object is of type Google::Cloud::Compute::V1::XpnHostList.
p result

Overloads:

  • #list_xpn_hosts(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Compute::V1::Project>

    Pass arguments to list_xpn_hosts via a request object, either of type ListXpnHostsProjectsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::ListXpnHostsProjectsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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>

    Pass arguments to list_xpn_hosts via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • filter (::String) (defaults to: nil)

      A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either =, !=, >, <, <=, >= or :. For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. The :* comparison can be used to test whether a key has been defined. For example, to find all objects with owner label use: labels.owner:* You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example: (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) If you want to use a regular expression, use the eq (equal) or ne (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: fieldname eq unquoted literal fieldname eq 'single quoted literal' fieldname eq "double quoted literal" (fieldname1 eq literal) (fieldname2 ne "literal") The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use name ne .*instance. You cannot combine constraints on multiple fields using regular expressions.

    • max_results (::Integer) (defaults to: nil)

      The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500)

    • order_by (::String) (defaults to: nil)

      Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported.

    • page_token (::String) (defaults to: nil)

      Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results.

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • projects_list_xpn_hosts_request_resource (::Google::Cloud::Compute::V1::ProjectsListXpnHostsRequest, ::Hash) (defaults to: nil)

      The body resource for this request

    • return_partial_success (::Boolean) (defaults to: nil)

      Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code.

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 872

def list_xpn_hosts request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.list_xpn_hosts.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_xpn_hosts.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.list_xpn_hosts request, options do |result, operation|
    result = ::Gapic::Rest::PagedEnumerable.new @projects_stub, :list_xpn_hosts, "items", request, result, options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::MoveDiskProjectRequest.new

# Call the move_disk method.
result = client.move_disk request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #move_disk(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to move_disk via a request object, either of type MoveDiskProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::MoveDiskProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #move_disk(disk_move_request_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to move_disk via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • disk_move_request_resource (::Google::Cloud::Compute::V1::DiskMoveRequest, ::Hash) (defaults to: nil)

      The body resource for this request

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
989
990
991
992
993
994
995
996
997
998
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 956

def move_disk request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.move_disk.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.move_disk.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.move_disk request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::MoveInstanceProjectRequest.new

# Call the move_instance method.
result = client.move_instance request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #move_instance(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to move_instance via a request object, either of type MoveInstanceProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::MoveInstanceProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #move_instance(instance_move_request_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to move_instance via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • instance_move_request_resource (::Google::Cloud::Compute::V1::InstanceMoveRequest, ::Hash) (defaults to: nil)

      The body resource for this request

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
1085
1086
1087
1088
1089
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1047

def move_instance request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.move_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.move_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.move_instance request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetCloudArmorTierProjectRequest.new

# Call the set_cloud_armor_tier method.
result = client.set_cloud_armor_tier request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #set_cloud_armor_tier(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to set_cloud_armor_tier via a request object, either of type SetCloudArmorTierProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::SetCloudArmorTierProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #set_cloud_armor_tier(project: nil, projects_set_cloud_armor_tier_request_resource: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to set_cloud_armor_tier via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • projects_set_cloud_armor_tier_request_resource (::Google::Cloud::Compute::V1::ProjectsSetCloudArmorTierRequest, ::Hash) (defaults to: nil)

      The body resource for this request

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



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
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1138

def set_cloud_armor_tier request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.set_cloud_armor_tier.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.set_cloud_armor_tier.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.set_cloud_armor_tier request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetCommonInstanceMetadataProjectRequest.new

# Call the set_common_instance_metadata method.
result = client. request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #set_common_instance_metadata(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to set_common_instance_metadata via a request object, either of type SetCommonInstanceMetadataProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::SetCommonInstanceMetadataProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #set_common_instance_metadata(metadata_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to set_common_instance_metadata via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • metadata_resource (::Google::Cloud::Compute::V1::Metadata, ::Hash) (defaults to: nil)

      The body resource for this request

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
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
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1229

def  request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs..timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs..retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub. request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetDefaultNetworkTierProjectRequest.new

# Call the set_default_network_tier method.
result = client.set_default_network_tier request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #set_default_network_tier(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to set_default_network_tier via a request object, either of type SetDefaultNetworkTierProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::SetDefaultNetworkTierProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #set_default_network_tier(project: nil, projects_set_default_network_tier_request_resource: nil, request_id: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to set_default_network_tier via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • projects_set_default_network_tier_request_resource (::Google::Cloud::Compute::V1::ProjectsSetDefaultNetworkTierRequest, ::Hash) (defaults to: nil)

      The body resource for this request

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
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
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1320

def set_default_network_tier request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.set_default_network_tier.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.set_default_network_tier.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.set_default_network_tier request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return 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.

Examples:

Basic example

require "google/cloud/compute/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Compute::V1::Projects::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Compute::V1::SetUsageExportBucketProjectRequest.new

# Call the set_usage_export_bucket method.
result = client.set_usage_export_bucket request

# The returned object is of type Google::Cloud::Compute::V1::Operation.
p result

Overloads:

  • #set_usage_export_bucket(request, options = nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to set_usage_export_bucket via a request object, either of type SetUsageExportBucketProjectRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Compute::V1::SetUsageExportBucketProjectRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #set_usage_export_bucket(project: nil, request_id: nil, usage_export_location_resource: nil) ⇒ ::Gapic::GenericLRO::Operation

    Pass arguments to set_usage_export_bucket via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • project (::String) (defaults to: nil)

      Project ID for this request.

    • request_id (::String) (defaults to: nil)

      An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).

    • usage_export_location_resource (::Google::Cloud::Compute::V1::UsageExportLocation, ::Hash) (defaults to: nil)

      The body resource for this request

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

  • result (::Gapic::GenericLRO::Operation)
  • operation (::Gapic::Rest::TransportOperation)

Returns:

  • (::Gapic::GenericLRO::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
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
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 1411

def set_usage_export_bucket request, options = 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
  options = ::Gapic::CallOptions.new(**options.to_h) if options.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

  options.apply_defaults timeout:      @config.rpcs.set_usage_export_bucket.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.set_usage_export_bucket.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @projects_stub.set_usage_export_bucket request, options do |result, response|
    result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
      operation: result,
      client: global_operations,
      request_values: {
        "project" => request.project
      },
      options: options
    )
    yield result, response if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


142
143
144
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 142

def universe_domain
  @projects_stub.universe_domain
end