Reference documentation and code samples for the Recommendations AI V1beta1 API class Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Rest::Client.
REST 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::Rest::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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call 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::Rest::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>
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Protobuf::Empty)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call 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::Rest::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 REST 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::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Rest::Client.new do |config| config.timeout = 10.0 end
#list_prediction_api_key_registrations
def list_prediction_api_key_registrations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>
def list_prediction_api_key_registrations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::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::Rest::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::Rest::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
.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>)
- (::Google::Cloud::Error) — if the REST call 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::Rest::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 elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration. p item end