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

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:



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 144

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
  credentials ||= Credentials.default scope: @config.scope
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end

  @projects_stub = ::Google::Cloud::Compute::V1::Projects::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
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:



56
57
58
59
60
61
62
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
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 56

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..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:



123
124
125
126
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 123

def configure
  yield @config if block_given?
  @config
end

#disable_xpn_host(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #disable_xpn_host(project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

Disable this project as a shared VPC host project.

Overloads:

  • #disable_xpn_host(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #disable_xpn_host(project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 194

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 header
  [:"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]

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

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

  @projects_stub.disable_xpn_host request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end

#disable_xpn_resource(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #disable_xpn_resource(project: nil, projects_disable_xpn_resource_request_resource: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

Disable a service resource (also known as service project) associated with this host project.

Overloads:

  • #disable_xpn_resource(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #disable_xpn_resource(project: nil, projects_disable_xpn_resource_request_resource: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



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

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 header
  [:"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]

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

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

  @projects_stub.disable_xpn_resource request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end

#enable_xpn_host(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #enable_xpn_host(project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

Enable this project as a shared VPC host project.

Overloads:

  • #enable_xpn_host(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #enable_xpn_host(project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 324

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 header
  [:"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]

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

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

  @projects_stub.enable_xpn_host request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end

#enable_xpn_resource(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #enable_xpn_resource(project: nil, projects_enable_xpn_resource_request_resource: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

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.

Overloads:

  • #enable_xpn_resource(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #enable_xpn_resource(project: nil, projects_enable_xpn_resource_request_resource: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 390

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 header
  [:"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]

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

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

  @projects_stub.enable_xpn_resource request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
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.

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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #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, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



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
477
478
479
480
481
482
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 452

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 header
  [:"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]

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

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

  @projects_stub.get request, options do |result, response|
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
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.

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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #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, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 513

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 header
  [:"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]

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

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

  @projects_stub.get_xpn_host request, options do |result, response|
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
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.

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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #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. The 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 : operator can be used with string fields to match substrings. For non-string fields it is equivalent to the = operator. 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)

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

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 584

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 header
  [:"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]

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

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

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

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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #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. The 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 : operator can be used with string fields to match substrings. For non-string fields it is equivalent to the = operator. 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)

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

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

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

    if the REST call is aborted.



658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 658

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 header
  [:"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]

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

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

  @projects_stub.list_xpn_hosts request, options do |result, response|
    result = ::Gapic::Rest::PagedEnumerable.new @projects_stub, :list_xpn_hosts, "items", request, result, options
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end

#move_disk(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #move_disk(disk_move_request_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

Moves a persistent disk from one zone to another.

Overloads:

  • #move_disk(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #move_disk(disk_move_request_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 724

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 header
  [:"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]

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

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

  @projects_stub.move_disk request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end

#move_instance(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #move_instance(instance_move_request_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

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.

Overloads:

  • #move_instance(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #move_instance(instance_move_request_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



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
816
817
818
819
820
821
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 790

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 header
  [:"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]

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

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

  @projects_stub.move_instance request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end

#set_common_instance_metadata(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #set_common_instance_metadata(metadata_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

Sets metadata common to all instances within the specified project using the data included in the request.

Overloads:

  • #set_common_instance_metadata(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #set_common_instance_metadata(metadata_resource: nil, project: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 856

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 header
  [:"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]

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

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

  @projects_stub. request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end

#set_default_network_tier(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #set_default_network_tier(project: nil, projects_set_default_network_tier_request_resource: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

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.

Overloads:

  • #set_default_network_tier(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #set_default_network_tier(project: nil, projects_set_default_network_tier_request_resource: nil, request_id: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
# File 'lib/google/cloud/compute/v1/projects/rest/client.rb', line 922

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 header
  [:"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]

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

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

  @projects_stub.set_default_network_tier request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end

#set_usage_export_bucket(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation #set_usage_export_bucket(project: nil, request_id: nil, usage_export_location_resource: nil) ⇒ ::Gapic::Rest::BaseOperation

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.

Overloads:

  • #set_usage_export_bucket(request, options = nil) ⇒ ::Gapic::Rest::BaseOperation

    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. Note: currently retry functionality is not implemented. While it is possible to set it using ::Gapic::CallOptions, it will not be applied

  • #set_usage_export_bucket(project: nil, request_id: nil, usage_export_location_resource: nil) ⇒ ::Gapic::Rest::BaseOperation

    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, response)

    Access the result along with the Faraday response object

Yield Parameters:

  • result (::Gapic::Rest::BaseOperation)
  • response (::Faraday::Response)

Returns:

  • (::Gapic::Rest::BaseOperation)

Raises:

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

    if the REST call is aborted.



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

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 header
  [:"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]

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

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

  @projects_stub.set_usage_export_bucket request, options do |result, response|
    result = ::Gapic::Rest::BaseOperation.new result
    yield result, response if block_given?
    return result
  end
rescue ::Faraday::Error => e
  gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
  raise ::Google::Cloud::Error.from_error(gapic_error)
end