Class: Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client
- Inherits:
-
Object
- Object
- Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::Client
- Defined in:
- lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb
Overview
REST client for the IdentityAwareProxyOAuthService service.
API to programmatically create, list and retrieve Identity Aware Proxy (IAP) OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuth clients.
Defined Under Namespace
Classes: Configuration
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the IdentityAwareProxyOAuthService Client class.
Instance Method Summary collapse
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the IdentityAwareProxyOAuthService Client instance.
-
#create_brand(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Iap::V1::Brand
Constructs a new OAuth brand for the project if one does not exist.
-
#create_identity_aware_proxy_client(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient
Creates an Identity Aware Proxy (IAP) OAuth client.
-
#delete_identity_aware_proxy_client(request, options = nil) {|result, operation| ... } ⇒ ::Google::Protobuf::Empty
Deletes an Identity Aware Proxy (IAP) OAuth client.
-
#get_brand(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Iap::V1::Brand
Retrieves the OAuth brand of the project.
-
#get_identity_aware_proxy_client(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient
Retrieves an Identity Aware Proxy (IAP) OAuth client.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new IdentityAwareProxyOAuthService REST client object.
-
#list_brands(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Iap::V1::ListBrandsResponse
Lists the existing brands for the project.
-
#list_identity_aware_proxy_clients(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iap::V1::IdentityAwareProxyClient>
Lists the existing clients for the brand.
-
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#reset_identity_aware_proxy_client_secret(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient
Resets an Identity Aware Proxy (IAP) OAuth client secret.
-
#universe_domain ⇒ String
The effective universe domain.
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new IdentityAwareProxyOAuthService REST client object.
128 129 130 131 132 133 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 164 165 166 167 168 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 128 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.nil? || (@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 @identity_aware_proxy_o_auth_service_stub = ::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::ServiceStub.new( endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, credentials: credentials, logger: @config.logger ) @identity_aware_proxy_o_auth_service_stub.logger(stub: true)&.info do |entry| entry.set_system_name entry.set_service entry. = "Created client for #{entry.service}" entry.set_credentials_fields credentials entry.set "customEndpoint", @config.endpoint if @config.endpoint entry.set "defaultTimeout", @config.timeout if @config.timeout entry.set "quotaProject", @quota_project_id if @quota_project_id end end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the IdentityAwareProxyOAuthService Client class.
See Configuration for a description of the configuration fields.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 64 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Iap", "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.timeout = 60.0 default_config end yield @configure if block_given? @configure end |
Instance Method Details
#configure {|config| ... } ⇒ Client::Configuration
Configure the IdentityAwareProxyOAuthService 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.
98 99 100 101 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 98 def configure yield @config if block_given? @config end |
#create_brand(request, options = nil) ⇒ ::Google::Cloud::Iap::V1::Brand #create_brand(parent: nil, brand: nil) ⇒ ::Google::Cloud::Iap::V1::Brand
Constructs a new OAuth brand for the project if one does not exist. The created brand is "internal only", meaning that OAuth clients created under it only accept requests from users who belong to the same Google Workspace organization as the project. The brand is created in an un-reviewed status. NOTE: The "internal only" status can be manually changed in the Google Cloud Console. Requires that a brand does not already exist for the project, and that the specified support email is owned by the caller.
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 313 def create_brand request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::CreateBrandRequest # 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_brand..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Iap::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_brand.timeout, metadata: , retry_policy: @config.rpcs.create_brand.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @identity_aware_proxy_o_auth_service_stub.create_brand request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#create_identity_aware_proxy_client(request, options = nil) ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient #create_identity_aware_proxy_client(parent: nil, identity_aware_proxy_client: nil) ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient
Creates an Identity Aware Proxy (IAP) OAuth client. The client is owned by IAP. Requires that the brand for the project exists and that it is set for internal-only use.
477 478 479 480 481 482 483 484 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 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 477 def create_identity_aware_proxy_client request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::CreateIdentityAwareProxyClientRequest # 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_identity_aware_proxy_client..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Iap::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_identity_aware_proxy_client.timeout, metadata: , retry_policy: @config.rpcs.create_identity_aware_proxy_client.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @identity_aware_proxy_o_auth_service_stub.create_identity_aware_proxy_client request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_identity_aware_proxy_client(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_identity_aware_proxy_client(name: nil) ⇒ ::Google::Protobuf::Empty
Deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing obsolete clients, managing the number of clients in a given project, and cleaning up after tests. Requires that the client is owned by IAP.
818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 818 def delete_identity_aware_proxy_client request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::DeleteIdentityAwareProxyClientRequest # 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_identity_aware_proxy_client..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Iap::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_identity_aware_proxy_client.timeout, metadata: , retry_policy: @config.rpcs.delete_identity_aware_proxy_client.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @identity_aware_proxy_o_auth_service_stub.delete_identity_aware_proxy_client request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_brand(request, options = nil) ⇒ ::Google::Cloud::Iap::V1::Brand #get_brand(name: nil) ⇒ ::Google::Cloud::Iap::V1::Brand
Retrieves the OAuth brand of the project.
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 422 423 424 425 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 392 def get_brand request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::GetBrandRequest # 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_brand..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Iap::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_brand.timeout, metadata: , retry_policy: @config.rpcs.get_brand.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @identity_aware_proxy_o_auth_service_stub.get_brand request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_identity_aware_proxy_client(request, options = nil) ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient #get_identity_aware_proxy_client(name: nil) ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient
Retrieves an Identity Aware Proxy (IAP) OAuth client. Requires that the client is owned by IAP.
655 656 657 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 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 655 def get_identity_aware_proxy_client request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::GetIdentityAwareProxyClientRequest # 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_identity_aware_proxy_client..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Iap::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_identity_aware_proxy_client.timeout, metadata: , retry_policy: @config.rpcs.get_identity_aware_proxy_client.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @identity_aware_proxy_o_auth_service_stub.get_identity_aware_proxy_client request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_brands(request, options = nil) ⇒ ::Google::Cloud::Iap::V1::ListBrandsResponse #list_brands(parent: nil) ⇒ ::Google::Cloud::Iap::V1::ListBrandsResponse
Lists the existing brands for the project.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 225 def list_brands request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::ListBrandsRequest # 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_brands..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Iap::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_brands.timeout, metadata: , retry_policy: @config.rpcs.list_brands.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @identity_aware_proxy_o_auth_service_stub.list_brands request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_identity_aware_proxy_clients(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iap::V1::IdentityAwareProxyClient> #list_identity_aware_proxy_clients(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Iap::V1::IdentityAwareProxyClient>
Lists the existing clients for the brand.
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 572 def list_identity_aware_proxy_clients request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::ListIdentityAwareProxyClientsRequest # 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_identity_aware_proxy_clients..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Iap::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_identity_aware_proxy_clients.timeout, metadata: , retry_policy: @config.rpcs.list_identity_aware_proxy_clients.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @identity_aware_proxy_o_auth_service_stub.list_identity_aware_proxy_clients request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @identity_aware_proxy_o_auth_service_stub, :list_identity_aware_proxy_clients, "identity_aware_proxy_clients", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#logger ⇒ Logger
The logger used for request/response debug logging.
175 176 177 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 175 def logger @identity_aware_proxy_o_auth_service_stub.logger end |
#reset_identity_aware_proxy_client_secret(request, options = nil) ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient #reset_identity_aware_proxy_client_secret(name: nil) ⇒ ::Google::Cloud::Iap::V1::IdentityAwareProxyClient
Resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the secret was compromised. Requires that the client is owned by IAP.
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 736 def reset_identity_aware_proxy_client_secret request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Iap::V1::ResetIdentityAwareProxyClientSecretRequest # 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.reset_identity_aware_proxy_client_secret..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Iap::V1::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.reset_identity_aware_proxy_client_secret.timeout, metadata: , retry_policy: @config.rpcs.reset_identity_aware_proxy_client_secret.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @identity_aware_proxy_o_auth_service_stub.reset_identity_aware_proxy_client_secret request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
108 109 110 |
# File 'lib/google/cloud/iap/v1/identity_aware_proxy_o_auth_service/rest/client.rb', line 108 def universe_domain @identity_aware_proxy_o_auth_service_stub.universe_domain end |