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

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/compute/v1/projects/rest/service_stub.rb

Overview

REST service stub for the Projects service. service stub contains baseline method implementations including transcoding, making the REST call and deserialing the response

Instance Method Summary collapse

Constructor Details

#initialize(endpoint:, credentials:) ⇒ ServiceStub

Returns a new instance of ServiceStub.



33
34
35
36
37
38
39
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 33

def initialize endpoint:, credentials:
  # These require statements are intentionally placed here to initialize
  # the REST modules only when it's required.
  require "gapic/rest"

  @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
end

Instance Method Details

#disable_xpn_host(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the disable_xpn_host REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 55

def disable_xpn_host request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, _body, query_string_params = transcode_disable_xpn_host_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#disable_xpn_resource(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the disable_xpn_resource REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 100

def disable_xpn_resource request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, body, query_string_params = transcode_disable_xpn_resource_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    body:    body,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#enable_xpn_host(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the enable_xpn_host REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


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

def enable_xpn_host request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, _body, query_string_params = transcode_enable_xpn_host_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#enable_xpn_resource(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the enable_xpn_resource REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 191

def enable_xpn_resource request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, body, query_string_params = transcode_enable_xpn_resource_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    body:    body,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#get(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Project

Baseline implementation for the get REST call

Parameters:

  • request_pb (::Google::Cloud::Compute::V1::GetProjectRequest)

    A request object representing the call parameters. Required.

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

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

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 237

def get request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, _body, _query_string_params = transcode_get_request request_pb
  response = @client_stub.make_get_request(
    uri:     uri,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#get_xpn_host(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Project

Baseline implementation for the get_xpn_host REST call

Parameters:

  • request_pb (::Google::Cloud::Compute::V1::GetXpnHostProjectRequest)

    A request object representing the call parameters. Required.

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

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

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 280

def get_xpn_host request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, _body, _query_string_params = transcode_get_xpn_host_request request_pb
  response = @client_stub.make_get_request(
    uri:     uri,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#get_xpn_resources(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::ProjectsGetXpnResources

Baseline implementation for the get_xpn_resources REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 323

def get_xpn_resources request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, _body, query_string_params = transcode_get_xpn_resources_request request_pb
  response = @client_stub.make_get_request(
    uri:     uri,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::ProjectsGetXpnResources.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#list_xpn_hosts(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::XpnHostList

Baseline implementation for the list_xpn_hosts REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 372

def list_xpn_hosts request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, body, query_string_params = transcode_list_xpn_hosts_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    body:    body,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::XpnHostList.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#move_disk(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the move_disk REST call

Parameters:

  • request_pb (::Google::Cloud::Compute::V1::MoveDiskProjectRequest)

    A request object representing the call parameters. Required.

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

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

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 422

def move_disk request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, body, query_string_params = transcode_move_disk_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    body:    body,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#move_instance(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the move_instance REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 468

def move_instance request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, body, query_string_params = transcode_move_instance_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    body:    body,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#set_common_instance_metadata(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the set_common_instance_metadata REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 514

def  request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, body, query_string_params =  request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    body:    body,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#set_default_network_tier(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the set_default_network_tier REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 560

def set_default_network_tier request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, body, query_string_params = transcode_set_default_network_tier_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    body:    body,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#set_usage_export_bucket(request_pb, options = nil) {|result, response| ... } ⇒ ::Google::Cloud::Compute::V1::Operation

Baseline implementation for the set_usage_export_bucket REST call

Parameters:

Yields:

  • (result, response)

    Access the result along with the Faraday response object

Yield Parameters:

Returns:

Raises:

  • (::ArgumentError)


606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 606

def set_usage_export_bucket request_pb, options = nil
  raise ::ArgumentError, "request must be provided" if request_pb.nil?

  uri, body, query_string_params = transcode_set_usage_export_bucket_request request_pb
  response = @client_stub.make_post_request(
    uri:     uri,
    body:    body,
    params:  query_string_params,
    options: options
  )
  result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true

  yield result, response if block_given?
  result
end

#transcode_disable_xpn_host_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the disable_xpn_host REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



77
78
79
80
81
82
83
84
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 77

def transcode_disable_xpn_host_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/disableXpnHost"
  body = nil
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end

#transcode_disable_xpn_resource_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the disable_xpn_resource REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



123
124
125
126
127
128
129
130
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 123

def transcode_disable_xpn_resource_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/disableXpnResource"
  body = request_pb.projects_disable_xpn_resource_request_resource.to_json
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end

#transcode_enable_xpn_host_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the enable_xpn_host REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



168
169
170
171
172
173
174
175
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 168

def transcode_enable_xpn_host_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/enableXpnHost"
  body = nil
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end

#transcode_enable_xpn_resource_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the enable_xpn_resource REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



214
215
216
217
218
219
220
221
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 214

def transcode_enable_xpn_resource_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/enableXpnResource"
  body = request_pb.projects_enable_xpn_resource_request_resource.to_json
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end

#transcode_get_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the get REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



258
259
260
261
262
263
264
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 258

def transcode_get_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}"
  body = nil
  query_string_params = {}

  [uri, body, query_string_params]
end

#transcode_get_xpn_host_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the get_xpn_host REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



301
302
303
304
305
306
307
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 301

def transcode_get_xpn_host_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/getXpnHost"
  body = nil
  query_string_params = {}

  [uri, body, query_string_params]
end

#transcode_get_xpn_resources_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the get_xpn_resources REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 345

def transcode_get_xpn_resources_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/getXpnResources"
  body = nil
  query_string_params = {}
  query_string_params["filter"] = request_pb.filter.to_s if request_pb.has_filter?
  query_string_params["maxResults"] = request_pb.max_results.to_s if request_pb.has_max_results?
  query_string_params["orderBy"] = request_pb.order_by.to_s if request_pb.has_order_by?
  query_string_params["pageToken"] = request_pb.page_token.to_s if request_pb.has_page_token?
  query_string_params["returnPartialSuccess"] = request_pb.return_partial_success.to_s if request_pb.has_return_partial_success?

  [uri, body, query_string_params]
end

#transcode_list_xpn_hosts_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the list_xpn_hosts REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 395

def transcode_list_xpn_hosts_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/listXpnHosts"
  body = request_pb.projects_list_xpn_hosts_request_resource.to_json
  query_string_params = {}
  query_string_params["filter"] = request_pb.filter.to_s if request_pb.has_filter?
  query_string_params["maxResults"] = request_pb.max_results.to_s if request_pb.has_max_results?
  query_string_params["orderBy"] = request_pb.order_by.to_s if request_pb.has_order_by?
  query_string_params["pageToken"] = request_pb.page_token.to_s if request_pb.has_page_token?
  query_string_params["returnPartialSuccess"] = request_pb.return_partial_success.to_s if request_pb.has_return_partial_success?

  [uri, body, query_string_params]
end

#transcode_move_disk_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the move_disk REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



445
446
447
448
449
450
451
452
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 445

def transcode_move_disk_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/moveDisk"
  body = request_pb.disk_move_request_resource.to_json
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end

#transcode_move_instance_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the move_instance REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



491
492
493
494
495
496
497
498
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 491

def transcode_move_instance_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/moveInstance"
  body = request_pb.instance_move_request_resource.to_json
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end

#transcode_set_common_instance_metadata_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the set_common_instance_metadata REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



537
538
539
540
541
542
543
544
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 537

def  request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/setCommonInstanceMetadata"
  body = request_pb..to_json
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end

#transcode_set_default_network_tier_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the set_default_network_tier REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



583
584
585
586
587
588
589
590
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 583

def transcode_set_default_network_tier_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/setDefaultNetworkTier"
  body = request_pb.projects_set_default_network_tier_request_resource.to_json
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end

#transcode_set_usage_export_bucket_request(request_pb) ⇒ Array(String, [String, nil], Hash{String => String})

GRPC transcoding helper method for the set_usage_export_bucket REST call

Parameters:

Returns:

  • (Array(String, [String, nil], Hash{String => String}))

    Uri, Body, Query string parameters



629
630
631
632
633
634
635
636
# File 'lib/google/cloud/compute/v1/projects/rest/service_stub.rb', line 629

def transcode_set_usage_export_bucket_request request_pb
  uri = "/compute/v1/projects/#{request_pb.project}/setUsageExportBucket"
  body = request_pb.usage_export_location_resource.to_json
  query_string_params = {}
  query_string_params["requestId"] = request_pb.request_id.to_s if request_pb.has_request_id?

  [uri, body, query_string_params]
end