google-cloud-compute-v1 3.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96341cc39f3cc60ed1039a4ceba2c945996cd928db78a03aeae5056c94141f2b
4
- data.tar.gz: ea2ab3eb2ed70224711fa0dcac00935b10d01fc337ae4e27bdd953d8d93f998e
3
+ metadata.gz: c842062c57a09332a2f4de5a1c98804391f72d3fb7d914b6b15e6b621e44c100
4
+ data.tar.gz: a551dafc00e3efb95ace333abbf189a094f6219d9be3b8cb52f88032e771abac
5
5
  SHA512:
6
- metadata.gz: 5f2b3cce3c7f9a0c7db9eb9c4a8eee4a874bfbcb7af15a25fe33863b33d7043676d38a71f63228db5e27fbbc8ca44372e3bf0a1e80d6a5f3f46b1434a42b8f0f
7
- data.tar.gz: cc860ba40934d7fd3ef0814fc226a887e74e36d154877ac0b52f30da0ca4751bade6cdc0607256a90b909a3068528eefc96cc1c7861c6f1b8920d1d68d7af006
6
+ metadata.gz: 499f81d64a83b7effdad105f4954be58ddec2de27a0cec1c81a6ace20ab270c7b89009931093e6cb08869630862de17ae906a6cdbc817f7e437575dfc9f9e4c9
7
+ data.tar.gz: df5c60d141c5a4d296e329ed1ab11028249d342923ccb2018dfedf526138fbc0db0aeea8dab5be492fe536cba27f3a56d3cc42258e7207ddad4a03595c6fad70
@@ -94,6 +94,8 @@ module Google
94
94
 
95
95
  default_config.rpcs.set_labels.timeout = 600.0
96
96
 
97
+ default_config.rpcs.test_iam_permissions.timeout = 600.0
98
+
97
99
  default_config
98
100
  end
99
101
  yield @configure if block_given?
@@ -860,6 +862,90 @@ module Google
860
862
  raise ::Google::Cloud::Error.from_error(e)
861
863
  end
862
864
 
865
+ ##
866
+ # Returns permissions that a caller has on the specified resource.
867
+ #
868
+ # @overload test_iam_permissions(request, options = nil)
869
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
870
+ # {::Google::Cloud::Compute::V1::TestIamPermissionsAddressRequest} or an equivalent Hash.
871
+ #
872
+ # @param request [::Google::Cloud::Compute::V1::TestIamPermissionsAddressRequest, ::Hash]
873
+ # A request object representing the call parameters. Required. To specify no
874
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
875
+ # @param options [::Gapic::CallOptions, ::Hash]
876
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
877
+ #
878
+ # @overload test_iam_permissions(project: nil, region: nil, resource: nil, test_permissions_request_resource: nil)
879
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
880
+ # least one keyword argument is required. To specify no parameters, or to keep all
881
+ # the default parameter values, pass an empty Hash as a request object (see above).
882
+ #
883
+ # @param project [::String]
884
+ # Project ID for this request.
885
+ # @param region [::String]
886
+ # The name of the region for this request.
887
+ # @param resource [::String]
888
+ # Name or id of the resource for this request.
889
+ # @param test_permissions_request_resource [::Google::Cloud::Compute::V1::TestPermissionsRequest, ::Hash]
890
+ # The body resource for this request
891
+ # @yield [result, operation] Access the result along with the TransportOperation object
892
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
893
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
894
+ #
895
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
896
+ #
897
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
898
+ #
899
+ # @example Basic example
900
+ # require "google/cloud/compute/v1"
901
+ #
902
+ # # Create a client object. The client can be reused for multiple calls.
903
+ # client = Google::Cloud::Compute::V1::Addresses::Rest::Client.new
904
+ #
905
+ # # Create a request. To set request fields, pass in keyword arguments.
906
+ # request = Google::Cloud::Compute::V1::TestIamPermissionsAddressRequest.new
907
+ #
908
+ # # Call the test_iam_permissions method.
909
+ # result = client.test_iam_permissions request
910
+ #
911
+ # # The returned object is of type Google::Cloud::Compute::V1::TestPermissionsResponse.
912
+ # p result
913
+ #
914
+ def test_iam_permissions request, options = nil
915
+ raise ::ArgumentError, "request must be provided" if request.nil?
916
+
917
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::TestIamPermissionsAddressRequest
918
+
919
+ # Converts hash and nil to an options object
920
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
921
+
922
+ # Customize the options with defaults
923
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
924
+
925
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
926
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
927
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
928
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
929
+ transports_version_send: [:rest]
930
+
931
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
932
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
933
+
934
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
935
+ metadata: call_metadata,
936
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
937
+
938
+ options.apply_defaults timeout: @config.timeout,
939
+ metadata: @config.metadata,
940
+ retry_policy: @config.retry_policy
941
+
942
+ @addresses_stub.test_iam_permissions request, options do |result, operation|
943
+ yield result, operation if block_given?
944
+ end
945
+ rescue ::Gapic::Rest::Error => e
946
+ raise ::Google::Cloud::Error.from_error(e)
947
+ end
948
+
863
949
  ##
864
950
  # Configuration class for the Addresses REST API.
865
951
  #
@@ -1041,6 +1127,11 @@ module Google
1041
1127
  # @return [::Gapic::Config::Method]
1042
1128
  #
1043
1129
  attr_reader :set_labels
1130
+ ##
1131
+ # RPC-specific configuration for `test_iam_permissions`
1132
+ # @return [::Gapic::Config::Method]
1133
+ #
1134
+ attr_reader :test_iam_permissions
1044
1135
 
1045
1136
  # @private
1046
1137
  def initialize parent_rpcs = nil
@@ -1058,6 +1149,8 @@ module Google
1058
1149
  @move = ::Gapic::Config::Method.new move_config
1059
1150
  set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
1060
1151
  @set_labels = ::Gapic::Config::Method.new set_labels_config
1152
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1153
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1061
1154
 
1062
1155
  yield self if block_given?
1063
1156
  end
@@ -353,6 +353,46 @@ module Google
353
353
  end
354
354
  end
355
355
 
356
+ ##
357
+ # Baseline implementation for the test_iam_permissions REST call
358
+ #
359
+ # @param request_pb [::Google::Cloud::Compute::V1::TestIamPermissionsAddressRequest]
360
+ # A request object representing the call parameters. Required.
361
+ # @param options [::Gapic::CallOptions]
362
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
363
+ #
364
+ # @yield [result, operation] Access the result along with the TransportOperation object
365
+ # @yieldparam result [::Google::Cloud::Compute::V1::TestPermissionsResponse]
366
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
367
+ #
368
+ # @return [::Google::Cloud::Compute::V1::TestPermissionsResponse]
369
+ # A result object deserialized from the server's reply
370
+ def test_iam_permissions request_pb, options = nil
371
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
372
+
373
+ verb, uri, query_string_params, body = ServiceStub.transcode_test_iam_permissions_request request_pb
374
+ query_string_params = if query_string_params.any?
375
+ query_string_params.to_h { |p| p.split "=", 2 }
376
+ else
377
+ {}
378
+ end
379
+
380
+ response = @client_stub.make_http_request(
381
+ verb,
382
+ uri: uri,
383
+ body: body || "",
384
+ params: query_string_params,
385
+ method_name: "test_iam_permissions",
386
+ options: options
387
+ )
388
+ operation = ::Gapic::Rest::TransportOperation.new response
389
+ result = ::Google::Cloud::Compute::V1::TestPermissionsResponse.decode_json response.body, ignore_unknown_fields: true
390
+ catch :response do
391
+ yield result, operation if block_given?
392
+ result
393
+ end
394
+ end
395
+
356
396
  ##
357
397
  # @private
358
398
  #
@@ -512,6 +552,30 @@ module Google
512
552
  )
513
553
  transcoder.transcode request_pb
514
554
  end
555
+
556
+ ##
557
+ # @private
558
+ #
559
+ # GRPC transcoding helper method for the test_iam_permissions REST call
560
+ #
561
+ # @param request_pb [::Google::Cloud::Compute::V1::TestIamPermissionsAddressRequest]
562
+ # A request object representing the call parameters. Required.
563
+ # @return [Array(String, [String, nil], Hash{String => String})]
564
+ # Uri, Body, Query string parameters
565
+ def self.transcode_test_iam_permissions_request request_pb
566
+ transcoder = Gapic::Rest::GrpcTranscoder.new
567
+ .with_bindings(
568
+ uri_method: :post,
569
+ uri_template: "/compute/v1/projects/{project}/regions/{region}/addresses/{resource}/testIamPermissions",
570
+ body: "test_permissions_request_resource",
571
+ matches: [
572
+ ["project", %r{^[^/]+/?$}, false],
573
+ ["region", %r{^[^/]+/?$}, false],
574
+ ["resource", %r{^[^/]+/?$}, false]
575
+ ]
576
+ )
577
+ transcoder.transcode request_pb
578
+ end
515
579
  end
516
580
  end
517
581
  end