Reference documentation and code samples for the API Keys V2 API class Google::Cloud::ApiKeys::V2::ApiKeys::Rest::Client.
REST client for the ApiKeys service.
Manages the API keys associated with projects.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the ApiKeys Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all ApiKeys clients ::Google::Cloud::ApiKeys::V2::ApiKeys::Rest::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the ApiKeys 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_key
def create_key(request, options = nil) -> ::Gapic::Operation
def create_key(parent: nil, key: nil, key_id: nil) -> ::Gapic::Operation
Creates a new API key.
NOTE: Key is a global resource; hence the only supported value for
location is global
.
def create_key(request, options = nil) -> ::Gapic::Operation
create_key
via a request object, either of type
CreateKeyRequest or an equivalent Hash.
- request (::Google::Cloud::ApiKeys::V2::CreateKeyRequest, ::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_key(parent: nil, key: nil, key_id: nil) -> ::Gapic::Operation
create_key
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 project in which the API key is created.
-
key (::Google::Cloud::ApiKeys::V2::Key, ::Hash) — Required. The API key fields to set at creation time.
You can configure only the
display_name
,restrictions
, andannotations
fields. -
key_id (::String) — User specified key id (optional). If specified, it will become the final
component of the key resource name.
The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression:
[a-z]([a-z0-9-]{0,61}[a-z0-9])?
.The id must NOT be a UUID-like string.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
#delete_key
def delete_key(request, options = nil) -> ::Gapic::Operation
def delete_key(name: nil, etag: nil) -> ::Gapic::Operation
Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.
NOTE: Key is a global resource; hence the only supported value for
location is global
.
def delete_key(request, options = nil) -> ::Gapic::Operation
delete_key
via a request object, either of type
DeleteKeyRequest or an equivalent Hash.
- request (::Google::Cloud::ApiKeys::V2::DeleteKeyRequest, ::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_key(name: nil, etag: nil) -> ::Gapic::Operation
delete_key
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 resource name of the API key to be deleted.
- etag (::String) — Optional. The etag known to the client for the expected state of the key. This is to be used for optimistic concurrency.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
#get_key
def get_key(request, options = nil) -> ::Google::Cloud::ApiKeys::V2::Key
def get_key(name: nil) -> ::Google::Cloud::ApiKeys::V2::Key
Gets the metadata for an API key. The key string of the API key isn't included in the response.
NOTE: Key is a global resource; hence the only supported value for
location is global
.
def get_key(request, options = nil) -> ::Google::Cloud::ApiKeys::V2::Key
get_key
via a request object, either of type
GetKeyRequest or an equivalent Hash.
- request (::Google::Cloud::ApiKeys::V2::GetKeyRequest, ::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 get_key(name: nil) -> ::Google::Cloud::ApiKeys::V2::Key
get_key
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 resource name of the API key to get.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::ApiKeys::V2::Key)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
#get_key_string
def get_key_string(request, options = nil) -> ::Google::Cloud::ApiKeys::V2::GetKeyStringResponse
def get_key_string(name: nil) -> ::Google::Cloud::ApiKeys::V2::GetKeyStringResponse
Get the key string for an API key.
NOTE: Key is a global resource; hence the only supported value for
location is global
.
def get_key_string(request, options = nil) -> ::Google::Cloud::ApiKeys::V2::GetKeyStringResponse
get_key_string
via a request object, either of type
GetKeyStringRequest or an equivalent Hash.
- request (::Google::Cloud::ApiKeys::V2::GetKeyStringRequest, ::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 get_key_string(name: nil) -> ::Google::Cloud::ApiKeys::V2::GetKeyStringResponse
get_key_string
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 resource name of the API key to be retrieved.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::ApiKeys::V2::GetKeyStringResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
#initialize
def initialize() { |config| ... } -> Client
Create a new ApiKeys REST client object.
- (config) — Configure the ApiKeys client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::ApiKeys::V2::ApiKeys::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::ApiKeys::V2::ApiKeys::Rest::Client.new do |config| config.timeout = 10.0 end
#list_keys
def list_keys(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ApiKeys::V2::Key>
def list_keys(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ApiKeys::V2::Key>
Lists the API keys owned by a project. The key string of the API key isn't included in the response.
NOTE: Key is a global resource; hence the only supported value for
location is global
.
def list_keys(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ApiKeys::V2::Key>
list_keys
via a request object, either of type
ListKeysRequest or an equivalent Hash.
- request (::Google::Cloud::ApiKeys::V2::ListKeysRequest, ::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_keys(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ApiKeys::V2::Key>
list_keys
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. Lists all API keys associated with this project.
- page_size (::Integer) — Optional. Specifies the maximum number of results to be returned at a time.
- page_token (::String) — Optional. Requests a specific page of results.
- show_deleted (::Boolean) — Optional. Indicate that keys deleted in the past 30 days should also be returned.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::ApiKeys::V2::Key>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::ApiKeys::V2::Key>)
- (::Google::Cloud::Error) — if the REST call is aborted.
#lookup_key
def lookup_key(request, options = nil) -> ::Google::Cloud::ApiKeys::V2::LookupKeyResponse
def lookup_key(key_string: nil) -> ::Google::Cloud::ApiKeys::V2::LookupKeyResponse
Find the parent project and resource name of the API
key that matches the key string in the request. If the API key has been
purged, resource name will not be set.
The service account must have the apikeys.keys.lookup
permission
on the parent project.
def lookup_key(request, options = nil) -> ::Google::Cloud::ApiKeys::V2::LookupKeyResponse
lookup_key
via a request object, either of type
LookupKeyRequest or an equivalent Hash.
- request (::Google::Cloud::ApiKeys::V2::LookupKeyRequest, ::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 lookup_key(key_string: nil) -> ::Google::Cloud::ApiKeys::V2::LookupKeyResponse
lookup_key
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).
- key_string (::String) — Required. Finds the project that owns the key string value.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::ApiKeys::V2::LookupKeyResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
#operations_client
def operations_client() -> ::Google::Cloud::ApiKeys::V2::ApiKeys::Rest::Operations
Get the associated client for long-running operations.
#undelete_key
def undelete_key(request, options = nil) -> ::Gapic::Operation
def undelete_key(name: nil) -> ::Gapic::Operation
Undeletes an API key which was deleted within 30 days.
NOTE: Key is a global resource; hence the only supported value for
location is global
.
def undelete_key(request, options = nil) -> ::Gapic::Operation
undelete_key
via a request object, either of type
UndeleteKeyRequest or an equivalent Hash.
- request (::Google::Cloud::ApiKeys::V2::UndeleteKeyRequest, ::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 undelete_key(name: nil) -> ::Gapic::Operation
undelete_key
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 resource name of the API key to be undeleted.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
#update_key
def update_key(request, options = nil) -> ::Gapic::Operation
def update_key(key: nil, update_mask: nil) -> ::Gapic::Operation
Patches the modifiable fields of an API key. The key string of the API key isn't included in the response.
NOTE: Key is a global resource; hence the only supported value for
location is global
.
def update_key(request, options = nil) -> ::Gapic::Operation
update_key
via a request object, either of type
UpdateKeyRequest or an equivalent Hash.
- request (::Google::Cloud::ApiKeys::V2::UpdateKeyRequest, ::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 update_key(key: nil, update_mask: nil) -> ::Gapic::Operation
update_key
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).
-
key (::Google::Cloud::ApiKeys::V2::Key, ::Hash) — Required. Set the
name
field to the resource name of the API key to be updated. You can update only thedisplay_name
,restrictions
, andannotations
fields. -
update_mask (::Google::Protobuf::FieldMask, ::Hash) — The field mask specifies which fields to be updated as part of this
request. All other fields are ignored.
Mutable fields are:
display_name
,restrictions
, andannotations
. If an update mask is not provided, the service treats it as an implied mask equivalent to all allowed fields that are set on the wire. If the field mask has a special value "*", the service treats it equivalent to replace all allowed mutable fields.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.