google-cloud-run-v2 0.12.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -99
  3. data/lib/google/cloud/run/v2/executions/client.rb +39 -14
  4. data/lib/google/cloud/run/v2/executions/operations.rb +28 -6
  5. data/lib/google/cloud/run/v2/executions/rest/client.rb +37 -9
  6. data/lib/google/cloud/run/v2/executions/rest/operations.rb +33 -8
  7. data/lib/google/cloud/run/v2/executions/rest/service_stub.rb +23 -2
  8. data/lib/google/cloud/run/v2/jobs/client.rb +39 -14
  9. data/lib/google/cloud/run/v2/jobs/operations.rb +28 -6
  10. data/lib/google/cloud/run/v2/jobs/rest/client.rb +37 -9
  11. data/lib/google/cloud/run/v2/jobs/rest/operations.rb +33 -8
  12. data/lib/google/cloud/run/v2/jobs/rest/service_stub.rb +23 -2
  13. data/lib/google/cloud/run/v2/revisions/client.rb +39 -14
  14. data/lib/google/cloud/run/v2/revisions/operations.rb +28 -6
  15. data/lib/google/cloud/run/v2/revisions/rest/client.rb +37 -9
  16. data/lib/google/cloud/run/v2/revisions/rest/operations.rb +33 -8
  17. data/lib/google/cloud/run/v2/revisions/rest/service_stub.rb +23 -2
  18. data/lib/google/cloud/run/v2/services/client.rb +39 -14
  19. data/lib/google/cloud/run/v2/services/operations.rb +28 -6
  20. data/lib/google/cloud/run/v2/services/rest/client.rb +37 -9
  21. data/lib/google/cloud/run/v2/services/rest/operations.rb +33 -8
  22. data/lib/google/cloud/run/v2/services/rest/service_stub.rb +23 -2
  23. data/lib/google/cloud/run/v2/tasks/client.rb +38 -14
  24. data/lib/google/cloud/run/v2/tasks/rest/client.rb +36 -9
  25. data/lib/google/cloud/run/v2/tasks/rest/service_stub.rb +23 -2
  26. data/lib/google/cloud/run/v2/version.rb +1 -1
  27. data/proto_docs/google/api/client.rb +14 -0
  28. metadata +7 -7
@@ -26,6 +26,9 @@ module Google
26
26
  module Revisions
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
31
+
29
32
  # @private
30
33
  attr_reader :operations_stub
31
34
 
@@ -60,6 +63,15 @@ module Google
60
63
  @config
61
64
  end
62
65
 
66
+ ##
67
+ # The effective universe domain
68
+ #
69
+ # @return [String]
70
+ #
71
+ def universe_domain
72
+ @operations_stub.universe_domain
73
+ end
74
+
63
75
  ##
64
76
  # Create a new Operations client object.
65
77
  #
@@ -90,8 +102,10 @@ module Google
90
102
 
91
103
  @operations_stub = ::Gapic::ServiceStub.new(
92
104
  ::Google::Longrunning::Operations::Stub,
93
- credentials: credentials,
94
- endpoint: @config.endpoint,
105
+ credentials: credentials,
106
+ endpoint: @config.endpoint,
107
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
108
+ universe_domain: @config.universe_domain,
95
109
  channel_args: @config.channel_args,
96
110
  interceptors: @config.interceptors,
97
111
  channel_pool_config: @config.channel_pool
@@ -621,9 +635,9 @@ module Google
621
635
  # end
622
636
  #
623
637
  # @!attribute [rw] endpoint
624
- # The hostname or hostname:port of the service endpoint.
625
- # Defaults to `"run.googleapis.com"`.
626
- # @return [::String]
638
+ # A custom service endpoint, as a hostname or hostname:port. The default is
639
+ # nil, indicating to use the default endpoint in the current universe domain.
640
+ # @return [::String,nil]
627
641
  # @!attribute [rw] credentials
628
642
  # Credentials to send with calls. You may provide any of the following types:
629
643
  # * (`String`) The path to a service account key file in JSON format
@@ -669,13 +683,20 @@ module Google
669
683
  # @!attribute [rw] quota_project
670
684
  # A separate project against which to charge quota.
671
685
  # @return [::String]
686
+ # @!attribute [rw] universe_domain
687
+ # The universe domain within which to make requests. This determines the
688
+ # default endpoint URL. The default value of nil uses the environment
689
+ # universe (usually the default "googleapis.com" universe).
690
+ # @return [::String,nil]
672
691
  #
673
692
  class Configuration
674
693
  extend ::Gapic::Config
675
694
 
695
+ # @private
696
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
676
697
  DEFAULT_ENDPOINT = "run.googleapis.com"
677
698
 
678
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
699
+ config_attr :endpoint, nil, ::String, nil
679
700
  config_attr :credentials, nil do |value|
680
701
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
681
702
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -690,6 +711,7 @@ module Google
690
711
  config_attr :metadata, nil, ::Hash, nil
691
712
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
692
713
  config_attr :quota_project, nil, ::String, nil
714
+ config_attr :universe_domain, nil, ::String, nil
693
715
 
694
716
  # @private
695
717
  def initialize parent_config = nil
@@ -33,6 +33,9 @@ module Google
33
33
  # Cloud Run Revision Control Plane API.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
38
+
36
39
  include Paths
37
40
 
38
41
  # @private
@@ -93,6 +96,15 @@ module Google
93
96
  @config
94
97
  end
95
98
 
99
+ ##
100
+ # The effective universe domain
101
+ #
102
+ # @return [String]
103
+ #
104
+ def universe_domain
105
+ @revisions_stub.universe_domain
106
+ end
107
+
96
108
  ##
97
109
  # Create a new Revisions REST client object.
98
110
  #
@@ -120,8 +132,9 @@ module Google
120
132
  credentials = @config.credentials
121
133
  # Use self-signed JWT if the endpoint is unchanged from default,
122
134
  # but only if the default endpoint does not have a region prefix.
123
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
124
- !@config.endpoint.split(".").first.include?("-")
135
+ enable_self_signed_jwt = @config.endpoint.nil? ||
136
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
137
+ !@config.endpoint.split(".").first.include?("-"))
125
138
  credentials ||= Credentials.default scope: @config.scope,
126
139
  enable_self_signed_jwt: enable_self_signed_jwt
127
140
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -135,15 +148,22 @@ module Google
135
148
  config.credentials = credentials
136
149
  config.quota_project = @quota_project_id
137
150
  config.endpoint = @config.endpoint
151
+ config.universe_domain = @config.universe_domain
138
152
  end
139
153
 
154
+ @revisions_stub = ::Google::Cloud::Run::V2::Revisions::Rest::ServiceStub.new(
155
+ endpoint: @config.endpoint,
156
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
157
+ universe_domain: @config.universe_domain,
158
+ credentials: credentials
159
+ )
160
+
140
161
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
141
162
  config.credentials = credentials
142
163
  config.quota_project = @quota_project_id
143
- config.endpoint = @config.endpoint
164
+ config.endpoint = @revisions_stub.endpoint
165
+ config.universe_domain = @revisions_stub.universe_domain
144
166
  end
145
-
146
- @revisions_stub = ::Google::Cloud::Run::V2::Revisions::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
147
167
  end
148
168
 
149
169
  ##
@@ -459,9 +479,9 @@ module Google
459
479
  # end
460
480
  #
461
481
  # @!attribute [rw] endpoint
462
- # The hostname or hostname:port of the service endpoint.
463
- # Defaults to `"run.googleapis.com"`.
464
- # @return [::String]
482
+ # A custom service endpoint, as a hostname or hostname:port. The default is
483
+ # nil, indicating to use the default endpoint in the current universe domain.
484
+ # @return [::String,nil]
465
485
  # @!attribute [rw] credentials
466
486
  # Credentials to send with calls. You may provide any of the following types:
467
487
  # * (`String`) The path to a service account key file in JSON format
@@ -498,13 +518,20 @@ module Google
498
518
  # @!attribute [rw] quota_project
499
519
  # A separate project against which to charge quota.
500
520
  # @return [::String]
521
+ # @!attribute [rw] universe_domain
522
+ # The universe domain within which to make requests. This determines the
523
+ # default endpoint URL. The default value of nil uses the environment
524
+ # universe (usually the default "googleapis.com" universe).
525
+ # @return [::String,nil]
501
526
  #
502
527
  class Configuration
503
528
  extend ::Gapic::Config
504
529
 
530
+ # @private
531
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
505
532
  DEFAULT_ENDPOINT = "run.googleapis.com"
506
533
 
507
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
534
+ config_attr :endpoint, nil, ::String, nil
508
535
  config_attr :credentials, nil do |value|
509
536
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
510
537
  allowed.any? { |klass| klass === value }
@@ -516,6 +543,7 @@ module Google
516
543
  config_attr :metadata, nil, ::Hash, nil
517
544
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
518
545
  config_attr :quota_project, nil, ::String, nil
546
+ config_attr :universe_domain, nil, ::String, nil
519
547
 
520
548
  # @private
521
549
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module Rest
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
31
+
29
32
  # @private
30
33
  attr_reader :operations_stub
31
34
 
@@ -60,6 +63,15 @@ module Google
60
63
  @config
61
64
  end
62
65
 
66
+ ##
67
+ # The effective universe domain
68
+ #
69
+ # @return [String]
70
+ #
71
+ def universe_domain
72
+ @operations_stub.universe_domain
73
+ end
74
+
63
75
  ##
64
76
  # Create a new Operations client object.
65
77
  #
@@ -84,8 +96,10 @@ module Google
84
96
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
85
97
 
86
98
  @operations_stub = OperationsServiceStub.new(
87
- endpoint: @config.endpoint,
88
- credentials: credentials
99
+ endpoint: @config.endpoint,
100
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
101
+ universe_domain: @config.universe_domain,
102
+ credentials: credentials
89
103
  )
90
104
 
91
105
  # Used by an LRO wrapper for some methods of this service
@@ -576,9 +590,9 @@ module Google
576
590
  # end
577
591
  #
578
592
  # @!attribute [rw] endpoint
579
- # The hostname or hostname:port of the service endpoint.
580
- # Defaults to `"run.googleapis.com"`.
581
- # @return [::String]
593
+ # A custom service endpoint, as a hostname or hostname:port. The default is
594
+ # nil, indicating to use the default endpoint in the current universe domain.
595
+ # @return [::String,nil]
582
596
  # @!attribute [rw] credentials
583
597
  # Credentials to send with calls. You may provide any of the following types:
584
598
  # * (`String`) The path to a service account key file in JSON format
@@ -615,13 +629,20 @@ module Google
615
629
  # @!attribute [rw] quota_project
616
630
  # A separate project against which to charge quota.
617
631
  # @return [::String]
632
+ # @!attribute [rw] universe_domain
633
+ # The universe domain within which to make requests. This determines the
634
+ # default endpoint URL. The default value of nil uses the environment
635
+ # universe (usually the default "googleapis.com" universe).
636
+ # @return [::String,nil]
618
637
  #
619
638
  class Configuration
620
639
  extend ::Gapic::Config
621
640
 
641
+ # @private
642
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
622
643
  DEFAULT_ENDPOINT = "run.googleapis.com"
623
644
 
624
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
645
+ config_attr :endpoint, nil, ::String, nil
625
646
  config_attr :credentials, nil do |value|
626
647
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
627
648
  allowed.any? { |klass| klass === value }
@@ -633,6 +654,7 @@ module Google
633
654
  config_attr :metadata, nil, ::Hash, nil
634
655
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
635
656
  config_attr :quota_project, nil, ::String, nil
657
+ config_attr :universe_domain, nil, ::String, nil
636
658
 
637
659
  # @private
638
660
  def initialize parent_config = nil
@@ -722,12 +744,15 @@ module Google
722
744
  # Service stub contains baseline method implementations
723
745
  # including transcoding, making the REST call, and deserialing the response.
724
746
  class OperationsServiceStub
725
- def initialize endpoint:, credentials:
747
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
726
748
  # These require statements are intentionally placed here to initialize
727
749
  # the REST modules only when it's required.
728
750
  require "gapic/rest"
729
751
 
730
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
752
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
753
+ endpoint_template: endpoint_template,
754
+ universe_domain: universe_domain,
755
+ credentials: credentials
731
756
  end
732
757
 
733
758
  ##
@@ -30,16 +30,37 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, credentials:
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
34
  # These require statements are intentionally placed here to initialize
35
35
  # the REST modules only when it's required.
36
36
  require "gapic/rest"
37
37
 
38
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
39
+ endpoint_template: endpoint_template,
40
+ universe_domain: universe_domain,
41
+ credentials: credentials,
39
42
  numeric_enums: true,
40
43
  raise_faraday_errors: false
41
44
  end
42
45
 
46
+ ##
47
+ # The effective universe domain
48
+ #
49
+ # @return [String]
50
+ #
51
+ def universe_domain
52
+ @client_stub.universe_domain
53
+ end
54
+
55
+ ##
56
+ # The effective endpoint
57
+ #
58
+ # @return [String]
59
+ #
60
+ def endpoint
61
+ @client_stub.endpoint
62
+ end
63
+
43
64
  ##
44
65
  # Baseline implementation for the get_revision REST call
45
66
  #
@@ -31,6 +31,9 @@ module Google
31
31
  # Cloud Run Service Control Plane API
32
32
  #
33
33
  class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
36
+
34
37
  include Paths
35
38
 
36
39
  # @private
@@ -107,6 +110,15 @@ module Google
107
110
  @config
108
111
  end
109
112
 
113
+ ##
114
+ # The effective universe domain
115
+ #
116
+ # @return [String]
117
+ #
118
+ def universe_domain
119
+ @services_stub.universe_domain
120
+ end
121
+
110
122
  ##
111
123
  # Create a new Services client object.
112
124
  #
@@ -140,8 +152,9 @@ module Google
140
152
  credentials = @config.credentials
141
153
  # Use self-signed JWT if the endpoint is unchanged from default,
142
154
  # but only if the default endpoint does not have a region prefix.
143
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
144
- !@config.endpoint.split(".").first.include?("-")
155
+ enable_self_signed_jwt = @config.endpoint.nil? ||
156
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
157
+ !@config.endpoint.split(".").first.include?("-"))
145
158
  credentials ||= Credentials.default scope: @config.scope,
146
159
  enable_self_signed_jwt: enable_self_signed_jwt
147
160
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -154,22 +167,26 @@ module Google
154
167
  config.credentials = credentials
155
168
  config.quota_project = @quota_project_id
156
169
  config.endpoint = @config.endpoint
157
- end
158
-
159
- @location_client = Google::Cloud::Location::Locations::Client.new do |config|
160
- config.credentials = credentials
161
- config.quota_project = @quota_project_id
162
- config.endpoint = @config.endpoint
170
+ config.universe_domain = @config.universe_domain
163
171
  end
164
172
 
165
173
  @services_stub = ::Gapic::ServiceStub.new(
166
174
  ::Google::Cloud::Run::V2::Services::Stub,
167
- credentials: credentials,
168
- endpoint: @config.endpoint,
175
+ credentials: credentials,
176
+ endpoint: @config.endpoint,
177
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
178
+ universe_domain: @config.universe_domain,
169
179
  channel_args: @config.channel_args,
170
180
  interceptors: @config.interceptors,
171
181
  channel_pool_config: @config.channel_pool
172
182
  )
183
+
184
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
185
+ config.credentials = credentials
186
+ config.quota_project = @quota_project_id
187
+ config.endpoint = @services_stub.endpoint
188
+ config.universe_domain = @services_stub.universe_domain
189
+ end
173
190
  end
174
191
 
175
192
  ##
@@ -1008,9 +1025,9 @@ module Google
1008
1025
  # end
1009
1026
  #
1010
1027
  # @!attribute [rw] endpoint
1011
- # The hostname or hostname:port of the service endpoint.
1012
- # Defaults to `"run.googleapis.com"`.
1013
- # @return [::String]
1028
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1029
+ # nil, indicating to use the default endpoint in the current universe domain.
1030
+ # @return [::String,nil]
1014
1031
  # @!attribute [rw] credentials
1015
1032
  # Credentials to send with calls. You may provide any of the following types:
1016
1033
  # * (`String`) The path to a service account key file in JSON format
@@ -1056,13 +1073,20 @@ module Google
1056
1073
  # @!attribute [rw] quota_project
1057
1074
  # A separate project against which to charge quota.
1058
1075
  # @return [::String]
1076
+ # @!attribute [rw] universe_domain
1077
+ # The universe domain within which to make requests. This determines the
1078
+ # default endpoint URL. The default value of nil uses the environment
1079
+ # universe (usually the default "googleapis.com" universe).
1080
+ # @return [::String,nil]
1059
1081
  #
1060
1082
  class Configuration
1061
1083
  extend ::Gapic::Config
1062
1084
 
1085
+ # @private
1086
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1063
1087
  DEFAULT_ENDPOINT = "run.googleapis.com"
1064
1088
 
1065
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1089
+ config_attr :endpoint, nil, ::String, nil
1066
1090
  config_attr :credentials, nil do |value|
1067
1091
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1068
1092
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -1077,6 +1101,7 @@ module Google
1077
1101
  config_attr :metadata, nil, ::Hash, nil
1078
1102
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1079
1103
  config_attr :quota_project, nil, ::String, nil
1104
+ config_attr :universe_domain, nil, ::String, nil
1080
1105
 
1081
1106
  # @private
1082
1107
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module Services
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
31
+
29
32
  # @private
30
33
  attr_reader :operations_stub
31
34
 
@@ -60,6 +63,15 @@ module Google
60
63
  @config
61
64
  end
62
65
 
66
+ ##
67
+ # The effective universe domain
68
+ #
69
+ # @return [String]
70
+ #
71
+ def universe_domain
72
+ @operations_stub.universe_domain
73
+ end
74
+
63
75
  ##
64
76
  # Create a new Operations client object.
65
77
  #
@@ -90,8 +102,10 @@ module Google
90
102
 
91
103
  @operations_stub = ::Gapic::ServiceStub.new(
92
104
  ::Google::Longrunning::Operations::Stub,
93
- credentials: credentials,
94
- endpoint: @config.endpoint,
105
+ credentials: credentials,
106
+ endpoint: @config.endpoint,
107
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
108
+ universe_domain: @config.universe_domain,
95
109
  channel_args: @config.channel_args,
96
110
  interceptors: @config.interceptors,
97
111
  channel_pool_config: @config.channel_pool
@@ -621,9 +635,9 @@ module Google
621
635
  # end
622
636
  #
623
637
  # @!attribute [rw] endpoint
624
- # The hostname or hostname:port of the service endpoint.
625
- # Defaults to `"run.googleapis.com"`.
626
- # @return [::String]
638
+ # A custom service endpoint, as a hostname or hostname:port. The default is
639
+ # nil, indicating to use the default endpoint in the current universe domain.
640
+ # @return [::String,nil]
627
641
  # @!attribute [rw] credentials
628
642
  # Credentials to send with calls. You may provide any of the following types:
629
643
  # * (`String`) The path to a service account key file in JSON format
@@ -669,13 +683,20 @@ module Google
669
683
  # @!attribute [rw] quota_project
670
684
  # A separate project against which to charge quota.
671
685
  # @return [::String]
686
+ # @!attribute [rw] universe_domain
687
+ # The universe domain within which to make requests. This determines the
688
+ # default endpoint URL. The default value of nil uses the environment
689
+ # universe (usually the default "googleapis.com" universe).
690
+ # @return [::String,nil]
672
691
  #
673
692
  class Configuration
674
693
  extend ::Gapic::Config
675
694
 
695
+ # @private
696
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
676
697
  DEFAULT_ENDPOINT = "run.googleapis.com"
677
698
 
678
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
699
+ config_attr :endpoint, nil, ::String, nil
679
700
  config_attr :credentials, nil do |value|
680
701
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
681
702
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -690,6 +711,7 @@ module Google
690
711
  config_attr :metadata, nil, ::Hash, nil
691
712
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
692
713
  config_attr :quota_project, nil, ::String, nil
714
+ config_attr :universe_domain, nil, ::String, nil
693
715
 
694
716
  # @private
695
717
  def initialize parent_config = nil
@@ -33,6 +33,9 @@ module Google
33
33
  # Cloud Run Service Control Plane API
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
38
+
36
39
  include Paths
37
40
 
38
41
  # @private
@@ -109,6 +112,15 @@ module Google
109
112
  @config
110
113
  end
111
114
 
115
+ ##
116
+ # The effective universe domain
117
+ #
118
+ # @return [String]
119
+ #
120
+ def universe_domain
121
+ @services_stub.universe_domain
122
+ end
123
+
112
124
  ##
113
125
  # Create a new Services REST client object.
114
126
  #
@@ -136,8 +148,9 @@ module Google
136
148
  credentials = @config.credentials
137
149
  # Use self-signed JWT if the endpoint is unchanged from default,
138
150
  # but only if the default endpoint does not have a region prefix.
139
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
140
- !@config.endpoint.split(".").first.include?("-")
151
+ enable_self_signed_jwt = @config.endpoint.nil? ||
152
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
153
+ !@config.endpoint.split(".").first.include?("-"))
141
154
  credentials ||= Credentials.default scope: @config.scope,
142
155
  enable_self_signed_jwt: enable_self_signed_jwt
143
156
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -151,15 +164,22 @@ module Google
151
164
  config.credentials = credentials
152
165
  config.quota_project = @quota_project_id
153
166
  config.endpoint = @config.endpoint
167
+ config.universe_domain = @config.universe_domain
154
168
  end
155
169
 
170
+ @services_stub = ::Google::Cloud::Run::V2::Services::Rest::ServiceStub.new(
171
+ endpoint: @config.endpoint,
172
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
173
+ universe_domain: @config.universe_domain,
174
+ credentials: credentials
175
+ )
176
+
156
177
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
157
178
  config.credentials = credentials
158
179
  config.quota_project = @quota_project_id
159
- config.endpoint = @config.endpoint
180
+ config.endpoint = @services_stub.endpoint
181
+ config.universe_domain = @services_stub.universe_domain
160
182
  end
161
-
162
- @services_stub = ::Google::Cloud::Run::V2::Services::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
163
183
  end
164
184
 
165
185
  ##
@@ -927,9 +947,9 @@ module Google
927
947
  # end
928
948
  #
929
949
  # @!attribute [rw] endpoint
930
- # The hostname or hostname:port of the service endpoint.
931
- # Defaults to `"run.googleapis.com"`.
932
- # @return [::String]
950
+ # A custom service endpoint, as a hostname or hostname:port. The default is
951
+ # nil, indicating to use the default endpoint in the current universe domain.
952
+ # @return [::String,nil]
933
953
  # @!attribute [rw] credentials
934
954
  # Credentials to send with calls. You may provide any of the following types:
935
955
  # * (`String`) The path to a service account key file in JSON format
@@ -966,13 +986,20 @@ module Google
966
986
  # @!attribute [rw] quota_project
967
987
  # A separate project against which to charge quota.
968
988
  # @return [::String]
989
+ # @!attribute [rw] universe_domain
990
+ # The universe domain within which to make requests. This determines the
991
+ # default endpoint URL. The default value of nil uses the environment
992
+ # universe (usually the default "googleapis.com" universe).
993
+ # @return [::String,nil]
969
994
  #
970
995
  class Configuration
971
996
  extend ::Gapic::Config
972
997
 
998
+ # @private
999
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
973
1000
  DEFAULT_ENDPOINT = "run.googleapis.com"
974
1001
 
975
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1002
+ config_attr :endpoint, nil, ::String, nil
976
1003
  config_attr :credentials, nil do |value|
977
1004
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
978
1005
  allowed.any? { |klass| klass === value }
@@ -984,6 +1011,7 @@ module Google
984
1011
  config_attr :metadata, nil, ::Hash, nil
985
1012
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
986
1013
  config_attr :quota_project, nil, ::String, nil
1014
+ config_attr :universe_domain, nil, ::String, nil
987
1015
 
988
1016
  # @private
989
1017
  def initialize parent_config = nil