google-cloud-retail-v2 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/lib/google/cloud/retail/v2/catalog_service/client.rb +32 -8
  4. data/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +34 -7
  5. data/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +14 -2
  6. data/lib/google/cloud/retail/v2/completion_service/client.rb +33 -8
  7. data/lib/google/cloud/retail/v2/completion_service/operations.rb +28 -6
  8. data/lib/google/cloud/retail/v2/completion_service/rest/client.rb +35 -7
  9. data/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +33 -8
  10. data/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +14 -2
  11. data/lib/google/cloud/retail/v2/control_service/client.rb +32 -8
  12. data/lib/google/cloud/retail/v2/control_service/rest/client.rb +34 -7
  13. data/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +14 -2
  14. data/lib/google/cloud/retail/v2/model_service/client.rb +33 -8
  15. data/lib/google/cloud/retail/v2/model_service/operations.rb +28 -6
  16. data/lib/google/cloud/retail/v2/model_service/rest/client.rb +35 -7
  17. data/lib/google/cloud/retail/v2/model_service/rest/operations.rb +33 -8
  18. data/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb +14 -2
  19. data/lib/google/cloud/retail/v2/prediction_service/client.rb +32 -8
  20. data/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +34 -7
  21. data/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +14 -2
  22. data/lib/google/cloud/retail/v2/product_service/client.rb +33 -8
  23. data/lib/google/cloud/retail/v2/product_service/operations.rb +28 -6
  24. data/lib/google/cloud/retail/v2/product_service/rest/client.rb +35 -7
  25. data/lib/google/cloud/retail/v2/product_service/rest/operations.rb +33 -8
  26. data/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +14 -2
  27. data/lib/google/cloud/retail/v2/search_service/client.rb +32 -8
  28. data/lib/google/cloud/retail/v2/search_service/rest/client.rb +34 -7
  29. data/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +14 -2
  30. data/lib/google/cloud/retail/v2/serving_config_service/client.rb +32 -8
  31. data/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +34 -7
  32. data/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +14 -2
  33. data/lib/google/cloud/retail/v2/user_event_service/client.rb +33 -8
  34. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +28 -6
  35. data/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +35 -7
  36. data/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +33 -8
  37. data/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +14 -2
  38. data/lib/google/cloud/retail/v2/version.rb +1 -1
  39. data/proto_docs/google/api/client.rb +14 -0
  40. data/proto_docs/google/cloud/retail/v2/common.rb +2 -0
  41. data/proto_docs/google/cloud/retail/v2/import_config.rb +2 -0
  42. data/proto_docs/google/cloud/retail/v2/prediction_service.rb +1 -0
  43. data/proto_docs/google/cloud/retail/v2/product.rb +1 -0
  44. data/proto_docs/google/cloud/retail/v2/search_service.rb +1 -0
  45. metadata +7 -7
@@ -34,6 +34,9 @@ module Google
34
34
  # of the customer's website.
35
35
  #
36
36
  class Client
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$"
39
+
37
40
  include Paths
38
41
 
39
42
  # @private
@@ -104,6 +107,15 @@ module Google
104
107
  @config
105
108
  end
106
109
 
110
+ ##
111
+ # The effective universe domain
112
+ #
113
+ # @return [String]
114
+ #
115
+ def universe_domain
116
+ @product_service_stub.universe_domain
117
+ end
118
+
107
119
  ##
108
120
  # Create a new ProductService REST client object.
109
121
  #
@@ -131,8 +143,9 @@ module Google
131
143
  credentials = @config.credentials
132
144
  # Use self-signed JWT if the endpoint is unchanged from default,
133
145
  # but only if the default endpoint does not have a region prefix.
134
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
135
- !@config.endpoint.split(".").first.include?("-")
146
+ enable_self_signed_jwt = @config.endpoint.nil? ||
147
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
148
+ !@config.endpoint.split(".").first.include?("-"))
136
149
  credentials ||= Credentials.default scope: @config.scope,
137
150
  enable_self_signed_jwt: enable_self_signed_jwt
138
151
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -146,15 +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::Rest::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
- @product_service_stub = ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
172
+ @product_service_stub = ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.new(
173
+ endpoint: @config.endpoint,
174
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
175
+ universe_domain: @config.universe_domain,
176
+ credentials: credentials
177
+ )
158
178
  end
159
179
 
160
180
  ##
@@ -1685,9 +1705,9 @@ module Google
1685
1705
  # end
1686
1706
  #
1687
1707
  # @!attribute [rw] endpoint
1688
- # The hostname or hostname:port of the service endpoint.
1689
- # Defaults to `"retail.googleapis.com"`.
1690
- # @return [::String]
1708
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1709
+ # nil, indicating to use the default endpoint in the current universe domain.
1710
+ # @return [::String,nil]
1691
1711
  # @!attribute [rw] credentials
1692
1712
  # Credentials to send with calls. You may provide any of the following types:
1693
1713
  # * (`String`) The path to a service account key file in JSON format
@@ -1724,13 +1744,20 @@ module Google
1724
1744
  # @!attribute [rw] quota_project
1725
1745
  # A separate project against which to charge quota.
1726
1746
  # @return [::String]
1747
+ # @!attribute [rw] universe_domain
1748
+ # The universe domain within which to make requests. This determines the
1749
+ # default endpoint URL. The default value of nil uses the environment
1750
+ # universe (usually the default "googleapis.com" universe).
1751
+ # @return [::String,nil]
1727
1752
  #
1728
1753
  class Configuration
1729
1754
  extend ::Gapic::Config
1730
1755
 
1756
+ # @private
1757
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1731
1758
  DEFAULT_ENDPOINT = "retail.googleapis.com"
1732
1759
 
1733
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1760
+ config_attr :endpoint, nil, ::String, nil
1734
1761
  config_attr :credentials, nil do |value|
1735
1762
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1736
1763
  allowed.any? { |klass| klass === value }
@@ -1742,6 +1769,7 @@ module Google
1742
1769
  config_attr :metadata, nil, ::Hash, nil
1743
1770
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1744
1771
  config_attr :quota_project, nil, ::String, nil
1772
+ config_attr :universe_domain, nil, ::String, nil
1745
1773
 
1746
1774
  # @private
1747
1775
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module Rest
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ DEFAULT_ENDPOINT_TEMPLATE = "retail.$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 `"retail.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 = "retail.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
  ##
@@ -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 create_product REST call
45
57
  #
@@ -34,6 +34,9 @@ module Google
34
34
  # Enable Retail Search on Cloud Console before using this feature.
35
35
  #
36
36
  class Client
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "retail.$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
+ @search_service_stub.universe_domain
112
+ end
113
+
102
114
  ##
103
115
  # Create a new SearchService 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,12 +159,15 @@ 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
  @search_service_stub = ::Gapic::ServiceStub.new(
152
166
  ::Google::Cloud::Retail::V2::SearchService::Stub,
153
- credentials: credentials,
154
- endpoint: @config.endpoint,
167
+ credentials: credentials,
168
+ endpoint: @config.endpoint,
169
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
170
+ universe_domain: @config.universe_domain,
155
171
  channel_args: @config.channel_args,
156
172
  interceptors: @config.interceptors,
157
173
  channel_pool_config: @config.channel_pool
@@ -526,9 +542,9 @@ module Google
526
542
  # end
527
543
  #
528
544
  # @!attribute [rw] endpoint
529
- # The hostname or hostname:port of the service endpoint.
530
- # Defaults to `"retail.googleapis.com"`.
531
- # @return [::String]
545
+ # A custom service endpoint, as a hostname or hostname:port. The default is
546
+ # nil, indicating to use the default endpoint in the current universe domain.
547
+ # @return [::String,nil]
532
548
  # @!attribute [rw] credentials
533
549
  # Credentials to send with calls. You may provide any of the following types:
534
550
  # * (`String`) The path to a service account key file in JSON format
@@ -574,13 +590,20 @@ module Google
574
590
  # @!attribute [rw] quota_project
575
591
  # A separate project against which to charge quota.
576
592
  # @return [::String]
593
+ # @!attribute [rw] universe_domain
594
+ # The universe domain within which to make requests. This determines the
595
+ # default endpoint URL. The default value of nil uses the environment
596
+ # universe (usually the default "googleapis.com" universe).
597
+ # @return [::String,nil]
577
598
  #
578
599
  class Configuration
579
600
  extend ::Gapic::Config
580
601
 
602
+ # @private
603
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
581
604
  DEFAULT_ENDPOINT = "retail.googleapis.com"
582
605
 
583
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
606
+ config_attr :endpoint, nil, ::String, nil
584
607
  config_attr :credentials, nil do |value|
585
608
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
586
609
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -595,6 +618,7 @@ module Google
595
618
  config_attr :metadata, nil, ::Hash, nil
596
619
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
597
620
  config_attr :quota_project, nil, ::String, nil
621
+ config_attr :universe_domain, nil, ::String, nil
598
622
 
599
623
  # @private
600
624
  def initialize parent_config = nil
@@ -36,6 +36,9 @@ module Google
36
36
  # Enable Retail Search on Cloud Console before using this feature.
37
37
  #
38
38
  class Client
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$"
41
+
39
42
  include Paths
40
43
 
41
44
  # @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
+ @search_service_stub.universe_domain
114
+ end
115
+
104
116
  ##
105
117
  # Create a new SearchService REST client object.
106
118
  #
@@ -128,8 +140,9 @@ module Google
128
140
  credentials = @config.credentials
129
141
  # Use self-signed JWT if the endpoint is unchanged from default,
130
142
  # but only if the default endpoint does not have a region prefix.
131
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
132
- !@config.endpoint.split(".").first.include?("-")
143
+ enable_self_signed_jwt = @config.endpoint.nil? ||
144
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
145
+ !@config.endpoint.split(".").first.include?("-"))
133
146
  credentials ||= Credentials.default scope: @config.scope,
134
147
  enable_self_signed_jwt: enable_self_signed_jwt
135
148
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -143,9 +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
- @search_service_stub = ::Google::Cloud::Retail::V2::SearchService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
162
+ @search_service_stub = ::Google::Cloud::Retail::V2::SearchService::Rest::ServiceStub.new(
163
+ endpoint: @config.endpoint,
164
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
165
+ universe_domain: @config.universe_domain,
166
+ credentials: credentials
167
+ )
149
168
  end
150
169
 
151
170
  ##
@@ -508,9 +527,9 @@ module Google
508
527
  # end
509
528
  #
510
529
  # @!attribute [rw] endpoint
511
- # The hostname or hostname:port of the service endpoint.
512
- # Defaults to `"retail.googleapis.com"`.
513
- # @return [::String]
530
+ # A custom service endpoint, as a hostname or hostname:port. The default is
531
+ # nil, indicating to use the default endpoint in the current universe domain.
532
+ # @return [::String,nil]
514
533
  # @!attribute [rw] credentials
515
534
  # Credentials to send with calls. You may provide any of the following types:
516
535
  # * (`String`) The path to a service account key file in JSON format
@@ -547,13 +566,20 @@ module Google
547
566
  # @!attribute [rw] quota_project
548
567
  # A separate project against which to charge quota.
549
568
  # @return [::String]
569
+ # @!attribute [rw] universe_domain
570
+ # The universe domain within which to make requests. This determines the
571
+ # default endpoint URL. The default value of nil uses the environment
572
+ # universe (usually the default "googleapis.com" universe).
573
+ # @return [::String,nil]
550
574
  #
551
575
  class Configuration
552
576
  extend ::Gapic::Config
553
577
 
578
+ # @private
579
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
554
580
  DEFAULT_ENDPOINT = "retail.googleapis.com"
555
581
 
556
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
582
+ config_attr :endpoint, nil, ::String, nil
557
583
  config_attr :credentials, nil do |value|
558
584
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
559
585
  allowed.any? { |klass| klass === value }
@@ -565,6 +591,7 @@ module Google
565
591
  config_attr :metadata, nil, ::Hash, nil
566
592
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
567
593
  config_attr :quota_project, nil, ::String, nil
594
+ config_attr :universe_domain, nil, ::String, nil
568
595
 
569
596
  # @private
570
597
  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 modifying ServingConfig.
32
32
  #
33
33
  class Client
34
+ # @private
35
+ DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$"
36
+
34
37
  include Paths
35
38
 
36
39
  # @private
@@ -91,6 +94,15 @@ module Google
91
94
  @config
92
95
  end
93
96
 
97
+ ##
98
+ # The effective universe domain
99
+ #
100
+ # @return [String]
101
+ #
102
+ def universe_domain
103
+ @serving_config_service_stub.universe_domain
104
+ end
105
+
94
106
  ##
95
107
  # Create a new ServingConfigService client object.
96
108
  #
@@ -124,8 +136,9 @@ module Google
124
136
  credentials = @config.credentials
125
137
  # Use self-signed JWT if the endpoint is unchanged from default,
126
138
  # but only if the default endpoint does not have a region prefix.
127
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
128
- !@config.endpoint.split(".").first.include?("-")
139
+ enable_self_signed_jwt = @config.endpoint.nil? ||
140
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
+ !@config.endpoint.split(".").first.include?("-"))
129
142
  credentials ||= Credentials.default scope: @config.scope,
130
143
  enable_self_signed_jwt: enable_self_signed_jwt
131
144
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -138,12 +151,15 @@ module Google
138
151
  config.credentials = credentials
139
152
  config.quota_project = @quota_project_id
140
153
  config.endpoint = @config.endpoint
154
+ config.universe_domain = @config.universe_domain
141
155
  end
142
156
 
143
157
  @serving_config_service_stub = ::Gapic::ServiceStub.new(
144
158
  ::Google::Cloud::Retail::V2::ServingConfigService::Stub,
145
- credentials: credentials,
146
- endpoint: @config.endpoint,
159
+ credentials: credentials,
160
+ endpoint: @config.endpoint,
161
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
162
+ universe_domain: @config.universe_domain,
147
163
  channel_args: @config.channel_args,
148
164
  interceptors: @config.interceptors,
149
165
  channel_pool_config: @config.channel_pool
@@ -841,9 +857,9 @@ module Google
841
857
  # end
842
858
  #
843
859
  # @!attribute [rw] endpoint
844
- # The hostname or hostname:port of the service endpoint.
845
- # Defaults to `"retail.googleapis.com"`.
846
- # @return [::String]
860
+ # A custom service endpoint, as a hostname or hostname:port. The default is
861
+ # nil, indicating to use the default endpoint in the current universe domain.
862
+ # @return [::String,nil]
847
863
  # @!attribute [rw] credentials
848
864
  # Credentials to send with calls. You may provide any of the following types:
849
865
  # * (`String`) The path to a service account key file in JSON format
@@ -889,13 +905,20 @@ module Google
889
905
  # @!attribute [rw] quota_project
890
906
  # A separate project against which to charge quota.
891
907
  # @return [::String]
908
+ # @!attribute [rw] universe_domain
909
+ # The universe domain within which to make requests. This determines the
910
+ # default endpoint URL. The default value of nil uses the environment
911
+ # universe (usually the default "googleapis.com" universe).
912
+ # @return [::String,nil]
892
913
  #
893
914
  class Configuration
894
915
  extend ::Gapic::Config
895
916
 
917
+ # @private
918
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
896
919
  DEFAULT_ENDPOINT = "retail.googleapis.com"
897
920
 
898
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
921
+ config_attr :endpoint, nil, ::String, nil
899
922
  config_attr :credentials, nil do |value|
900
923
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
901
924
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -910,6 +933,7 @@ module Google
910
933
  config_attr :metadata, nil, ::Hash, nil
911
934
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
912
935
  config_attr :quota_project, nil, ::String, nil
936
+ config_attr :universe_domain, nil, ::String, nil
913
937
 
914
938
  # @private
915
939
  def initialize parent_config = nil
@@ -33,6 +33,9 @@ module Google
33
33
  # Service for modifying ServingConfig.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$"
38
+
36
39
  include Paths
37
40
 
38
41
  # @private
@@ -93,6 +96,15 @@ module Google
93
96
  @config
94
97
  end
95
98
 
99
+ ##
100
+ # The effective universe domain
101
+ #
102
+ # @return [String]
103
+ #
104
+ def universe_domain
105
+ @serving_config_service_stub.universe_domain
106
+ end
107
+
96
108
  ##
97
109
  # Create a new ServingConfigService REST client object.
98
110
  #
@@ -120,8 +132,9 @@ module Google
120
132
  credentials = @config.credentials
121
133
  # Use self-signed JWT if the endpoint is unchanged from default,
122
134
  # but only if the default endpoint does not have a region prefix.
123
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
124
- !@config.endpoint.split(".").first.include?("-")
135
+ enable_self_signed_jwt = @config.endpoint.nil? ||
136
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
137
+ !@config.endpoint.split(".").first.include?("-"))
125
138
  credentials ||= Credentials.default scope: @config.scope,
126
139
  enable_self_signed_jwt: enable_self_signed_jwt
127
140
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -135,9 +148,15 @@ module Google
135
148
  config.credentials = credentials
136
149
  config.quota_project = @quota_project_id
137
150
  config.endpoint = @config.endpoint
151
+ config.universe_domain = @config.universe_domain
138
152
  end
139
153
 
140
- @serving_config_service_stub = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
154
+ @serving_config_service_stub = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.new(
155
+ endpoint: @config.endpoint,
156
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
157
+ universe_domain: @config.universe_domain,
158
+ credentials: credentials
159
+ )
141
160
  end
142
161
 
143
162
  ##
@@ -782,9 +801,9 @@ module Google
782
801
  # end
783
802
  #
784
803
  # @!attribute [rw] endpoint
785
- # The hostname or hostname:port of the service endpoint.
786
- # Defaults to `"retail.googleapis.com"`.
787
- # @return [::String]
804
+ # A custom service endpoint, as a hostname or hostname:port. The default is
805
+ # nil, indicating to use the default endpoint in the current universe domain.
806
+ # @return [::String,nil]
788
807
  # @!attribute [rw] credentials
789
808
  # Credentials to send with calls. You may provide any of the following types:
790
809
  # * (`String`) The path to a service account key file in JSON format
@@ -821,13 +840,20 @@ module Google
821
840
  # @!attribute [rw] quota_project
822
841
  # A separate project against which to charge quota.
823
842
  # @return [::String]
843
+ # @!attribute [rw] universe_domain
844
+ # The universe domain within which to make requests. This determines the
845
+ # default endpoint URL. The default value of nil uses the environment
846
+ # universe (usually the default "googleapis.com" universe).
847
+ # @return [::String,nil]
824
848
  #
825
849
  class Configuration
826
850
  extend ::Gapic::Config
827
851
 
852
+ # @private
853
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
828
854
  DEFAULT_ENDPOINT = "retail.googleapis.com"
829
855
 
830
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
856
+ config_attr :endpoint, nil, ::String, nil
831
857
  config_attr :credentials, nil do |value|
832
858
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
833
859
  allowed.any? { |klass| klass === value }
@@ -839,6 +865,7 @@ module Google
839
865
  config_attr :metadata, nil, ::Hash, nil
840
866
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
841
867
  config_attr :quota_project, nil, ::String, nil
868
+ config_attr :universe_domain, nil, ::String, nil
842
869
 
843
870
  # @private
844
871
  def initialize parent_config = nil