google-cloud-dialogflow-v2 0.31.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/lib/google/cloud/dialogflow/v2/agents/client.rb +33 -8
  4. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +28 -6
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +35 -7
  6. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +33 -8
  7. data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +14 -2
  8. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +32 -8
  9. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +34 -7
  10. data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +14 -2
  11. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +32 -8
  12. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +34 -7
  13. data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +14 -2
  14. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +33 -8
  15. data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +28 -6
  16. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +35 -7
  17. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +33 -8
  18. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +14 -2
  19. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +33 -8
  20. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +28 -6
  21. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +35 -7
  22. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +33 -8
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +14 -2
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +33 -8
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +28 -6
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +35 -7
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +33 -8
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +14 -2
  29. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +32 -8
  30. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +34 -7
  31. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +14 -2
  32. data/lib/google/cloud/dialogflow/v2/documents/client.rb +33 -8
  33. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +28 -6
  34. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +35 -7
  35. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +33 -8
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +14 -2
  37. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +33 -8
  38. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +28 -6
  39. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +35 -7
  40. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +33 -8
  41. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +14 -2
  42. data/lib/google/cloud/dialogflow/v2/environments/client.rb +32 -8
  43. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +34 -7
  44. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +14 -2
  45. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +32 -8
  46. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +34 -7
  47. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +14 -2
  48. data/lib/google/cloud/dialogflow/v2/intents/client.rb +33 -8
  49. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +28 -6
  50. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +35 -7
  51. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +33 -8
  52. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +14 -2
  53. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +32 -8
  54. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +34 -7
  55. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +14 -2
  56. data/lib/google/cloud/dialogflow/v2/participants/client.rb +32 -8
  57. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +34 -7
  58. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +14 -2
  59. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +32 -8
  60. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +34 -7
  61. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +14 -2
  62. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +32 -8
  63. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +34 -7
  64. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +14 -2
  65. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  66. data/lib/google/cloud/dialogflow/v2/versions/client.rb +32 -8
  67. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +34 -7
  68. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +14 -2
  69. data/proto_docs/google/api/client.rb +1 -0
  70. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +1 -0
  71. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +1 -0
  72. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +1 -0
  73. data/proto_docs/google/cloud/dialogflow/v2/fulfillment.rb +1 -0
  74. data/proto_docs/google/cloud/dialogflow/v2/session.rb +1 -0
  75. metadata +6 -6
@@ -30,16 +30,28 @@ 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
+
43
55
  ##
44
56
  # Baseline implementation for the get_agent REST call
45
57
  #
@@ -32,6 +32,9 @@ module Google
32
32
  # {::Google::Cloud::Dialogflow::V2::AnswerRecord AnswerRecords}.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$UNIVERSE_DOMAIN$"
37
+
35
38
  include Paths
36
39
 
37
40
  # @private
@@ -97,6 +100,15 @@ module Google
97
100
  @config
98
101
  end
99
102
 
103
+ ##
104
+ # The effective universe domain
105
+ #
106
+ # @return [String]
107
+ #
108
+ def universe_domain
109
+ @answer_records_stub.universe_domain
110
+ end
111
+
100
112
  ##
101
113
  # Create a new AnswerRecords client object.
102
114
  #
@@ -130,8 +142,9 @@ module Google
130
142
  credentials = @config.credentials
131
143
  # Use self-signed JWT if the endpoint is unchanged from default,
132
144
  # but only if the default endpoint does not have a region prefix.
133
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
134
- !@config.endpoint.split(".").first.include?("-")
145
+ enable_self_signed_jwt = @config.endpoint.nil? ||
146
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
147
+ !@config.endpoint.split(".").first.include?("-"))
135
148
  credentials ||= Credentials.default scope: @config.scope,
136
149
  enable_self_signed_jwt: enable_self_signed_jwt
137
150
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -144,12 +157,15 @@ module Google
144
157
  config.credentials = credentials
145
158
  config.quota_project = @quota_project_id
146
159
  config.endpoint = @config.endpoint
160
+ config.universe_domain = @config.universe_domain
147
161
  end
148
162
 
149
163
  @answer_records_stub = ::Gapic::ServiceStub.new(
150
164
  ::Google::Cloud::Dialogflow::V2::AnswerRecords::Stub,
151
- credentials: credentials,
152
- endpoint: @config.endpoint,
165
+ credentials: credentials,
166
+ endpoint: @config.endpoint,
167
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
168
+ universe_domain: @config.universe_domain,
153
169
  channel_args: @config.channel_args,
154
170
  interceptors: @config.interceptors,
155
171
  channel_pool_config: @config.channel_pool
@@ -391,9 +407,9 @@ module Google
391
407
  # end
392
408
  #
393
409
  # @!attribute [rw] endpoint
394
- # The hostname or hostname:port of the service endpoint.
395
- # Defaults to `"dialogflow.googleapis.com"`.
396
- # @return [::String]
410
+ # A custom service endpoint, as a hostname or hostname:port. The default is
411
+ # nil, indicating to use the default endpoint in the current universe domain.
412
+ # @return [::String,nil]
397
413
  # @!attribute [rw] credentials
398
414
  # Credentials to send with calls. You may provide any of the following types:
399
415
  # * (`String`) The path to a service account key file in JSON format
@@ -439,13 +455,20 @@ module Google
439
455
  # @!attribute [rw] quota_project
440
456
  # A separate project against which to charge quota.
441
457
  # @return [::String]
458
+ # @!attribute [rw] universe_domain
459
+ # The universe domain within which to make requests. This determines the
460
+ # default endpoint URL. The default value of nil uses the environment
461
+ # universe (usually the default "googleapis.com" universe).
462
+ # @return [::String,nil]
442
463
  #
443
464
  class Configuration
444
465
  extend ::Gapic::Config
445
466
 
467
+ # @private
468
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
446
469
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
447
470
 
448
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
471
+ config_attr :endpoint, nil, ::String, nil
449
472
  config_attr :credentials, nil do |value|
450
473
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
451
474
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -460,6 +483,7 @@ module Google
460
483
  config_attr :metadata, nil, ::Hash, nil
461
484
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
462
485
  config_attr :quota_project, nil, ::String, nil
486
+ config_attr :universe_domain, nil, ::String, nil
463
487
 
464
488
  # @private
465
489
  def initialize parent_config = nil
@@ -34,6 +34,9 @@ module Google
34
34
  # {::Google::Cloud::Dialogflow::V2::AnswerRecord AnswerRecords}.
35
35
  #
36
36
  class Client
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$UNIVERSE_DOMAIN$"
39
+
37
40
  include Paths
38
41
 
39
42
  # @private
@@ -99,6 +102,15 @@ module Google
99
102
  @config
100
103
  end
101
104
 
105
+ ##
106
+ # The effective universe domain
107
+ #
108
+ # @return [String]
109
+ #
110
+ def universe_domain
111
+ @answer_records_stub.universe_domain
112
+ end
113
+
102
114
  ##
103
115
  # Create a new AnswerRecords REST client object.
104
116
  #
@@ -126,8 +138,9 @@ module Google
126
138
  credentials = @config.credentials
127
139
  # Use self-signed JWT if the endpoint is unchanged from default,
128
140
  # but only if the default endpoint does not have a region prefix.
129
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
130
- !@config.endpoint.split(".").first.include?("-")
141
+ enable_self_signed_jwt = @config.endpoint.nil? ||
142
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
143
+ !@config.endpoint.split(".").first.include?("-"))
131
144
  credentials ||= Credentials.default scope: @config.scope,
132
145
  enable_self_signed_jwt: enable_self_signed_jwt
133
146
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -141,10 +154,16 @@ module Google
141
154
  config.credentials = credentials
142
155
  config.quota_project = @quota_project_id
143
156
  config.endpoint = @config.endpoint
157
+ config.universe_domain = @config.universe_domain
144
158
  config.bindings_override = @config.bindings_override
145
159
  end
146
160
 
147
- @answer_records_stub = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
161
+ @answer_records_stub = ::Google::Cloud::Dialogflow::V2::AnswerRecords::Rest::ServiceStub.new(
162
+ endpoint: @config.endpoint,
163
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
164
+ universe_domain: @config.universe_domain,
165
+ credentials: credentials
166
+ )
148
167
  end
149
168
 
150
169
  ##
@@ -368,9 +387,9 @@ module Google
368
387
  # end
369
388
  #
370
389
  # @!attribute [rw] endpoint
371
- # The hostname or hostname:port of the service endpoint.
372
- # Defaults to `"dialogflow.googleapis.com"`.
373
- # @return [::String]
390
+ # A custom service endpoint, as a hostname or hostname:port. The default is
391
+ # nil, indicating to use the default endpoint in the current universe domain.
392
+ # @return [::String,nil]
374
393
  # @!attribute [rw] credentials
375
394
  # Credentials to send with calls. You may provide any of the following types:
376
395
  # * (`String`) The path to a service account key file in JSON format
@@ -407,13 +426,20 @@ module Google
407
426
  # @!attribute [rw] quota_project
408
427
  # A separate project against which to charge quota.
409
428
  # @return [::String]
429
+ # @!attribute [rw] universe_domain
430
+ # The universe domain within which to make requests. This determines the
431
+ # default endpoint URL. The default value of nil uses the environment
432
+ # universe (usually the default "googleapis.com" universe).
433
+ # @return [::String,nil]
410
434
  #
411
435
  class Configuration
412
436
  extend ::Gapic::Config
413
437
 
438
+ # @private
439
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
414
440
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
415
441
 
416
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
442
+ config_attr :endpoint, nil, ::String, nil
417
443
  config_attr :credentials, nil do |value|
418
444
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
419
445
  allowed.any? { |klass| klass === value }
@@ -425,6 +451,7 @@ module Google
425
451
  config_attr :metadata, nil, ::Hash, nil
426
452
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
427
453
  config_attr :quota_project, nil, ::String, nil
454
+ config_attr :universe_domain, nil, ::String, nil
428
455
 
429
456
  # @private
430
457
  # Overrides for http bindings for the RPCs of this service
@@ -30,16 +30,28 @@ 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
+
43
55
  ##
44
56
  # Baseline implementation for the list_answer_records REST call
45
57
  #
@@ -31,6 +31,9 @@ module Google
31
31
  # Service for managing {::Google::Cloud::Dialogflow::V2::Context Contexts}.
32
32
  #
33
33
  class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$UNIVERSE_DOMAIN$"
36
+
34
37
  include Paths
35
38
 
36
39
  # @private
@@ -96,6 +99,15 @@ module Google
96
99
  @config
97
100
  end
98
101
 
102
+ ##
103
+ # The effective universe domain
104
+ #
105
+ # @return [String]
106
+ #
107
+ def universe_domain
108
+ @contexts_stub.universe_domain
109
+ end
110
+
99
111
  ##
100
112
  # Create a new Contexts client object.
101
113
  #
@@ -129,8 +141,9 @@ module Google
129
141
  credentials = @config.credentials
130
142
  # Use self-signed JWT if the endpoint is unchanged from default,
131
143
  # but only if the default endpoint does not have a region prefix.
132
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
133
- !@config.endpoint.split(".").first.include?("-")
144
+ enable_self_signed_jwt = @config.endpoint.nil? ||
145
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
146
+ !@config.endpoint.split(".").first.include?("-"))
134
147
  credentials ||= Credentials.default scope: @config.scope,
135
148
  enable_self_signed_jwt: enable_self_signed_jwt
136
149
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -143,12 +156,15 @@ module Google
143
156
  config.credentials = credentials
144
157
  config.quota_project = @quota_project_id
145
158
  config.endpoint = @config.endpoint
159
+ config.universe_domain = @config.universe_domain
146
160
  end
147
161
 
148
162
  @contexts_stub = ::Gapic::ServiceStub.new(
149
163
  ::Google::Cloud::Dialogflow::V2::Contexts::Stub,
150
- credentials: credentials,
151
- endpoint: @config.endpoint,
164
+ credentials: credentials,
165
+ endpoint: @config.endpoint,
166
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
167
+ universe_domain: @config.universe_domain,
152
168
  channel_args: @config.channel_args,
153
169
  interceptors: @config.interceptors,
154
170
  channel_pool_config: @config.channel_pool
@@ -745,9 +761,9 @@ module Google
745
761
  # end
746
762
  #
747
763
  # @!attribute [rw] endpoint
748
- # The hostname or hostname:port of the service endpoint.
749
- # Defaults to `"dialogflow.googleapis.com"`.
750
- # @return [::String]
764
+ # A custom service endpoint, as a hostname or hostname:port. The default is
765
+ # nil, indicating to use the default endpoint in the current universe domain.
766
+ # @return [::String,nil]
751
767
  # @!attribute [rw] credentials
752
768
  # Credentials to send with calls. You may provide any of the following types:
753
769
  # * (`String`) The path to a service account key file in JSON format
@@ -793,13 +809,20 @@ module Google
793
809
  # @!attribute [rw] quota_project
794
810
  # A separate project against which to charge quota.
795
811
  # @return [::String]
812
+ # @!attribute [rw] universe_domain
813
+ # The universe domain within which to make requests. This determines the
814
+ # default endpoint URL. The default value of nil uses the environment
815
+ # universe (usually the default "googleapis.com" universe).
816
+ # @return [::String,nil]
796
817
  #
797
818
  class Configuration
798
819
  extend ::Gapic::Config
799
820
 
821
+ # @private
822
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
800
823
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
801
824
 
802
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
825
+ config_attr :endpoint, nil, ::String, nil
803
826
  config_attr :credentials, nil do |value|
804
827
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
805
828
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -814,6 +837,7 @@ module Google
814
837
  config_attr :metadata, nil, ::Hash, nil
815
838
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
816
839
  config_attr :quota_project, nil, ::String, nil
840
+ config_attr :universe_domain, nil, ::String, nil
817
841
 
818
842
  # @private
819
843
  def initialize parent_config = nil
@@ -33,6 +33,9 @@ module Google
33
33
  # Service for managing {::Google::Cloud::Dialogflow::V2::Context Contexts}.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$UNIVERSE_DOMAIN$"
38
+
36
39
  include Paths
37
40
 
38
41
  # @private
@@ -98,6 +101,15 @@ module Google
98
101
  @config
99
102
  end
100
103
 
104
+ ##
105
+ # The effective universe domain
106
+ #
107
+ # @return [String]
108
+ #
109
+ def universe_domain
110
+ @contexts_stub.universe_domain
111
+ end
112
+
101
113
  ##
102
114
  # Create a new Contexts REST client object.
103
115
  #
@@ -125,8 +137,9 @@ module Google
125
137
  credentials = @config.credentials
126
138
  # Use self-signed JWT if the endpoint is unchanged from default,
127
139
  # but only if the default endpoint does not have a region prefix.
128
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
129
- !@config.endpoint.split(".").first.include?("-")
140
+ enable_self_signed_jwt = @config.endpoint.nil? ||
141
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-"))
130
143
  credentials ||= Credentials.default scope: @config.scope,
131
144
  enable_self_signed_jwt: enable_self_signed_jwt
132
145
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -140,10 +153,16 @@ module Google
140
153
  config.credentials = credentials
141
154
  config.quota_project = @quota_project_id
142
155
  config.endpoint = @config.endpoint
156
+ config.universe_domain = @config.universe_domain
143
157
  config.bindings_override = @config.bindings_override
144
158
  end
145
159
 
146
- @contexts_stub = ::Google::Cloud::Dialogflow::V2::Contexts::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
160
+ @contexts_stub = ::Google::Cloud::Dialogflow::V2::Contexts::Rest::ServiceStub.new(
161
+ endpoint: @config.endpoint,
162
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
+ universe_domain: @config.universe_domain,
164
+ credentials: credentials
165
+ )
147
166
  end
148
167
 
149
168
  ##
@@ -694,9 +713,9 @@ module Google
694
713
  # end
695
714
  #
696
715
  # @!attribute [rw] endpoint
697
- # The hostname or hostname:port of the service endpoint.
698
- # Defaults to `"dialogflow.googleapis.com"`.
699
- # @return [::String]
716
+ # A custom service endpoint, as a hostname or hostname:port. The default is
717
+ # nil, indicating to use the default endpoint in the current universe domain.
718
+ # @return [::String,nil]
700
719
  # @!attribute [rw] credentials
701
720
  # Credentials to send with calls. You may provide any of the following types:
702
721
  # * (`String`) The path to a service account key file in JSON format
@@ -733,13 +752,20 @@ module Google
733
752
  # @!attribute [rw] quota_project
734
753
  # A separate project against which to charge quota.
735
754
  # @return [::String]
755
+ # @!attribute [rw] universe_domain
756
+ # The universe domain within which to make requests. This determines the
757
+ # default endpoint URL. The default value of nil uses the environment
758
+ # universe (usually the default "googleapis.com" universe).
759
+ # @return [::String,nil]
736
760
  #
737
761
  class Configuration
738
762
  extend ::Gapic::Config
739
763
 
764
+ # @private
765
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
740
766
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
741
767
 
742
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
768
+ config_attr :endpoint, nil, ::String, nil
743
769
  config_attr :credentials, nil do |value|
744
770
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
745
771
  allowed.any? { |klass| klass === value }
@@ -751,6 +777,7 @@ module Google
751
777
  config_attr :metadata, nil, ::Hash, nil
752
778
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
753
779
  config_attr :quota_project, nil, ::String, nil
780
+ config_attr :universe_domain, nil, ::String, nil
754
781
 
755
782
  # @private
756
783
  # Overrides for http bindings for the RPCs of this service
@@ -30,16 +30,28 @@ 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
+
43
55
  ##
44
56
  # Baseline implementation for the list_contexts REST call
45
57
  #
@@ -34,6 +34,9 @@ module Google
34
34
  # customizable metadata that can be used for model training.
35
35
  #
36
36
  class Client
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$UNIVERSE_DOMAIN$"
39
+
37
40
  include Paths
38
41
 
39
42
  # @private
@@ -99,6 +102,15 @@ module Google
99
102
  @config
100
103
  end
101
104
 
105
+ ##
106
+ # The effective universe domain
107
+ #
108
+ # @return [String]
109
+ #
110
+ def universe_domain
111
+ @conversation_datasets_stub.universe_domain
112
+ end
113
+
102
114
  ##
103
115
  # Create a new ConversationDatasets client object.
104
116
  #
@@ -132,8 +144,9 @@ module Google
132
144
  credentials = @config.credentials
133
145
  # Use self-signed JWT if the endpoint is unchanged from default,
134
146
  # but only if the default endpoint does not have a region prefix.
135
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
136
- !@config.endpoint.split(".").first.include?("-")
147
+ enable_self_signed_jwt = @config.endpoint.nil? ||
148
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
149
+ !@config.endpoint.split(".").first.include?("-"))
137
150
  credentials ||= Credentials.default scope: @config.scope,
138
151
  enable_self_signed_jwt: enable_self_signed_jwt
139
152
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -146,18 +159,22 @@ module Google
146
159
  config.credentials = credentials
147
160
  config.quota_project = @quota_project_id
148
161
  config.endpoint = @config.endpoint
162
+ config.universe_domain = @config.universe_domain
149
163
  end
150
164
 
151
165
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
152
166
  config.credentials = credentials
153
167
  config.quota_project = @quota_project_id
154
168
  config.endpoint = @config.endpoint
169
+ config.universe_domain = @config.universe_domain
155
170
  end
156
171
 
157
172
  @conversation_datasets_stub = ::Gapic::ServiceStub.new(
158
173
  ::Google::Cloud::Dialogflow::V2::ConversationDatasets::Stub,
159
- credentials: credentials,
160
- endpoint: @config.endpoint,
174
+ credentials: credentials,
175
+ endpoint: @config.endpoint,
176
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
177
+ universe_domain: @config.universe_domain,
161
178
  channel_args: @config.channel_args,
162
179
  interceptors: @config.interceptors,
163
180
  channel_pool_config: @config.channel_pool
@@ -711,9 +728,9 @@ module Google
711
728
  # end
712
729
  #
713
730
  # @!attribute [rw] endpoint
714
- # The hostname or hostname:port of the service endpoint.
715
- # Defaults to `"dialogflow.googleapis.com"`.
716
- # @return [::String]
731
+ # A custom service endpoint, as a hostname or hostname:port. The default is
732
+ # nil, indicating to use the default endpoint in the current universe domain.
733
+ # @return [::String,nil]
717
734
  # @!attribute [rw] credentials
718
735
  # Credentials to send with calls. You may provide any of the following types:
719
736
  # * (`String`) The path to a service account key file in JSON format
@@ -759,13 +776,20 @@ module Google
759
776
  # @!attribute [rw] quota_project
760
777
  # A separate project against which to charge quota.
761
778
  # @return [::String]
779
+ # @!attribute [rw] universe_domain
780
+ # The universe domain within which to make requests. This determines the
781
+ # default endpoint URL. The default value of nil uses the environment
782
+ # universe (usually the default "googleapis.com" universe).
783
+ # @return [::String,nil]
762
784
  #
763
785
  class Configuration
764
786
  extend ::Gapic::Config
765
787
 
788
+ # @private
789
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
766
790
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
767
791
 
768
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
792
+ config_attr :endpoint, nil, ::String, nil
769
793
  config_attr :credentials, nil do |value|
770
794
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
771
795
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -780,6 +804,7 @@ module Google
780
804
  config_attr :metadata, nil, ::Hash, nil
781
805
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
782
806
  config_attr :quota_project, nil, ::String, nil
807
+ config_attr :universe_domain, nil, ::String, nil
783
808
 
784
809
  # @private
785
810
  def initialize parent_config = nil