google-cloud-recommendation_engine-v1beta1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +75 -0
- data/lib/google-cloud-recommendation_engine-v1beta1.rb +21 -0
- data/lib/google/cloud/recommendation_engine/v1beta1.rb +38 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service.rb +50 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/client.rb +831 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/credentials.rb +51 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/operations.rb +570 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/paths.rb +73 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry.rb +53 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/client.rb +554 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/credentials.rb +51 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/paths.rb +77 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service.rb +49 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/client.rb +468 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/credentials.rb +51 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/paths.rb +56 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service.rb +50 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/client.rb +820 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/credentials.rb +51 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/operations.rb +570 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/paths.rb +54 -0
- data/lib/google/cloud/recommendation_engine/v1beta1/version.rb +28 -0
- data/lib/google/cloud/recommendationengine/v1beta1/catalog_pb.rb +77 -0
- data/lib/google/cloud/recommendationengine/v1beta1/catalog_service_pb.rb +59 -0
- data/lib/google/cloud/recommendationengine/v1beta1/catalog_service_services_pb.rb +61 -0
- data/lib/google/cloud/recommendationengine/v1beta1/common_pb.rb +32 -0
- data/lib/google/cloud/recommendationengine/v1beta1/import_pb.rb +91 -0
- data/lib/google/cloud/recommendationengine/v1beta1/prediction_apikey_registry_service_pb.rb +48 -0
- data/lib/google/cloud/recommendationengine/v1beta1/prediction_apikey_registry_service_services_pb.rb +53 -0
- data/lib/google/cloud/recommendationengine/v1beta1/prediction_service_pb.rb +49 -0
- data/lib/google/cloud/recommendationengine/v1beta1/prediction_service_services_pb.rb +48 -0
- data/lib/google/cloud/recommendationengine/v1beta1/recommendationengine_resources_pb.rb +19 -0
- data/lib/google/cloud/recommendationengine/v1beta1/user_event_pb.rb +84 -0
- data/lib/google/cloud/recommendationengine/v1beta1/user_event_service_pb.rb +68 -0
- data/lib/google/cloud/recommendationengine/v1beta1/user_event_service_services_pb.rb +66 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/httpbody.rb +75 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/recommendationengine/v1beta1/catalog.rb +214 -0
- data/proto_docs/google/cloud/recommendationengine/v1beta1/catalog_service.rb +110 -0
- data/proto_docs/google/cloud/recommendationengine/v1beta1/common.rb +89 -0
- data/proto_docs/google/cloud/recommendationengine/v1beta1/import.rb +206 -0
- data/proto_docs/google/cloud/recommendationengine/v1beta1/prediction_apikey_registry_service.rb +88 -0
- data/proto_docs/google/cloud/recommendationengine/v1beta1/prediction_service.rb +212 -0
- data/proto_docs/google/cloud/recommendationengine/v1beta1/user_event.rb +367 -0
- data/proto_docs/google/cloud/recommendationengine/v1beta1/user_event_service.rb +191 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/google/type/date.rb +50 -0
- metadata +242 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module Google
|
|
21
|
+
module Cloud
|
|
22
|
+
module RecommendationEngine
|
|
23
|
+
module V1beta1
|
|
24
|
+
module CatalogService
|
|
25
|
+
# Path helper methods for the CatalogService API.
|
|
26
|
+
module Paths
|
|
27
|
+
##
|
|
28
|
+
# Create a fully-qualified Catalog resource string.
|
|
29
|
+
#
|
|
30
|
+
# The resource will be in the following format:
|
|
31
|
+
#
|
|
32
|
+
# `projects/{project}/locations/{location}/catalogs/{catalog}`
|
|
33
|
+
#
|
|
34
|
+
# @param project [String]
|
|
35
|
+
# @param location [String]
|
|
36
|
+
# @param catalog [String]
|
|
37
|
+
#
|
|
38
|
+
# @return [::String]
|
|
39
|
+
def catalog_path project:, location:, catalog:
|
|
40
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
|
41
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
|
42
|
+
|
|
43
|
+
"projects/#{project}/locations/#{location}/catalogs/#{catalog}"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Create a fully-qualified CatalogItemPath resource string.
|
|
48
|
+
#
|
|
49
|
+
# The resource will be in the following format:
|
|
50
|
+
#
|
|
51
|
+
# `projects/{project}/locations/{location}/catalogs/{catalog}/catalogItems/{catalog_item_path=**}`
|
|
52
|
+
#
|
|
53
|
+
# @param project [String]
|
|
54
|
+
# @param location [String]
|
|
55
|
+
# @param catalog [String]
|
|
56
|
+
# @param catalog_item_path [String]
|
|
57
|
+
#
|
|
58
|
+
# @return [::String]
|
|
59
|
+
def catalog_item_path_path project:, location:, catalog:, catalog_item_path:
|
|
60
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
|
61
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
|
62
|
+
raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/"
|
|
63
|
+
|
|
64
|
+
"projects/#{project}/locations/#{location}/catalogs/#{catalog}/catalogItems/#{catalog_item_path}"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
extend self
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
+
|
|
19
|
+
require "gapic/common"
|
|
20
|
+
require "gapic/config"
|
|
21
|
+
require "gapic/config/method"
|
|
22
|
+
|
|
23
|
+
require "google/cloud/recommendation_engine/v1beta1/version"
|
|
24
|
+
|
|
25
|
+
require "google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/credentials"
|
|
26
|
+
require "google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/paths"
|
|
27
|
+
require "google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/client"
|
|
28
|
+
|
|
29
|
+
module Google
|
|
30
|
+
module Cloud
|
|
31
|
+
module RecommendationEngine
|
|
32
|
+
module V1beta1
|
|
33
|
+
##
|
|
34
|
+
# Service for registering API keys for use with the `predict` method. If you
|
|
35
|
+
# use an API key to request predictions, you must first register the API key.
|
|
36
|
+
# Otherwise, your prediction request is rejected. If you use OAuth to
|
|
37
|
+
# authenticate your `predict` method call, you do not need to register an API
|
|
38
|
+
# key. You can register up to 20 API keys per project.
|
|
39
|
+
#
|
|
40
|
+
# To load this service and instantiate a client:
|
|
41
|
+
#
|
|
42
|
+
# require "google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry"
|
|
43
|
+
# client = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new
|
|
44
|
+
#
|
|
45
|
+
module PredictionApiKeyRegistry
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
helper_path = ::File.join __dir__, "prediction_api_key_registry", "helpers.rb"
|
|
53
|
+
require "google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/helpers" if ::File.file? helper_path
|
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
+
|
|
19
|
+
require "google/cloud/errors"
|
|
20
|
+
require "google/cloud/recommendationengine/v1beta1/prediction_apikey_registry_service_pb"
|
|
21
|
+
|
|
22
|
+
module Google
|
|
23
|
+
module Cloud
|
|
24
|
+
module RecommendationEngine
|
|
25
|
+
module V1beta1
|
|
26
|
+
module PredictionApiKeyRegistry
|
|
27
|
+
##
|
|
28
|
+
# Client for the PredictionApiKeyRegistry service.
|
|
29
|
+
#
|
|
30
|
+
# Service for registering API keys for use with the `predict` method. If you
|
|
31
|
+
# use an API key to request predictions, you must first register the API key.
|
|
32
|
+
# Otherwise, your prediction request is rejected. If you use OAuth to
|
|
33
|
+
# authenticate your `predict` method call, you do not need to register an API
|
|
34
|
+
# key. You can register up to 20 API keys per project.
|
|
35
|
+
#
|
|
36
|
+
class Client
|
|
37
|
+
include Paths
|
|
38
|
+
|
|
39
|
+
# @private
|
|
40
|
+
attr_reader :prediction_api_key_registry_stub
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
# Configure the PredictionApiKeyRegistry Client class.
|
|
44
|
+
#
|
|
45
|
+
# See {::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client::Configuration}
|
|
46
|
+
# for a description of the configuration fields.
|
|
47
|
+
#
|
|
48
|
+
# ## Example
|
|
49
|
+
#
|
|
50
|
+
# To modify the configuration for all PredictionApiKeyRegistry clients:
|
|
51
|
+
#
|
|
52
|
+
# ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.configure do |config|
|
|
53
|
+
# config.timeout = 10.0
|
|
54
|
+
# end
|
|
55
|
+
#
|
|
56
|
+
# @yield [config] Configure the Client client.
|
|
57
|
+
# @yieldparam config [Client::Configuration]
|
|
58
|
+
#
|
|
59
|
+
# @return [Client::Configuration]
|
|
60
|
+
#
|
|
61
|
+
def self.configure
|
|
62
|
+
@configure ||= begin
|
|
63
|
+
namespace = ["Google", "Cloud", "RecommendationEngine", "V1beta1"]
|
|
64
|
+
parent_config = while namespace.any?
|
|
65
|
+
parent_name = namespace.join "::"
|
|
66
|
+
parent_const = const_get parent_name
|
|
67
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
|
68
|
+
namespace.pop
|
|
69
|
+
end
|
|
70
|
+
default_config = Client::Configuration.new parent_config
|
|
71
|
+
|
|
72
|
+
default_config.rpcs.create_prediction_api_key_registration.timeout = 600.0
|
|
73
|
+
default_config.rpcs.create_prediction_api_key_registration.retry_policy = {
|
|
74
|
+
initial_delay: 0.1,
|
|
75
|
+
max_delay: 60.0,
|
|
76
|
+
multiplier: 1.3,
|
|
77
|
+
retry_codes: [14, 4]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
default_config.rpcs.list_prediction_api_key_registrations.timeout = 600.0
|
|
81
|
+
default_config.rpcs.list_prediction_api_key_registrations.retry_policy = {
|
|
82
|
+
initial_delay: 0.1,
|
|
83
|
+
max_delay: 60.0,
|
|
84
|
+
multiplier: 1.3,
|
|
85
|
+
retry_codes: [14, 4]
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
default_config.rpcs.delete_prediction_api_key_registration.timeout = 600.0
|
|
89
|
+
default_config.rpcs.delete_prediction_api_key_registration.retry_policy = {
|
|
90
|
+
initial_delay: 0.1,
|
|
91
|
+
max_delay: 60.0,
|
|
92
|
+
multiplier: 1.3,
|
|
93
|
+
retry_codes: [14, 4]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
default_config
|
|
97
|
+
end
|
|
98
|
+
yield @configure if block_given?
|
|
99
|
+
@configure
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
##
|
|
103
|
+
# Configure the PredictionApiKeyRegistry Client instance.
|
|
104
|
+
#
|
|
105
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
106
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
107
|
+
# should be made on {Client.configure}.
|
|
108
|
+
#
|
|
109
|
+
# See {::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client::Configuration}
|
|
110
|
+
# for a description of the configuration fields.
|
|
111
|
+
#
|
|
112
|
+
# @yield [config] Configure the Client client.
|
|
113
|
+
# @yieldparam config [Client::Configuration]
|
|
114
|
+
#
|
|
115
|
+
# @return [Client::Configuration]
|
|
116
|
+
#
|
|
117
|
+
def configure
|
|
118
|
+
yield @config if block_given?
|
|
119
|
+
@config
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
##
|
|
123
|
+
# Create a new PredictionApiKeyRegistry client object.
|
|
124
|
+
#
|
|
125
|
+
# ## Examples
|
|
126
|
+
#
|
|
127
|
+
# To create a new PredictionApiKeyRegistry client with the default
|
|
128
|
+
# configuration:
|
|
129
|
+
#
|
|
130
|
+
# client = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new
|
|
131
|
+
#
|
|
132
|
+
# To create a new PredictionApiKeyRegistry client with a custom
|
|
133
|
+
# configuration:
|
|
134
|
+
#
|
|
135
|
+
# client = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new do |config|
|
|
136
|
+
# config.timeout = 10.0
|
|
137
|
+
# end
|
|
138
|
+
#
|
|
139
|
+
# @yield [config] Configure the PredictionApiKeyRegistry client.
|
|
140
|
+
# @yieldparam config [Client::Configuration]
|
|
141
|
+
#
|
|
142
|
+
def initialize
|
|
143
|
+
# These require statements are intentionally placed here to initialize
|
|
144
|
+
# the gRPC module only when it's required.
|
|
145
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
|
146
|
+
require "gapic/grpc"
|
|
147
|
+
require "google/cloud/recommendationengine/v1beta1/prediction_apikey_registry_service_services_pb"
|
|
148
|
+
|
|
149
|
+
# Create the configuration object
|
|
150
|
+
@config = Configuration.new Client.configure
|
|
151
|
+
|
|
152
|
+
# Yield the configuration if needed
|
|
153
|
+
yield @config if block_given?
|
|
154
|
+
|
|
155
|
+
# Create credentials
|
|
156
|
+
credentials = @config.credentials
|
|
157
|
+
credentials ||= Credentials.default scope: @config.scope
|
|
158
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
|
159
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
160
|
+
end
|
|
161
|
+
@quota_project_id = @config.quota_project
|
|
162
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
163
|
+
|
|
164
|
+
@prediction_api_key_registry_stub = ::Gapic::ServiceStub.new(
|
|
165
|
+
::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Stub,
|
|
166
|
+
credentials: credentials,
|
|
167
|
+
endpoint: @config.endpoint,
|
|
168
|
+
channel_args: @config.channel_args,
|
|
169
|
+
interceptors: @config.interceptors
|
|
170
|
+
)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Service calls
|
|
174
|
+
|
|
175
|
+
##
|
|
176
|
+
# Register an API key for use with predict method.
|
|
177
|
+
#
|
|
178
|
+
# @overload create_prediction_api_key_registration(request, options = nil)
|
|
179
|
+
# Pass arguments to `create_prediction_api_key_registration` via a request object, either of type
|
|
180
|
+
# {::Google::Cloud::RecommendationEngine::V1beta1::CreatePredictionApiKeyRegistrationRequest} or an equivalent Hash.
|
|
181
|
+
#
|
|
182
|
+
# @param request [::Google::Cloud::RecommendationEngine::V1beta1::CreatePredictionApiKeyRegistrationRequest, ::Hash]
|
|
183
|
+
# A request object representing the call parameters. Required. To specify no
|
|
184
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
185
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
186
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
187
|
+
#
|
|
188
|
+
# @overload create_prediction_api_key_registration(parent: nil, prediction_api_key_registration: nil)
|
|
189
|
+
# Pass arguments to `create_prediction_api_key_registration` via keyword arguments. Note that at
|
|
190
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
191
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
192
|
+
#
|
|
193
|
+
# @param parent [::String]
|
|
194
|
+
# Required. The parent resource path.
|
|
195
|
+
# "projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store".
|
|
196
|
+
# @param prediction_api_key_registration [::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration, ::Hash]
|
|
197
|
+
# Required. The prediction API key registration.
|
|
198
|
+
#
|
|
199
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
200
|
+
# @yieldparam response [::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration]
|
|
201
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
202
|
+
#
|
|
203
|
+
# @return [::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration]
|
|
204
|
+
#
|
|
205
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
206
|
+
#
|
|
207
|
+
def create_prediction_api_key_registration request, options = nil
|
|
208
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
209
|
+
|
|
210
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecommendationEngine::V1beta1::CreatePredictionApiKeyRegistrationRequest
|
|
211
|
+
|
|
212
|
+
# Converts hash and nil to an options object
|
|
213
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
214
|
+
|
|
215
|
+
# Customize the options with defaults
|
|
216
|
+
metadata = @config.rpcs.create_prediction_api_key_registration.metadata.to_h
|
|
217
|
+
|
|
218
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
219
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
220
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
221
|
+
gapic_version: ::Google::Cloud::RecommendationEngine::V1beta1::VERSION
|
|
222
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
223
|
+
|
|
224
|
+
header_params = {
|
|
225
|
+
"parent" => request.parent
|
|
226
|
+
}
|
|
227
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
228
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
229
|
+
|
|
230
|
+
options.apply_defaults timeout: @config.rpcs.create_prediction_api_key_registration.timeout,
|
|
231
|
+
metadata: metadata,
|
|
232
|
+
retry_policy: @config.rpcs.create_prediction_api_key_registration.retry_policy
|
|
233
|
+
options.apply_defaults metadata: @config.metadata,
|
|
234
|
+
retry_policy: @config.retry_policy
|
|
235
|
+
|
|
236
|
+
@prediction_api_key_registry_stub.call_rpc :create_prediction_api_key_registration, request, options: options do |response, operation|
|
|
237
|
+
yield response, operation if block_given?
|
|
238
|
+
return response
|
|
239
|
+
end
|
|
240
|
+
rescue ::GRPC::BadStatus => e
|
|
241
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
##
|
|
245
|
+
# List the registered apiKeys for use with predict method.
|
|
246
|
+
#
|
|
247
|
+
# @overload list_prediction_api_key_registrations(request, options = nil)
|
|
248
|
+
# Pass arguments to `list_prediction_api_key_registrations` via a request object, either of type
|
|
249
|
+
# {::Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsRequest} or an equivalent Hash.
|
|
250
|
+
#
|
|
251
|
+
# @param request [::Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsRequest, ::Hash]
|
|
252
|
+
# A request object representing the call parameters. Required. To specify no
|
|
253
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
254
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
255
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
256
|
+
#
|
|
257
|
+
# @overload list_prediction_api_key_registrations(parent: nil, page_size: nil, page_token: nil)
|
|
258
|
+
# Pass arguments to `list_prediction_api_key_registrations` via keyword arguments. Note that at
|
|
259
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
260
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
261
|
+
#
|
|
262
|
+
# @param parent [::String]
|
|
263
|
+
# Required. The parent placement resource name such as
|
|
264
|
+
# "projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store"
|
|
265
|
+
# @param page_size [::Integer]
|
|
266
|
+
# Optional. Maximum number of results to return per page. If unset, the
|
|
267
|
+
# service will choose a reasonable default.
|
|
268
|
+
# @param page_token [::String]
|
|
269
|
+
# Optional. The previous `ListPredictionApiKeyRegistration.nextPageToken`.
|
|
270
|
+
#
|
|
271
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
272
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>]
|
|
273
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
274
|
+
#
|
|
275
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>]
|
|
276
|
+
#
|
|
277
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
278
|
+
#
|
|
279
|
+
def list_prediction_api_key_registrations request, options = nil
|
|
280
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
281
|
+
|
|
282
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsRequest
|
|
283
|
+
|
|
284
|
+
# Converts hash and nil to an options object
|
|
285
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
286
|
+
|
|
287
|
+
# Customize the options with defaults
|
|
288
|
+
metadata = @config.rpcs.list_prediction_api_key_registrations.metadata.to_h
|
|
289
|
+
|
|
290
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
291
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
292
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
293
|
+
gapic_version: ::Google::Cloud::RecommendationEngine::V1beta1::VERSION
|
|
294
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
295
|
+
|
|
296
|
+
header_params = {
|
|
297
|
+
"parent" => request.parent
|
|
298
|
+
}
|
|
299
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
300
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
301
|
+
|
|
302
|
+
options.apply_defaults timeout: @config.rpcs.list_prediction_api_key_registrations.timeout,
|
|
303
|
+
metadata: metadata,
|
|
304
|
+
retry_policy: @config.rpcs.list_prediction_api_key_registrations.retry_policy
|
|
305
|
+
options.apply_defaults metadata: @config.metadata,
|
|
306
|
+
retry_policy: @config.retry_policy
|
|
307
|
+
|
|
308
|
+
@prediction_api_key_registry_stub.call_rpc :list_prediction_api_key_registrations, request, options: options do |response, operation|
|
|
309
|
+
response = ::Gapic::PagedEnumerable.new @prediction_api_key_registry_stub, :list_prediction_api_key_registrations, request, response, operation, options
|
|
310
|
+
yield response, operation if block_given?
|
|
311
|
+
return response
|
|
312
|
+
end
|
|
313
|
+
rescue ::GRPC::BadStatus => e
|
|
314
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
##
|
|
318
|
+
# Unregister an apiKey from using for predict method.
|
|
319
|
+
#
|
|
320
|
+
# @overload delete_prediction_api_key_registration(request, options = nil)
|
|
321
|
+
# Pass arguments to `delete_prediction_api_key_registration` via a request object, either of type
|
|
322
|
+
# {::Google::Cloud::RecommendationEngine::V1beta1::DeletePredictionApiKeyRegistrationRequest} or an equivalent Hash.
|
|
323
|
+
#
|
|
324
|
+
# @param request [::Google::Cloud::RecommendationEngine::V1beta1::DeletePredictionApiKeyRegistrationRequest, ::Hash]
|
|
325
|
+
# A request object representing the call parameters. Required. To specify no
|
|
326
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
327
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
328
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
329
|
+
#
|
|
330
|
+
# @overload delete_prediction_api_key_registration(name: nil)
|
|
331
|
+
# Pass arguments to `delete_prediction_api_key_registration` via keyword arguments. Note that at
|
|
332
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
333
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
334
|
+
#
|
|
335
|
+
# @param name [::String]
|
|
336
|
+
# Required. The API key to unregister including full resource path.
|
|
337
|
+
# "projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/<YOUR_API_KEY>"
|
|
338
|
+
#
|
|
339
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
340
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
|
341
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
342
|
+
#
|
|
343
|
+
# @return [::Google::Protobuf::Empty]
|
|
344
|
+
#
|
|
345
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
346
|
+
#
|
|
347
|
+
def delete_prediction_api_key_registration request, options = nil
|
|
348
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
349
|
+
|
|
350
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecommendationEngine::V1beta1::DeletePredictionApiKeyRegistrationRequest
|
|
351
|
+
|
|
352
|
+
# Converts hash and nil to an options object
|
|
353
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
354
|
+
|
|
355
|
+
# Customize the options with defaults
|
|
356
|
+
metadata = @config.rpcs.delete_prediction_api_key_registration.metadata.to_h
|
|
357
|
+
|
|
358
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
359
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
360
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
361
|
+
gapic_version: ::Google::Cloud::RecommendationEngine::V1beta1::VERSION
|
|
362
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
363
|
+
|
|
364
|
+
header_params = {
|
|
365
|
+
"name" => request.name
|
|
366
|
+
}
|
|
367
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
368
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
369
|
+
|
|
370
|
+
options.apply_defaults timeout: @config.rpcs.delete_prediction_api_key_registration.timeout,
|
|
371
|
+
metadata: metadata,
|
|
372
|
+
retry_policy: @config.rpcs.delete_prediction_api_key_registration.retry_policy
|
|
373
|
+
options.apply_defaults metadata: @config.metadata,
|
|
374
|
+
retry_policy: @config.retry_policy
|
|
375
|
+
|
|
376
|
+
@prediction_api_key_registry_stub.call_rpc :delete_prediction_api_key_registration, request, options: options do |response, operation|
|
|
377
|
+
yield response, operation if block_given?
|
|
378
|
+
return response
|
|
379
|
+
end
|
|
380
|
+
rescue ::GRPC::BadStatus => e
|
|
381
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
##
|
|
385
|
+
# Configuration class for the PredictionApiKeyRegistry API.
|
|
386
|
+
#
|
|
387
|
+
# This class represents the configuration for PredictionApiKeyRegistry,
|
|
388
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
389
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
390
|
+
# applied individually to specific RPCs. See
|
|
391
|
+
# {::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client::Configuration::Rpcs}
|
|
392
|
+
# for a list of RPCs that can be configured independently.
|
|
393
|
+
#
|
|
394
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
395
|
+
# on construction.
|
|
396
|
+
#
|
|
397
|
+
# # Examples
|
|
398
|
+
#
|
|
399
|
+
# To modify the global config, setting the timeout for create_prediction_api_key_registration
|
|
400
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
|
401
|
+
#
|
|
402
|
+
# ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.configure do |config|
|
|
403
|
+
# config.timeout = 10.0
|
|
404
|
+
# config.rpcs.create_prediction_api_key_registration.timeout = 20.0
|
|
405
|
+
# end
|
|
406
|
+
#
|
|
407
|
+
# To apply the above configuration only to a new client:
|
|
408
|
+
#
|
|
409
|
+
# client = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new do |config|
|
|
410
|
+
# config.timeout = 10.0
|
|
411
|
+
# config.rpcs.create_prediction_api_key_registration.timeout = 20.0
|
|
412
|
+
# end
|
|
413
|
+
#
|
|
414
|
+
# @!attribute [rw] endpoint
|
|
415
|
+
# The hostname or hostname:port of the service endpoint.
|
|
416
|
+
# Defaults to `"recommendationengine.googleapis.com"`.
|
|
417
|
+
# @return [::String]
|
|
418
|
+
# @!attribute [rw] credentials
|
|
419
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
420
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
421
|
+
# * (`Hash`) A service account key as a Hash
|
|
422
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
423
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
|
424
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
425
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
|
426
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
427
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
428
|
+
# * (`nil`) indicating no credentials
|
|
429
|
+
# @return [::Object]
|
|
430
|
+
# @!attribute [rw] scope
|
|
431
|
+
# The OAuth scopes
|
|
432
|
+
# @return [::Array<::String>]
|
|
433
|
+
# @!attribute [rw] lib_name
|
|
434
|
+
# The library name as recorded in instrumentation and logging
|
|
435
|
+
# @return [::String]
|
|
436
|
+
# @!attribute [rw] lib_version
|
|
437
|
+
# The library version as recorded in instrumentation and logging
|
|
438
|
+
# @return [::String]
|
|
439
|
+
# @!attribute [rw] channel_args
|
|
440
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
|
441
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
|
442
|
+
# @return [::Hash]
|
|
443
|
+
# @!attribute [rw] interceptors
|
|
444
|
+
# An array of interceptors that are run before calls are executed.
|
|
445
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
|
446
|
+
# @!attribute [rw] timeout
|
|
447
|
+
# The call timeout in seconds.
|
|
448
|
+
# @return [::Numeric]
|
|
449
|
+
# @!attribute [rw] metadata
|
|
450
|
+
# Additional gRPC headers to be sent with the call.
|
|
451
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
452
|
+
# @!attribute [rw] retry_policy
|
|
453
|
+
# The retry policy. The value is a hash with the following keys:
|
|
454
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
455
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
456
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
457
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
458
|
+
# trigger a retry.
|
|
459
|
+
# @return [::Hash]
|
|
460
|
+
# @!attribute [rw] quota_project
|
|
461
|
+
# A separate project against which to charge quota.
|
|
462
|
+
# @return [::String]
|
|
463
|
+
#
|
|
464
|
+
class Configuration
|
|
465
|
+
extend ::Gapic::Config
|
|
466
|
+
|
|
467
|
+
config_attr :endpoint, "recommendationengine.googleapis.com", ::String
|
|
468
|
+
config_attr :credentials, nil do |value|
|
|
469
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
|
470
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
|
471
|
+
allowed.any? { |klass| klass === value }
|
|
472
|
+
end
|
|
473
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
474
|
+
config_attr :lib_name, nil, ::String, nil
|
|
475
|
+
config_attr :lib_version, nil, ::String, nil
|
|
476
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
|
477
|
+
config_attr :interceptors, nil, ::Array, nil
|
|
478
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
479
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
480
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
481
|
+
config_attr :quota_project, nil, ::String, nil
|
|
482
|
+
|
|
483
|
+
# @private
|
|
484
|
+
def initialize parent_config = nil
|
|
485
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
486
|
+
|
|
487
|
+
yield self if block_given?
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
##
|
|
491
|
+
# Configurations for individual RPCs
|
|
492
|
+
# @return [Rpcs]
|
|
493
|
+
#
|
|
494
|
+
def rpcs
|
|
495
|
+
@rpcs ||= begin
|
|
496
|
+
parent_rpcs = nil
|
|
497
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
|
498
|
+
Rpcs.new parent_rpcs
|
|
499
|
+
end
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
##
|
|
503
|
+
# Configuration RPC class for the PredictionApiKeyRegistry API.
|
|
504
|
+
#
|
|
505
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
506
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
507
|
+
# the following configuration fields:
|
|
508
|
+
#
|
|
509
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
|
510
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
|
511
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
512
|
+
# include the following keys:
|
|
513
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
514
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
515
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
516
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
517
|
+
# trigger a retry.
|
|
518
|
+
#
|
|
519
|
+
class Rpcs
|
|
520
|
+
##
|
|
521
|
+
# RPC-specific configuration for `create_prediction_api_key_registration`
|
|
522
|
+
# @return [::Gapic::Config::Method]
|
|
523
|
+
#
|
|
524
|
+
attr_reader :create_prediction_api_key_registration
|
|
525
|
+
##
|
|
526
|
+
# RPC-specific configuration for `list_prediction_api_key_registrations`
|
|
527
|
+
# @return [::Gapic::Config::Method]
|
|
528
|
+
#
|
|
529
|
+
attr_reader :list_prediction_api_key_registrations
|
|
530
|
+
##
|
|
531
|
+
# RPC-specific configuration for `delete_prediction_api_key_registration`
|
|
532
|
+
# @return [::Gapic::Config::Method]
|
|
533
|
+
#
|
|
534
|
+
attr_reader :delete_prediction_api_key_registration
|
|
535
|
+
|
|
536
|
+
# @private
|
|
537
|
+
def initialize parent_rpcs = nil
|
|
538
|
+
create_prediction_api_key_registration_config = parent_rpcs&.create_prediction_api_key_registration if parent_rpcs&.respond_to? :create_prediction_api_key_registration
|
|
539
|
+
@create_prediction_api_key_registration = ::Gapic::Config::Method.new create_prediction_api_key_registration_config
|
|
540
|
+
list_prediction_api_key_registrations_config = parent_rpcs&.list_prediction_api_key_registrations if parent_rpcs&.respond_to? :list_prediction_api_key_registrations
|
|
541
|
+
@list_prediction_api_key_registrations = ::Gapic::Config::Method.new list_prediction_api_key_registrations_config
|
|
542
|
+
delete_prediction_api_key_registration_config = parent_rpcs&.delete_prediction_api_key_registration if parent_rpcs&.respond_to? :delete_prediction_api_key_registration
|
|
543
|
+
@delete_prediction_api_key_registration = ::Gapic::Config::Method.new delete_prediction_api_key_registration_config
|
|
544
|
+
|
|
545
|
+
yield self if block_given?
|
|
546
|
+
end
|
|
547
|
+
end
|
|
548
|
+
end
|
|
549
|
+
end
|
|
550
|
+
end
|
|
551
|
+
end
|
|
552
|
+
end
|
|
553
|
+
end
|
|
554
|
+
end
|