Recommendations AI V1beta1 API - Class Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Rest::Client (v0.8.2)

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.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#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.

Overloads
def create_prediction_api_key_registration(request, options = nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration
Pass arguments to create_prediction_api_key_registration via a request object, either of type CreatePredictionApiKeyRegistrationRequest or an equivalent Hash.
Parameters
def create_prediction_api_key_registration(parent: nil, prediction_api_key_registration: nil) -> ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration
Pass arguments to 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

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.

Overloads
def delete_prediction_api_key_registration(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_prediction_api_key_registration via a request object, either of type DeletePredictionApiKeyRegistrationRequest or an equivalent Hash.
Parameters
def delete_prediction_api_key_registration(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to 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).
Parameter
  • 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>
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

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.

Yields
  • (config) — Configure the PredictionApiKeyRegistry client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# 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.

Overloads
def list_prediction_api_key_registrations(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>
Pass arguments to list_prediction_api_key_registrations via a request object, either of type ListPredictionApiKeyRegistrationsRequest or an equivalent Hash.
Parameters
def list_prediction_api_key_registrations(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

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

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)