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

0.18.0 (latest) 0.17.1 0.16.0 0.15.1 0.14.0 0.13.0 0.12.1 0.11.0 0.10.0 0.9.2 0.8.2 0.7.0 0.6.1 0.5.0 0.4.1 0.3.7 Reference documentation and code samples for the Recommendations AI V1beta1 API class Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.

Client for the PredictionApiKeyRegistry service.


<br />

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

## Includes

- [Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the PredictionApiKeyRegistry Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Client-Configuration "Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Client-Configuration))
**Example**

```ruby
# 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Client#Google__Cloud__RecommendationEngine__V1beta1__PredictionApiKeyRegistry__Client_configure_class_ "Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Client-Configuration "Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-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.
**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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-CreatePredictionApiKeyRegistrationRequest "Google::Cloud::RecommendationEngine::V1beta1::CreatePredictionApiKeyRegistrationRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::RecommendationEngine::V1beta1::CreatePredictionApiKeyRegistrationRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/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

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**

- **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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistration), ::Hash) --- Required. The prediction API key registration.
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistration))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistration))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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.
**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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-DeletePredictionApiKeyRegistrationRequest "Google::Cloud::RecommendationEngine::V1beta1::DeletePredictionApiKeyRegistrationRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::RecommendationEngine::V1beta1::DeletePredictionApiKeyRegistrationRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/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

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**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Protobuf-Empty))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Protobuf::Empty](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Protobuf-Empty))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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.
**Yields**

- (config) --- Configure the PredictionApiKeyRegistry client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistry-Client)) --- a new instance of Client
**Example**

```ruby
# 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.
**Overloads**

    def list_prediction_api_key_registrations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>

Pass arguments to `list_prediction_api_key_registrations` via a request object, either of type [ListPredictionApiKeyRegistrationsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-ListPredictionApiKeyRegistrationsRequest "Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/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>

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**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** (::Gapic::PagedEnumerable\<[::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistration)\>)
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- (::Gapic::PagedEnumerable\<[::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-recommendation_engine-v1beta1/latest/Google-Cloud-RecommendationEngine-V1beta1-PredictionApiKeyRegistration)\>)
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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 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
```

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)