google-cloud-dialogflow-v2 0.31.0 → 0.32.1

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 +39 -14
  4. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +28 -6
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +37 -9
  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 +23 -2
  8. data/lib/google/cloud/dialogflow/v2/answer_records/client.rb +38 -14
  9. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +36 -9
  10. data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +23 -2
  11. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +38 -14
  12. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +36 -9
  13. data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +23 -2
  14. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +39 -14
  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 +37 -9
  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 +23 -2
  19. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +39 -14
  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 +37 -9
  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 +23 -2
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +39 -14
  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 +37 -9
  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 +23 -2
  29. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +38 -14
  30. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +36 -9
  31. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +23 -2
  32. data/lib/google/cloud/dialogflow/v2/documents/client.rb +39 -14
  33. data/lib/google/cloud/dialogflow/v2/documents/operations.rb +28 -6
  34. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +37 -9
  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 +23 -2
  37. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +39 -14
  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 +37 -9
  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 +23 -2
  42. data/lib/google/cloud/dialogflow/v2/environments/client.rb +38 -14
  43. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +36 -9
  44. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +23 -2
  45. data/lib/google/cloud/dialogflow/v2/fulfillments/client.rb +38 -14
  46. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +36 -9
  47. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +23 -2
  48. data/lib/google/cloud/dialogflow/v2/intents/client.rb +39 -14
  49. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +28 -6
  50. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +37 -9
  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 +23 -2
  53. data/lib/google/cloud/dialogflow/v2/knowledge_bases/client.rb +38 -14
  54. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +36 -9
  55. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +23 -2
  56. data/lib/google/cloud/dialogflow/v2/participants/client.rb +38 -14
  57. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +36 -9
  58. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +23 -2
  59. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +38 -14
  60. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +36 -9
  61. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +23 -2
  62. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +38 -14
  63. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +36 -9
  64. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +23 -2
  65. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  66. data/lib/google/cloud/dialogflow/v2/versions/client.rb +38 -14
  67. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +36 -9
  68. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +23 -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
@@ -32,6 +32,9 @@ module Google
32
32
  # {::Google::Cloud::Dialogflow::V2::Conversation Conversations}.
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
+ @conversations_stub.universe_domain
110
+ end
111
+
100
112
  ##
101
113
  # Create a new Conversations 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)
@@ -140,20 +153,23 @@ module Google
140
153
  @quota_project_id = @config.quota_project
141
154
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
142
155
 
143
- @location_client = Google::Cloud::Location::Locations::Client.new do |config|
144
- config.credentials = credentials
145
- config.quota_project = @quota_project_id
146
- config.endpoint = @config.endpoint
147
- end
148
-
149
156
  @conversations_stub = ::Gapic::ServiceStub.new(
150
157
  ::Google::Cloud::Dialogflow::V2::Conversations::Stub,
151
- credentials: credentials,
152
- endpoint: @config.endpoint,
158
+ credentials: credentials,
159
+ endpoint: @config.endpoint,
160
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
161
+ universe_domain: @config.universe_domain,
153
162
  channel_args: @config.channel_args,
154
163
  interceptors: @config.interceptors,
155
164
  channel_pool_config: @config.channel_pool
156
165
  )
166
+
167
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
168
+ config.credentials = credentials
169
+ config.quota_project = @quota_project_id
170
+ config.endpoint = @conversations_stub.endpoint
171
+ config.universe_domain = @conversations_stub.universe_domain
172
+ end
157
173
  end
158
174
 
159
175
  ##
@@ -1025,9 +1041,9 @@ module Google
1025
1041
  # end
1026
1042
  #
1027
1043
  # @!attribute [rw] endpoint
1028
- # The hostname or hostname:port of the service endpoint.
1029
- # Defaults to `"dialogflow.googleapis.com"`.
1030
- # @return [::String]
1044
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1045
+ # nil, indicating to use the default endpoint in the current universe domain.
1046
+ # @return [::String,nil]
1031
1047
  # @!attribute [rw] credentials
1032
1048
  # Credentials to send with calls. You may provide any of the following types:
1033
1049
  # * (`String`) The path to a service account key file in JSON format
@@ -1073,13 +1089,20 @@ module Google
1073
1089
  # @!attribute [rw] quota_project
1074
1090
  # A separate project against which to charge quota.
1075
1091
  # @return [::String]
1092
+ # @!attribute [rw] universe_domain
1093
+ # The universe domain within which to make requests. This determines the
1094
+ # default endpoint URL. The default value of nil uses the environment
1095
+ # universe (usually the default "googleapis.com" universe).
1096
+ # @return [::String,nil]
1076
1097
  #
1077
1098
  class Configuration
1078
1099
  extend ::Gapic::Config
1079
1100
 
1101
+ # @private
1102
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1080
1103
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
1081
1104
 
1082
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1105
+ config_attr :endpoint, nil, ::String, nil
1083
1106
  config_attr :credentials, nil do |value|
1084
1107
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1085
1108
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -1094,6 +1117,7 @@ module Google
1094
1117
  config_attr :metadata, nil, ::Hash, nil
1095
1118
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1096
1119
  config_attr :quota_project, nil, ::String, nil
1120
+ config_attr :universe_domain, nil, ::String, nil
1097
1121
 
1098
1122
  # @private
1099
1123
  def initialize parent_config = nil
@@ -34,6 +34,9 @@ module Google
34
34
  # {::Google::Cloud::Dialogflow::V2::Conversation Conversations}.
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
+ @conversations_stub.universe_domain
112
+ end
113
+
102
114
  ##
103
115
  # Create a new Conversations 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)
@@ -137,14 +150,20 @@ module Google
137
150
  @quota_project_id = @config.quota_project
138
151
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
139
152
 
153
+ @conversations_stub = ::Google::Cloud::Dialogflow::V2::Conversations::Rest::ServiceStub.new(
154
+ endpoint: @config.endpoint,
155
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
156
+ universe_domain: @config.universe_domain,
157
+ credentials: credentials
158
+ )
159
+
140
160
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
141
161
  config.credentials = credentials
142
162
  config.quota_project = @quota_project_id
143
- config.endpoint = @config.endpoint
163
+ config.endpoint = @conversations_stub.endpoint
164
+ config.universe_domain = @conversations_stub.universe_domain
144
165
  config.bindings_override = @config.bindings_override
145
166
  end
146
-
147
- @conversations_stub = ::Google::Cloud::Dialogflow::V2::Conversations::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
148
167
  end
149
168
 
150
169
  ##
@@ -960,9 +979,9 @@ module Google
960
979
  # end
961
980
  #
962
981
  # @!attribute [rw] endpoint
963
- # The hostname or hostname:port of the service endpoint.
964
- # Defaults to `"dialogflow.googleapis.com"`.
965
- # @return [::String]
982
+ # A custom service endpoint, as a hostname or hostname:port. The default is
983
+ # nil, indicating to use the default endpoint in the current universe domain.
984
+ # @return [::String,nil]
966
985
  # @!attribute [rw] credentials
967
986
  # Credentials to send with calls. You may provide any of the following types:
968
987
  # * (`String`) The path to a service account key file in JSON format
@@ -999,13 +1018,20 @@ module Google
999
1018
  # @!attribute [rw] quota_project
1000
1019
  # A separate project against which to charge quota.
1001
1020
  # @return [::String]
1021
+ # @!attribute [rw] universe_domain
1022
+ # The universe domain within which to make requests. This determines the
1023
+ # default endpoint URL. The default value of nil uses the environment
1024
+ # universe (usually the default "googleapis.com" universe).
1025
+ # @return [::String,nil]
1002
1026
  #
1003
1027
  class Configuration
1004
1028
  extend ::Gapic::Config
1005
1029
 
1030
+ # @private
1031
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1006
1032
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
1007
1033
 
1008
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1034
+ config_attr :endpoint, nil, ::String, nil
1009
1035
  config_attr :credentials, nil do |value|
1010
1036
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1011
1037
  allowed.any? { |klass| klass === value }
@@ -1017,6 +1043,7 @@ module Google
1017
1043
  config_attr :metadata, nil, ::Hash, nil
1018
1044
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1019
1045
  config_attr :quota_project, nil, ::String, nil
1046
+ config_attr :universe_domain, nil, ::String, nil
1020
1047
 
1021
1048
  # @private
1022
1049
  # Overrides for http bindings for the RPCs of this service
@@ -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 create_conversation REST call
45
66
  #
@@ -32,6 +32,9 @@ module Google
32
32
  # {::Google::Cloud::Dialogflow::V2::Document Documents}.
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
+ @documents_stub.universe_domain
110
+ end
111
+
100
112
  ##
101
113
  # Create a new Documents 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,22 +157,26 @@ module Google
144
157
  config.credentials = credentials
145
158
  config.quota_project = @quota_project_id
146
159
  config.endpoint = @config.endpoint
147
- end
148
-
149
- @location_client = Google::Cloud::Location::Locations::Client.new do |config|
150
- config.credentials = credentials
151
- config.quota_project = @quota_project_id
152
- config.endpoint = @config.endpoint
160
+ config.universe_domain = @config.universe_domain
153
161
  end
154
162
 
155
163
  @documents_stub = ::Gapic::ServiceStub.new(
156
164
  ::Google::Cloud::Dialogflow::V2::Documents::Stub,
157
- credentials: credentials,
158
- endpoint: @config.endpoint,
165
+ credentials: credentials,
166
+ endpoint: @config.endpoint,
167
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
168
+ universe_domain: @config.universe_domain,
159
169
  channel_args: @config.channel_args,
160
170
  interceptors: @config.interceptors,
161
171
  channel_pool_config: @config.channel_pool
162
172
  )
173
+
174
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
175
+ config.credentials = credentials
176
+ config.quota_project = @quota_project_id
177
+ config.endpoint = @documents_stub.endpoint
178
+ config.universe_domain = @documents_stub.universe_domain
179
+ end
163
180
  end
164
181
 
165
182
  ##
@@ -1079,9 +1096,9 @@ module Google
1079
1096
  # end
1080
1097
  #
1081
1098
  # @!attribute [rw] endpoint
1082
- # The hostname or hostname:port of the service endpoint.
1083
- # Defaults to `"dialogflow.googleapis.com"`.
1084
- # @return [::String]
1099
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1100
+ # nil, indicating to use the default endpoint in the current universe domain.
1101
+ # @return [::String,nil]
1085
1102
  # @!attribute [rw] credentials
1086
1103
  # Credentials to send with calls. You may provide any of the following types:
1087
1104
  # * (`String`) The path to a service account key file in JSON format
@@ -1127,13 +1144,20 @@ module Google
1127
1144
  # @!attribute [rw] quota_project
1128
1145
  # A separate project against which to charge quota.
1129
1146
  # @return [::String]
1147
+ # @!attribute [rw] universe_domain
1148
+ # The universe domain within which to make requests. This determines the
1149
+ # default endpoint URL. The default value of nil uses the environment
1150
+ # universe (usually the default "googleapis.com" universe).
1151
+ # @return [::String,nil]
1130
1152
  #
1131
1153
  class Configuration
1132
1154
  extend ::Gapic::Config
1133
1155
 
1156
+ # @private
1157
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1134
1158
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
1135
1159
 
1136
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1160
+ config_attr :endpoint, nil, ::String, nil
1137
1161
  config_attr :credentials, nil do |value|
1138
1162
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1139
1163
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -1148,6 +1172,7 @@ module Google
1148
1172
  config_attr :metadata, nil, ::Hash, nil
1149
1173
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1150
1174
  config_attr :quota_project, nil, ::String, nil
1175
+ config_attr :universe_domain, nil, ::String, nil
1151
1176
 
1152
1177
  # @private
1153
1178
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module Documents
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$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
@@ -613,9 +627,9 @@ module Google
613
627
  # end
614
628
  #
615
629
  # @!attribute [rw] endpoint
616
- # The hostname or hostname:port of the service endpoint.
617
- # Defaults to `"dialogflow.googleapis.com"`.
618
- # @return [::String]
630
+ # A custom service endpoint, as a hostname or hostname:port. The default is
631
+ # nil, indicating to use the default endpoint in the current universe domain.
632
+ # @return [::String,nil]
619
633
  # @!attribute [rw] credentials
620
634
  # Credentials to send with calls. You may provide any of the following types:
621
635
  # * (`String`) The path to a service account key file in JSON format
@@ -661,13 +675,20 @@ module Google
661
675
  # @!attribute [rw] quota_project
662
676
  # A separate project against which to charge quota.
663
677
  # @return [::String]
678
+ # @!attribute [rw] universe_domain
679
+ # The universe domain within which to make requests. This determines the
680
+ # default endpoint URL. The default value of nil uses the environment
681
+ # universe (usually the default "googleapis.com" universe).
682
+ # @return [::String,nil]
664
683
  #
665
684
  class Configuration
666
685
  extend ::Gapic::Config
667
686
 
687
+ # @private
688
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
668
689
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
669
690
 
670
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
691
+ config_attr :endpoint, nil, ::String, nil
671
692
  config_attr :credentials, nil do |value|
672
693
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
673
694
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -682,6 +703,7 @@ module Google
682
703
  config_attr :metadata, nil, ::Hash, nil
683
704
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
684
705
  config_attr :quota_project, nil, ::String, nil
706
+ config_attr :universe_domain, nil, ::String, nil
685
707
 
686
708
  # @private
687
709
  def initialize parent_config = nil
@@ -34,6 +34,9 @@ module Google
34
34
  # {::Google::Cloud::Dialogflow::V2::Document Documents}.
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
+ @documents_stub.universe_domain
112
+ end
113
+
102
114
  ##
103
115
  # Create a new Documents 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,16 +154,23 @@ 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
  end
145
159
 
160
+ @documents_stub = ::Google::Cloud::Dialogflow::V2::Documents::Rest::ServiceStub.new(
161
+ endpoint: @config.endpoint,
162
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
+ universe_domain: @config.universe_domain,
164
+ credentials: credentials
165
+ )
166
+
146
167
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
147
168
  config.credentials = credentials
148
169
  config.quota_project = @quota_project_id
149
- config.endpoint = @config.endpoint
170
+ config.endpoint = @documents_stub.endpoint
171
+ config.universe_domain = @documents_stub.universe_domain
150
172
  config.bindings_override = @config.bindings_override
151
173
  end
152
-
153
- @documents_stub = ::Google::Cloud::Dialogflow::V2::Documents::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
154
174
  end
155
175
 
156
176
  ##
@@ -1014,9 +1034,9 @@ module Google
1014
1034
  # end
1015
1035
  #
1016
1036
  # @!attribute [rw] endpoint
1017
- # The hostname or hostname:port of the service endpoint.
1018
- # Defaults to `"dialogflow.googleapis.com"`.
1019
- # @return [::String]
1037
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1038
+ # nil, indicating to use the default endpoint in the current universe domain.
1039
+ # @return [::String,nil]
1020
1040
  # @!attribute [rw] credentials
1021
1041
  # Credentials to send with calls. You may provide any of the following types:
1022
1042
  # * (`String`) The path to a service account key file in JSON format
@@ -1053,13 +1073,20 @@ module Google
1053
1073
  # @!attribute [rw] quota_project
1054
1074
  # A separate project against which to charge quota.
1055
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]
1056
1081
  #
1057
1082
  class Configuration
1058
1083
  extend ::Gapic::Config
1059
1084
 
1085
+ # @private
1086
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1060
1087
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
1061
1088
 
1062
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1089
+ config_attr :endpoint, nil, ::String, nil
1063
1090
  config_attr :credentials, nil do |value|
1064
1091
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1065
1092
  allowed.any? { |klass| klass === value }
@@ -1071,6 +1098,7 @@ module Google
1071
1098
  config_attr :metadata, nil, ::Hash, nil
1072
1099
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1073
1100
  config_attr :quota_project, nil, ::String, nil
1101
+ config_attr :universe_domain, nil, ::String, nil
1074
1102
 
1075
1103
  # @private
1076
1104
  # Overrides for http bindings for the RPCs of this service
@@ -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 = "dialogflow.$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
@@ -478,9 +492,9 @@ module Google
478
492
  # end
479
493
  #
480
494
  # @!attribute [rw] endpoint
481
- # The hostname or hostname:port of the service endpoint.
482
- # Defaults to `"dialogflow.googleapis.com"`.
483
- # @return [::String]
495
+ # A custom service endpoint, as a hostname or hostname:port. The default is
496
+ # nil, indicating to use the default endpoint in the current universe domain.
497
+ # @return [::String,nil]
484
498
  # @!attribute [rw] credentials
485
499
  # Credentials to send with calls. You may provide any of the following types:
486
500
  # * (`String`) The path to a service account key file in JSON format
@@ -517,13 +531,20 @@ module Google
517
531
  # @!attribute [rw] quota_project
518
532
  # A separate project against which to charge quota.
519
533
  # @return [::String]
534
+ # @!attribute [rw] universe_domain
535
+ # The universe domain within which to make requests. This determines the
536
+ # default endpoint URL. The default value of nil uses the environment
537
+ # universe (usually the default "googleapis.com" universe).
538
+ # @return [::String,nil]
520
539
  #
521
540
  class Configuration
522
541
  extend ::Gapic::Config
523
542
 
543
+ # @private
544
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
524
545
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
525
546
 
526
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
547
+ config_attr :endpoint, nil, ::String, nil
527
548
  config_attr :credentials, nil do |value|
528
549
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
529
550
  allowed.any? { |klass| klass === value }
@@ -535,6 +556,7 @@ module Google
535
556
  config_attr :metadata, nil, ::Hash, nil
536
557
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
537
558
  config_attr :quota_project, nil, ::String, nil
559
+ config_attr :universe_domain, nil, ::String, nil
538
560
 
539
561
  # @private
540
562
  def initialize parent_config = nil
@@ -617,12 +639,15 @@ module Google
617
639
  # Service stub contains baseline method implementations
618
640
  # including transcoding, making the REST call, and deserialing the response.
619
641
  class OperationsServiceStub
620
- def initialize endpoint:, credentials:
642
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
621
643
  # These require statements are intentionally placed here to initialize
622
644
  # the REST modules only when it's required.
623
645
  require "gapic/rest"
624
646
 
625
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
647
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
648
+ endpoint_template: endpoint_template,
649
+ universe_domain: universe_domain,
650
+ credentials: credentials
626
651
  end
627
652
 
628
653
  ##