google-cloud-discovery_engine-v1 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -99
  3. data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +42 -9
  4. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +50 -7
  5. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/service_stub.rb +14 -2
  6. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +42 -9
  7. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +134 -7
  8. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +14 -2
  9. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +43 -9
  10. data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +38 -7
  11. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +165 -7
  12. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +108 -8
  13. data/lib/google/cloud/discovery_engine/v1/document_service/rest/service_stub.rb +14 -2
  14. data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +43 -9
  15. data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +38 -7
  16. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +140 -7
  17. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +108 -8
  18. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/service_stub.rb +14 -2
  19. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +42 -9
  20. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +54 -7
  21. data/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb +14 -2
  22. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +43 -9
  23. data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +38 -7
  24. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +90 -7
  25. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +108 -8
  26. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +14 -2
  27. data/lib/google/cloud/discovery_engine/v1/version.rb +1 -1
  28. data/proto_docs/google/api/client.rb +14 -0
  29. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +2 -0
  30. metadata +7 -7
@@ -31,6 +31,9 @@ module Google
31
31
  # Service for search.
32
32
  #
33
33
  class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$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
+ @search_service_stub.universe_domain
109
+ end
110
+
99
111
  ##
100
112
  # Create a new SearchService 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,14 +156,18 @@ 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
  @search_service_stub = ::Gapic::ServiceStub.new(
149
163
  ::Google::Cloud::DiscoveryEngine::V1::SearchService::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
- interceptors: @config.interceptors
169
+ interceptors: @config.interceptors,
170
+ channel_pool_config: @config.channel_pool
154
171
  )
155
172
  end
156
173
 
@@ -399,9 +416,9 @@ module Google
399
416
  # end
400
417
  #
401
418
  # @!attribute [rw] endpoint
402
- # The hostname or hostname:port of the service endpoint.
403
- # Defaults to `"discoveryengine.googleapis.com"`.
404
- # @return [::String]
419
+ # A custom service endpoint, as a hostname or hostname:port. The default is
420
+ # nil, indicating to use the default endpoint in the current universe domain.
421
+ # @return [::String,nil]
405
422
  # @!attribute [rw] credentials
406
423
  # Credentials to send with calls. You may provide any of the following types:
407
424
  # * (`String`) The path to a service account key file in JSON format
@@ -447,13 +464,20 @@ module Google
447
464
  # @!attribute [rw] quota_project
448
465
  # A separate project against which to charge quota.
449
466
  # @return [::String]
467
+ # @!attribute [rw] universe_domain
468
+ # The universe domain within which to make requests. This determines the
469
+ # default endpoint URL. The default value of nil uses the environment
470
+ # universe (usually the default "googleapis.com" universe).
471
+ # @return [::String,nil]
450
472
  #
451
473
  class Configuration
452
474
  extend ::Gapic::Config
453
475
 
476
+ # @private
477
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
454
478
  DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
455
479
 
456
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
480
+ config_attr :endpoint, nil, ::String, nil
457
481
  config_attr :credentials, nil do |value|
458
482
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
459
483
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -468,6 +492,7 @@ module Google
468
492
  config_attr :metadata, nil, ::Hash, nil
469
493
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
470
494
  config_attr :quota_project, nil, ::String, nil
495
+ config_attr :universe_domain, nil, ::String, nil
471
496
 
472
497
  # @private
473
498
  def initialize parent_config = nil
@@ -488,6 +513,14 @@ module Google
488
513
  end
489
514
  end
490
515
 
516
+ ##
517
+ # Configuration for the channel pool
518
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
519
+ #
520
+ def channel_pool
521
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
522
+ end
523
+
491
524
  ##
492
525
  # Configuration RPC class for the SearchService API.
493
526
  #
@@ -33,6 +33,9 @@ module Google
33
33
  # Service for search.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$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
+ @search_service_stub.universe_domain
111
+ end
112
+
101
113
  ##
102
114
  # Create a new SearchService 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,9 +153,15 @@ 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
  end
144
158
 
145
- @search_service_stub = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
159
+ @search_service_stub = ::Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::ServiceStub.new(
160
+ endpoint: @config.endpoint,
161
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
162
+ universe_domain: @config.universe_domain,
163
+ credentials: credentials
164
+ )
146
165
  end
147
166
 
148
167
  ##
@@ -297,6 +316,26 @@ module Google
297
316
  # @return [::Google::Cloud::DiscoveryEngine::V1::SearchResponse]
298
317
  #
299
318
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
319
+ #
320
+ # @example Basic example
321
+ # require "google/cloud/discovery_engine/v1"
322
+ #
323
+ # # Create a client object. The client can be reused for multiple calls.
324
+ # client = Google::Cloud::DiscoveryEngine::V1::SearchService::Rest::Client.new
325
+ #
326
+ # # Create a request. To set request fields, pass in keyword arguments.
327
+ # request = Google::Cloud::DiscoveryEngine::V1::SearchRequest.new
328
+ #
329
+ # # Call the search method.
330
+ # result = client.search request
331
+ #
332
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
333
+ # # over elements, and API calls will be issued to fetch pages as needed.
334
+ # result.each do |item|
335
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::SearchResponse::SearchResult.
336
+ # p item
337
+ # end
338
+ #
300
339
  def search request, options = nil
301
340
  raise ::ArgumentError, "request must be provided" if request.nil?
302
341
 
@@ -362,9 +401,9 @@ module Google
362
401
  # end
363
402
  #
364
403
  # @!attribute [rw] endpoint
365
- # The hostname or hostname:port of the service endpoint.
366
- # Defaults to `"discoveryengine.googleapis.com"`.
367
- # @return [::String]
404
+ # A custom service endpoint, as a hostname or hostname:port. The default is
405
+ # nil, indicating to use the default endpoint in the current universe domain.
406
+ # @return [::String,nil]
368
407
  # @!attribute [rw] credentials
369
408
  # Credentials to send with calls. You may provide any of the following types:
370
409
  # * (`String`) The path to a service account key file in JSON format
@@ -401,13 +440,20 @@ module Google
401
440
  # @!attribute [rw] quota_project
402
441
  # A separate project against which to charge quota.
403
442
  # @return [::String]
443
+ # @!attribute [rw] universe_domain
444
+ # The universe domain within which to make requests. This determines the
445
+ # default endpoint URL. The default value of nil uses the environment
446
+ # universe (usually the default "googleapis.com" universe).
447
+ # @return [::String,nil]
404
448
  #
405
449
  class Configuration
406
450
  extend ::Gapic::Config
407
451
 
452
+ # @private
453
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
408
454
  DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
409
455
 
410
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
456
+ config_attr :endpoint, nil, ::String, nil
411
457
  config_attr :credentials, nil do |value|
412
458
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
413
459
  allowed.any? { |klass| klass === value }
@@ -419,6 +465,7 @@ module Google
419
465
  config_attr :metadata, nil, ::Hash, nil
420
466
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
421
467
  config_attr :quota_project, nil, ::String, nil
468
+ config_attr :universe_domain, nil, ::String, nil
422
469
 
423
470
  # @private
424
471
  def initialize parent_config = nil
@@ -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 search REST call
45
57
  #
@@ -31,6 +31,9 @@ module Google
31
31
  # Service for ingesting end user actions on a website to Discovery Engine API.
32
32
  #
33
33
  class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
36
+
34
37
  include Paths
35
38
 
36
39
  # @private
@@ -101,6 +104,15 @@ module Google
101
104
  @config
102
105
  end
103
106
 
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @user_event_service_stub.universe_domain
114
+ end
115
+
104
116
  ##
105
117
  # Create a new UserEventService client object.
106
118
  #
@@ -134,8 +146,9 @@ module Google
134
146
  credentials = @config.credentials
135
147
  # Use self-signed JWT if the endpoint is unchanged from default,
136
148
  # but only if the default endpoint does not have a region prefix.
137
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
138
- !@config.endpoint.split(".").first.include?("-")
149
+ enable_self_signed_jwt = @config.endpoint.nil? ||
150
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
151
+ !@config.endpoint.split(".").first.include?("-"))
139
152
  credentials ||= Credentials.default scope: @config.scope,
140
153
  enable_self_signed_jwt: enable_self_signed_jwt
141
154
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -148,20 +161,25 @@ module Google
148
161
  config.credentials = credentials
149
162
  config.quota_project = @quota_project_id
150
163
  config.endpoint = @config.endpoint
164
+ config.universe_domain = @config.universe_domain
151
165
  end
152
166
 
153
167
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
154
168
  config.credentials = credentials
155
169
  config.quota_project = @quota_project_id
156
170
  config.endpoint = @config.endpoint
171
+ config.universe_domain = @config.universe_domain
157
172
  end
158
173
 
159
174
  @user_event_service_stub = ::Gapic::ServiceStub.new(
160
175
  ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Stub,
161
- credentials: credentials,
162
- endpoint: @config.endpoint,
176
+ credentials: credentials,
177
+ endpoint: @config.endpoint,
178
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
179
+ universe_domain: @config.universe_domain,
163
180
  channel_args: @config.channel_args,
164
- interceptors: @config.interceptors
181
+ interceptors: @config.interceptors,
182
+ channel_pool_config: @config.channel_pool
165
183
  )
166
184
  end
167
185
 
@@ -510,9 +528,9 @@ module Google
510
528
  # end
511
529
  #
512
530
  # @!attribute [rw] endpoint
513
- # The hostname or hostname:port of the service endpoint.
514
- # Defaults to `"discoveryengine.googleapis.com"`.
515
- # @return [::String]
531
+ # A custom service endpoint, as a hostname or hostname:port. The default is
532
+ # nil, indicating to use the default endpoint in the current universe domain.
533
+ # @return [::String,nil]
516
534
  # @!attribute [rw] credentials
517
535
  # Credentials to send with calls. You may provide any of the following types:
518
536
  # * (`String`) The path to a service account key file in JSON format
@@ -558,13 +576,20 @@ module Google
558
576
  # @!attribute [rw] quota_project
559
577
  # A separate project against which to charge quota.
560
578
  # @return [::String]
579
+ # @!attribute [rw] universe_domain
580
+ # The universe domain within which to make requests. This determines the
581
+ # default endpoint URL. The default value of nil uses the environment
582
+ # universe (usually the default "googleapis.com" universe).
583
+ # @return [::String,nil]
561
584
  #
562
585
  class Configuration
563
586
  extend ::Gapic::Config
564
587
 
588
+ # @private
589
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
565
590
  DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
566
591
 
567
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
592
+ config_attr :endpoint, nil, ::String, nil
568
593
  config_attr :credentials, nil do |value|
569
594
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
570
595
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -579,6 +604,7 @@ module Google
579
604
  config_attr :metadata, nil, ::Hash, nil
580
605
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
581
606
  config_attr :quota_project, nil, ::String, nil
607
+ config_attr :universe_domain, nil, ::String, nil
582
608
 
583
609
  # @private
584
610
  def initialize parent_config = nil
@@ -599,6 +625,14 @@ module Google
599
625
  end
600
626
  end
601
627
 
628
+ ##
629
+ # Configuration for the channel pool
630
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
631
+ #
632
+ def channel_pool
633
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
634
+ end
635
+
602
636
  ##
603
637
  # Configuration RPC class for the UserEventService API.
604
638
  #
@@ -26,6 +26,9 @@ module Google
26
26
  module UserEventService
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$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,10 +102,13 @@ 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
- interceptors: @config.interceptors
110
+ interceptors: @config.interceptors,
111
+ channel_pool_config: @config.channel_pool
97
112
  )
98
113
 
99
114
  # Used by an LRO wrapper for some methods of this service
@@ -612,9 +627,9 @@ module Google
612
627
  # end
613
628
  #
614
629
  # @!attribute [rw] endpoint
615
- # The hostname or hostname:port of the service endpoint.
616
- # Defaults to `"discoveryengine.googleapis.com"`.
617
- # @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]
618
633
  # @!attribute [rw] credentials
619
634
  # Credentials to send with calls. You may provide any of the following types:
620
635
  # * (`String`) The path to a service account key file in JSON format
@@ -660,13 +675,20 @@ module Google
660
675
  # @!attribute [rw] quota_project
661
676
  # A separate project against which to charge quota.
662
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]
663
683
  #
664
684
  class Configuration
665
685
  extend ::Gapic::Config
666
686
 
687
+ # @private
688
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
667
689
  DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
668
690
 
669
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
691
+ config_attr :endpoint, nil, ::String, nil
670
692
  config_attr :credentials, nil do |value|
671
693
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
672
694
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -681,6 +703,7 @@ module Google
681
703
  config_attr :metadata, nil, ::Hash, nil
682
704
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
683
705
  config_attr :quota_project, nil, ::String, nil
706
+ config_attr :universe_domain, nil, ::String, nil
684
707
 
685
708
  # @private
686
709
  def initialize parent_config = nil
@@ -701,6 +724,14 @@ module Google
701
724
  end
702
725
  end
703
726
 
727
+ ##
728
+ # Configuration for the channel pool
729
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
730
+ #
731
+ def channel_pool
732
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
733
+ end
734
+
704
735
  ##
705
736
  # Configuration RPC class for the Operations API.
706
737
  #
@@ -33,6 +33,9 @@ module Google
33
33
  # Service for ingesting end user actions on a website to Discovery Engine API.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
38
+
36
39
  include Paths
37
40
 
38
41
  # @private
@@ -103,6 +106,15 @@ module Google
103
106
  @config
104
107
  end
105
108
 
109
+ ##
110
+ # The effective universe domain
111
+ #
112
+ # @return [String]
113
+ #
114
+ def universe_domain
115
+ @user_event_service_stub.universe_domain
116
+ end
117
+
106
118
  ##
107
119
  # Create a new UserEventService REST client object.
108
120
  #
@@ -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)
@@ -145,15 +158,22 @@ module Google
145
158
  config.credentials = credentials
146
159
  config.quota_project = @quota_project_id
147
160
  config.endpoint = @config.endpoint
161
+ config.universe_domain = @config.universe_domain
148
162
  end
149
163
 
150
164
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
151
165
  config.credentials = credentials
152
166
  config.quota_project = @quota_project_id
153
167
  config.endpoint = @config.endpoint
168
+ config.universe_domain = @config.universe_domain
154
169
  end
155
170
 
156
- @user_event_service_stub = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
171
+ @user_event_service_stub = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::ServiceStub.new(
172
+ endpoint: @config.endpoint,
173
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
174
+ universe_domain: @config.universe_domain,
175
+ credentials: credentials
176
+ )
157
177
  end
158
178
 
159
179
  ##
@@ -202,6 +222,22 @@ module Google
202
222
  # @return [::Google::Cloud::DiscoveryEngine::V1::UserEvent]
203
223
  #
204
224
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
225
+ #
226
+ # @example Basic example
227
+ # require "google/cloud/discovery_engine/v1"
228
+ #
229
+ # # Create a client object. The client can be reused for multiple calls.
230
+ # client = Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client.new
231
+ #
232
+ # # Create a request. To set request fields, pass in keyword arguments.
233
+ # request = Google::Cloud::DiscoveryEngine::V1::WriteUserEventRequest.new
234
+ #
235
+ # # Call the write_user_event method.
236
+ # result = client.write_user_event request
237
+ #
238
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1::UserEvent.
239
+ # p result
240
+ #
205
241
  def write_user_event request, options = nil
206
242
  raise ::ArgumentError, "request must be provided" if request.nil?
207
243
 
@@ -281,6 +317,22 @@ module Google
281
317
  # @return [::Google::Api::HttpBody]
282
318
  #
283
319
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
320
+ #
321
+ # @example Basic example
322
+ # require "google/cloud/discovery_engine/v1"
323
+ #
324
+ # # Create a client object. The client can be reused for multiple calls.
325
+ # client = Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client.new
326
+ #
327
+ # # Create a request. To set request fields, pass in keyword arguments.
328
+ # request = Google::Cloud::DiscoveryEngine::V1::CollectUserEventRequest.new
329
+ #
330
+ # # Call the collect_user_event method.
331
+ # result = client.collect_user_event request
332
+ #
333
+ # # The returned object is of type Google::Api::HttpBody.
334
+ # p result
335
+ #
284
336
  def collect_user_event request, options = nil
285
337
  raise ::ArgumentError, "request must be provided" if request.nil?
286
338
 
@@ -359,6 +411,29 @@ module Google
359
411
  # @return [::Gapic::Operation]
360
412
  #
361
413
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
414
+ #
415
+ # @example Basic example
416
+ # require "google/cloud/discovery_engine/v1"
417
+ #
418
+ # # Create a client object. The client can be reused for multiple calls.
419
+ # client = Google::Cloud::DiscoveryEngine::V1::UserEventService::Rest::Client.new
420
+ #
421
+ # # Create a request. To set request fields, pass in keyword arguments.
422
+ # request = Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest.new
423
+ #
424
+ # # Call the import_user_events method.
425
+ # result = client.import_user_events request
426
+ #
427
+ # # The returned object is of type Gapic::Operation. You can use it to
428
+ # # check the status of an operation, cancel it, or wait for results.
429
+ # # Here is how to wait for a response.
430
+ # result.wait_until_done! timeout: 60
431
+ # if result.response?
432
+ # p result.response
433
+ # else
434
+ # puts "No response received."
435
+ # end
436
+ #
362
437
  def import_user_events request, options = nil
363
438
  raise ::ArgumentError, "request must be provided" if request.nil?
364
439
 
@@ -425,9 +500,9 @@ module Google
425
500
  # end
426
501
  #
427
502
  # @!attribute [rw] endpoint
428
- # The hostname or hostname:port of the service endpoint.
429
- # Defaults to `"discoveryengine.googleapis.com"`.
430
- # @return [::String]
503
+ # A custom service endpoint, as a hostname or hostname:port. The default is
504
+ # nil, indicating to use the default endpoint in the current universe domain.
505
+ # @return [::String,nil]
431
506
  # @!attribute [rw] credentials
432
507
  # Credentials to send with calls. You may provide any of the following types:
433
508
  # * (`String`) The path to a service account key file in JSON format
@@ -464,13 +539,20 @@ module Google
464
539
  # @!attribute [rw] quota_project
465
540
  # A separate project against which to charge quota.
466
541
  # @return [::String]
542
+ # @!attribute [rw] universe_domain
543
+ # The universe domain within which to make requests. This determines the
544
+ # default endpoint URL. The default value of nil uses the environment
545
+ # universe (usually the default "googleapis.com" universe).
546
+ # @return [::String,nil]
467
547
  #
468
548
  class Configuration
469
549
  extend ::Gapic::Config
470
550
 
551
+ # @private
552
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
471
553
  DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
472
554
 
473
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
555
+ config_attr :endpoint, nil, ::String, nil
474
556
  config_attr :credentials, nil do |value|
475
557
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
476
558
  allowed.any? { |klass| klass === value }
@@ -482,6 +564,7 @@ module Google
482
564
  config_attr :metadata, nil, ::Hash, nil
483
565
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
484
566
  config_attr :quota_project, nil, ::String, nil
567
+ config_attr :universe_domain, nil, ::String, nil
485
568
 
486
569
  # @private
487
570
  def initialize parent_config = nil