Class: Google::Cloud::ResourceManager::V3::TagValues::Rest::Client
- Inherits:
-
Object
- Object
- Google::Cloud::ResourceManager::V3::TagValues::Rest::Client
- Includes:
- Paths
- Defined in:
- lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb
Overview
REST client for the TagValues service.
Allow users to create and manage tag values.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#operations_client ⇒ ::Google::Cloud::ResourceManager::V3::TagValues::Rest::Operations
readonly
Get the associated client for long-running operations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the TagValues Client class.
Instance Method Summary collapse
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the TagValues Client instance.
-
#create_tag_value(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Creates a TagValue as a child of the specified TagKey.
-
#delete_tag_value(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Deletes a TagValue.
-
#get_iam_policy(request, options = nil) {|result, operation| ... } ⇒ ::Google::Iam::V1::Policy
Gets the access control policy for a TagValue.
-
#get_namespaced_tag_value(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::ResourceManager::V3::TagValue
Retrieves a TagValue by its namespaced name.
-
#get_tag_value(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::ResourceManager::V3::TagValue
Retrieves a TagValue.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new TagValues REST client object.
-
#list_tag_values(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagValue>
Lists all TagValues for a specific TagKey.
-
#set_iam_policy(request, options = nil) {|result, operation| ... } ⇒ ::Google::Iam::V1::Policy
Sets the access control policy on a TagValue, replacing any existing policy.
-
#test_iam_permissions(request, options = nil) {|result, operation| ... } ⇒ ::Google::Iam::V1::TestIamPermissionsResponse
Returns permissions that a caller has on the specified TagValue.
-
#update_tag_value(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Updates the attributes of the TagValue resource.
Methods included from Paths
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new TagValues REST client object.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 134 def initialize # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT && !@config.endpoint.split(".").first.include?("-") credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_client = ::Google::Cloud::ResourceManager::V3::TagValues::Rest::Operations.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint end @tag_values_stub = ::Google::Cloud::ResourceManager::V3::TagValues::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials end |
Instance Attribute Details
#operations_client ⇒ ::Google::Cloud::ResourceManager::V3::TagValues::Rest::Operations (readonly)
Get the associated client for long-running operations.
170 171 172 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 170 def operations_client @operations_client end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the TagValues Client class.
See Configuration for a description of the configuration fields.
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 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 58 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "ResourceManager", "V3"] 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.list_tag_values.timeout = 60.0 default_config.rpcs.list_tag_values.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.get_tag_value.timeout = 60.0 default_config.rpcs.get_tag_value.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.create_tag_value.timeout = 60.0 default_config.rpcs.update_tag_value.timeout = 60.0 default_config.rpcs.delete_tag_value.timeout = 60.0 default_config.rpcs.get_iam_policy.timeout = 60.0 default_config.rpcs.get_iam_policy.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14] } default_config.rpcs.set_iam_policy.timeout = 60.0 default_config end yield @configure if block_given? @configure end |
Instance Method Details
#configure {|config| ... } ⇒ Client::Configuration
Configure the TagValues 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.
113 114 115 116 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 113 def configure yield @config if block_given? @config end |
#create_tag_value(request, options = nil) ⇒ ::Gapic::Operation #create_tag_value(tag_value: nil, validate_only: nil) ⇒ ::Gapic::Operation
Creates a TagValue as a child of the specified TagKey. If a another request with the same parameters is sent while the original request is in process the second request will receive an error. A maximum of 1000 TagValues can exist under a TagKey at any given time.
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 414 def create_tag_value request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::CreateTagValueRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_tag_value..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_tag_value.timeout, metadata: , retry_policy: @config.rpcs.create_tag_value.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub.create_tag_value request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_tag_value(request, options = nil) ⇒ ::Gapic::Operation #delete_tag_value(name: nil, validate_only: nil, etag: nil) ⇒ ::Gapic::Operation
Deletes a TagValue. The TagValue cannot have any bindings when it is deleted.
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 556 def delete_tag_value request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::DeleteTagValueRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_tag_value..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_tag_value.timeout, metadata: , retry_policy: @config.rpcs.delete_tag_value.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub.delete_tag_value request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy #get_iam_policy(resource: nil, options: nil) ⇒ ::Google::Iam::V1::Policy
Gets the access control policy for a TagValue. The returned policy may be
empty if no such policy or resource exists. The resource
field should
be the TagValue's resource name. For example: tagValues/1234
.
The caller must have the
cloudresourcemanager.googleapis.com/tagValues.getIamPolicy
permission on
the identified TagValue to get the access control policy.
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 628 def get_iam_policy request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_iam_policy..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_iam_policy.timeout, metadata: , retry_policy: @config.rpcs.get_iam_policy.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub.get_iam_policy request, do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_namespaced_tag_value(request, options = nil) ⇒ ::Google::Cloud::ResourceManager::V3::TagValue #get_namespaced_tag_value(name: nil) ⇒ ::Google::Cloud::ResourceManager::V3::TagValue
Retrieves a TagValue by its namespaced name.
This method will return PERMISSION_DENIED
if the value does not exist
or the user does not have permission to view it.
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 345 def get_namespaced_tag_value request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::GetNamespacedTagValueRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_namespaced_tag_value..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_namespaced_tag_value.timeout, metadata: , retry_policy: @config.rpcs.get_namespaced_tag_value.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub.get_namespaced_tag_value request, do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_tag_value(request, options = nil) ⇒ ::Google::Cloud::ResourceManager::V3::TagValue #get_tag_value(name: nil) ⇒ ::Google::Cloud::ResourceManager::V3::TagValue
Retrieves a TagValue. This method will return PERMISSION_DENIED
if the
value does not exist or the user does not have permission to view it.
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 273 def get_tag_value request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::GetTagValueRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_tag_value..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_tag_value.timeout, metadata: , retry_policy: @config.rpcs.get_tag_value.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub.get_tag_value request, do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_tag_values(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagValue> #list_tag_values(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::TagValue>
Lists all TagValues for a specific TagKey.
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 208 def list_tag_values request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::ListTagValuesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_tag_values..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_tag_values.timeout, metadata: , retry_policy: @config.rpcs.list_tag_values.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub.list_tag_values request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @tag_values_stub, :list_tag_values, "tag_values", request, result, yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy #set_iam_policy(resource: nil, policy: nil, update_mask: nil) ⇒ ::Google::Iam::V1::Policy
Sets the access control policy on a TagValue, replacing any existing
policy. The resource
field should be the TagValue's resource name.
For example: tagValues/1234
.
The caller must have resourcemanager.tagValues.setIamPolicy
permission
on the identified tagValue.
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 706 def set_iam_policy request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_iam_policy..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_iam_policy.timeout, metadata: , retry_policy: @config.rpcs.set_iam_policy.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub.set_iam_policy request, do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#test_iam_permissions(request, options = nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse #test_iam_permissions(resource: nil, permissions: nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse
Returns permissions that a caller has on the specified TagValue.
The resource
field should be the TagValue's resource name. For example:
tagValues/1234
.
There are no permissions required for making this API call.
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 778 def request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs...to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs..timeout, metadata: , retry_policy: @config.rpcs..retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub. request, do |result, operation| yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#update_tag_value(request, options = nil) ⇒ ::Gapic::Operation #update_tag_value(tag_value: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation
Updates the attributes of the TagValue resource.
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/google/cloud/resource_manager/v3/tag_values/rest/client.rb', line 485 def update_tag_value request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::ResourceManager::V3::UpdateTagValueRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_tag_value..to_h # Set x-goog-api-client and x-goog-user-project headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::ResourceManager::V3::VERSION, transports_version_send: [:rest] [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update_tag_value.timeout, metadata: , retry_policy: @config.rpcs.update_tag_value.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @tag_values_stub.update_tag_value request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |