google-cloud-compute-v1 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -104,6 +104,8 @@ module Google
104
104
 
105
105
  default_config.rpcs.set_security_policy.timeout = 600.0
106
106
 
107
+ default_config.rpcs.test_iam_permissions.timeout = 600.0
108
+
107
109
  default_config
108
110
  end
109
111
  yield @configure if block_given?
@@ -1340,6 +1342,90 @@ module Google
1340
1342
  raise ::Google::Cloud::Error.from_error(e)
1341
1343
  end
1342
1344
 
1345
+ ##
1346
+ # Returns permissions that a caller has on the specified resource.
1347
+ #
1348
+ # @overload test_iam_permissions(request, options = nil)
1349
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
1350
+ # {::Google::Cloud::Compute::V1::TestIamPermissionsTargetPoolRequest} or an equivalent Hash.
1351
+ #
1352
+ # @param request [::Google::Cloud::Compute::V1::TestIamPermissionsTargetPoolRequest, ::Hash]
1353
+ # A request object representing the call parameters. Required. To specify no
1354
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1355
+ # @param options [::Gapic::CallOptions, ::Hash]
1356
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1357
+ #
1358
+ # @overload test_iam_permissions(project: nil, region: nil, resource: nil, test_permissions_request_resource: nil)
1359
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
1360
+ # least one keyword argument is required. To specify no parameters, or to keep all
1361
+ # the default parameter values, pass an empty Hash as a request object (see above).
1362
+ #
1363
+ # @param project [::String]
1364
+ # Project ID for this request.
1365
+ # @param region [::String]
1366
+ # The name of the region for this request.
1367
+ # @param resource [::String]
1368
+ # Name or id of the resource for this request.
1369
+ # @param test_permissions_request_resource [::Google::Cloud::Compute::V1::TestPermissionsRequest, ::Hash]
1370
+ # The body resource for this request
1371
+ # @yield [result, operation] Access the result along with the TransportOperation object
1372
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
1373
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1374
+ #
1375
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
1376
+ #
1377
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1378
+ #
1379
+ # @example Basic example
1380
+ # require "google/cloud/compute/v1"
1381
+ #
1382
+ # # Create a client object. The client can be reused for multiple calls.
1383
+ # client = Google::Cloud::Compute::V1::TargetPools::Rest::Client.new
1384
+ #
1385
+ # # Create a request. To set request fields, pass in keyword arguments.
1386
+ # request = Google::Cloud::Compute::V1::TestIamPermissionsTargetPoolRequest.new
1387
+ #
1388
+ # # Call the test_iam_permissions method.
1389
+ # result = client.test_iam_permissions request
1390
+ #
1391
+ # # The returned object is of type Google::Cloud::Compute::V1::TestPermissionsResponse.
1392
+ # p result
1393
+ #
1394
+ def test_iam_permissions request, options = nil
1395
+ raise ::ArgumentError, "request must be provided" if request.nil?
1396
+
1397
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::TestIamPermissionsTargetPoolRequest
1398
+
1399
+ # Converts hash and nil to an options object
1400
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1401
+
1402
+ # Customize the options with defaults
1403
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1404
+
1405
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1406
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1407
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1408
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
1409
+ transports_version_send: [:rest]
1410
+
1411
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1412
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1413
+
1414
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1415
+ metadata: call_metadata,
1416
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1417
+
1418
+ options.apply_defaults timeout: @config.timeout,
1419
+ metadata: @config.metadata,
1420
+ retry_policy: @config.retry_policy
1421
+
1422
+ @target_pools_stub.test_iam_permissions request, options do |result, operation|
1423
+ yield result, operation if block_given?
1424
+ end
1425
+ rescue ::Gapic::Rest::Error => e
1426
+ raise ::Google::Cloud::Error.from_error(e)
1427
+ end
1428
+
1343
1429
  ##
1344
1430
  # Configuration class for the TargetPools REST API.
1345
1431
  #
@@ -1546,6 +1632,11 @@ module Google
1546
1632
  # @return [::Gapic::Config::Method]
1547
1633
  #
1548
1634
  attr_reader :set_security_policy
1635
+ ##
1636
+ # RPC-specific configuration for `test_iam_permissions`
1637
+ # @return [::Gapic::Config::Method]
1638
+ #
1639
+ attr_reader :test_iam_permissions
1549
1640
 
1550
1641
  # @private
1551
1642
  def initialize parent_rpcs = nil
@@ -1573,6 +1664,8 @@ module Google
1573
1664
  @set_backup = ::Gapic::Config::Method.new set_backup_config
1574
1665
  set_security_policy_config = parent_rpcs.set_security_policy if parent_rpcs.respond_to? :set_security_policy
1575
1666
  @set_security_policy = ::Gapic::Config::Method.new set_security_policy_config
1667
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1668
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1576
1669
 
1577
1670
  yield self if block_given?
1578
1671
  end
@@ -553,6 +553,46 @@ module Google
553
553
  end
554
554
  end
555
555
 
556
+ ##
557
+ # Baseline implementation for the test_iam_permissions REST call
558
+ #
559
+ # @param request_pb [::Google::Cloud::Compute::V1::TestIamPermissionsTargetPoolRequest]
560
+ # A request object representing the call parameters. Required.
561
+ # @param options [::Gapic::CallOptions]
562
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
563
+ #
564
+ # @yield [result, operation] Access the result along with the TransportOperation object
565
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
566
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
567
+ #
568
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
569
+ # A result object deserialized from the server's reply
570
+ def test_iam_permissions request_pb, options = nil
571
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
572
+
573
+ verb, uri, query_string_params, body = ServiceStub.transcode_test_iam_permissions_request request_pb
574
+ query_string_params = if query_string_params.any?
575
+ query_string_params.to_h { |p| p.split "=", 2 }
576
+ else
577
+ {}
578
+ end
579
+
580
+ response = @client_stub.make_http_request(
581
+ verb,
582
+ uri: uri,
583
+ body: body || "",
584
+ params: query_string_params,
585
+ method_name: "test_iam_permissions",
586
+ options: options
587
+ )
588
+ operation = ::Gapic::Rest::TransportOperation.new response
589
+ result = ::Google::Cloud::Compute::V1::TestPermissionsResponse.decode_json response.body, ignore_unknown_fields: true
590
+ catch :response do
591
+ yield result, operation if block_given?
592
+ result
593
+ end
594
+ end
595
+
556
596
  ##
557
597
  # @private
558
598
  #
@@ -832,6 +872,30 @@ module Google
832
872
  )
833
873
  transcoder.transcode request_pb
834
874
  end
875
+
876
+ ##
877
+ # @private
878
+ #
879
+ # GRPC transcoding helper method for the test_iam_permissions REST call
880
+ #
881
+ # @param request_pb [::Google::Cloud::Compute::V1::TestIamPermissionsTargetPoolRequest]
882
+ # A request object representing the call parameters. Required.
883
+ # @return [Array(String, [String, nil], Hash{String => String})]
884
+ # Uri, Body, Query string parameters
885
+ def self.transcode_test_iam_permissions_request request_pb
886
+ transcoder = Gapic::Rest::GrpcTranscoder.new
887
+ .with_bindings(
888
+ uri_method: :post,
889
+ uri_template: "/compute/v1/projects/{project}/regions/{region}/targetPools/{resource}/testIamPermissions",
890
+ body: "test_permissions_request_resource",
891
+ matches: [
892
+ ["project", %r{^[^/]+/?$}, false],
893
+ ["region", %r{^[^/]+/?$}, false],
894
+ ["resource", %r{^[^/]+/?$}, false]
895
+ ]
896
+ )
897
+ transcoder.transcode request_pb
898
+ end
835
899
  end
836
900
  end
837
901
  end
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Compute
23
23
  module V1
24
- VERSION = "3.2.0"
24
+ VERSION = "3.4.0"
25
25
  end
26
26
  end
27
27
  end