Reference documentation and code samples for the Recommendations AI V1beta1 API class Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.
Client for the PredictionApiKeyRegistry service.
Service for registering API keys for use with the predict
method. If you
use an API key to request predictions, you must first register the API key.
Otherwise, your prediction request is rejected. If you use OAuth to
authenticate your predict
method call, you do not need to register an API
key. You can register up to 20 API keys per project.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the PredictionApiKeyRegistry Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all PredictionApiKeyRegistry clients ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the PredictionApiKeyRegistry Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_prediction_api_key_registration
def create_prediction_api_key_registration(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration
def create_prediction_api_key_registration(parent: nil, prediction_api_key_registration: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration
Register an API key for use with predict method.
def create_prediction_api_key_registration(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration
create_prediction_api_key_registration
via a request object, either of type
CreatePredictionApiKeyRegistrationRequest or an equivalent Hash.
- request (::Google::Cloud::RecommendationEngine::V1beta1::CreatePredictionApiKeyRegistrationRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_prediction_api_key_registration(parent: nil, prediction_api_key_registration: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration
create_prediction_api_key_registration
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The parent resource path.
projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store
. - prediction_api_key_registration (::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration, ::Hash) — Required. The prediction API key registration.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/recommendation_engine/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::RecommendationEngine::V1beta1::CreatePredictionApiKeyRegistrationRequest.new # Call the create_prediction_api_key_registration method. result = client.create_prediction_api_key_registration request # The returned object is of type Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration. p result
#delete_prediction_api_key_registration
def delete_prediction_api_key_registration(request, options = nil) -> ::Google::Protobuf::Empty
def delete_prediction_api_key_registration(name: nil) -> ::Google::Protobuf::Empty
Unregister an apiKey from using for predict method.
def delete_prediction_api_key_registration(request, options = nil) -> ::Google::Protobuf::Empty
delete_prediction_api_key_registration
via a request object, either of type
DeletePredictionApiKeyRegistrationRequest or an equivalent Hash.
- request (::Google::Cloud::RecommendationEngine::V1beta1::DeletePredictionApiKeyRegistrationRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_prediction_api_key_registration(name: nil) -> ::Google::Protobuf::Empty
delete_prediction_api_key_registration
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The API key to unregister including full resource path.
projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/predictionApiKeyRegistrations/<YOUR_API_KEY>
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/recommendation_engine/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::RecommendationEngine::V1beta1::DeletePredictionApiKeyRegistrationRequest.new # Call the delete_prediction_api_key_registration method. result = client.delete_prediction_api_key_registration request # The returned object is of type Google::Protobuf::Empty. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new PredictionApiKeyRegistry client object.
- (config) — Configure the PredictionApiKeyRegistry client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new # Create a client using a custom configuration client = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new do |config| config.timeout = 10.0 end
#list_prediction_api_key_registrations
def list_prediction_api_key_registrations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>
def list_prediction_api_key_registrations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>
List the registered apiKeys for use with predict method.
def list_prediction_api_key_registrations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>
list_prediction_api_key_registrations
via a request object, either of type
ListPredictionApiKeyRegistrationsRequest or an equivalent Hash.
- request (::Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_prediction_api_key_registrations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>
list_prediction_api_key_registrations
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The parent placement resource name such as
projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store
- page_size (::Integer) — Optional. Maximum number of results to return per page. If unset, the service will choose a reasonable default.
-
page_token (::String) — Optional. The previous
ListPredictionApiKeyRegistration.nextPageToken
.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/recommendation_engine/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsRequest.new # Call the list_prediction_api_key_registrations method. result = client.list_prediction_api_key_registrations request # The returned object is of type Gapic::PagedEnumerable. You can # iterate over all elements by calling #each, and the enumerable # will lazily make API calls to fetch subsequent pages. Other # methods are also available for managing paging directly. result.each do |response| # Each element is of type ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration. p response end