Class: Google::Apis::ApikeysV2::ApiKeysServiceService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
lib/google/apis/apikeys_v2/service.rb

Overview

API Keys API

Manages the API keys associated with developer projects.

Examples:

require 'google/apis/apikeys_v2'

Apikeys = Google::Apis::ApikeysV2 # Alias the module
service = Apikeys::ApiKeysServiceService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://apikeys.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApiKeysServiceService

Returns a new instance of ApiKeysServiceService.



47
48
49
50
51
52
# File 'lib/google/apis/apikeys_v2/service.rb', line 47

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-apikeys_v2',
        client_version: Google::Apis::ApikeysV2::GEM_VERSION)
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



40
41
42
# File 'lib/google/apis/apikeys_v2/service.rb', line 40

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



45
46
47
# File 'lib/google/apis/apikeys_v2/service.rb', line 45

def quota_user
  @quota_user
end

Instance Method Details

#create_project_location_key(parent, v2_key_object = nil, key_id: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::Operation

Creates a new API key. NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters:

  • parent (String)

    Required. The project in which the API key is created.

  • v2_key_object (Google::Apis::ApikeysV2::V2Key) (defaults to: nil)
  • key_id (String) (defaults to: nil)

    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.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/google/apis/apikeys_v2/service.rb', line 147

def create_project_location_key(parent, v2_key_object = nil, key_id: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v2/{+parent}/keys', options)
  command.request_representation = Google::Apis::ApikeysV2::V2Key::Representation
  command.request_object = v2_key_object
  command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
  command.response_class = Google::Apis::ApikeysV2::Operation
  command.params['parent'] = parent unless parent.nil?
  command.query['keyId'] = key_id unless key_id.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_project_location_key(name, etag: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::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.

Parameters:

  • name (String)

    Required. The resource name of the API key to be deleted.

  • etag (String) (defaults to: nil)

    Optional. The etag known to the client for the expected state of the key. This is to be used for optimistic concurrency.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



185
186
187
188
189
190
191
192
193
194
# File 'lib/google/apis/apikeys_v2/service.rb', line 185

def delete_project_location_key(name, etag: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v2/{+name}', options)
  command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
  command.response_class = Google::Apis::ApikeysV2::Operation
  command.params['name'] = name unless name.nil?
  command.query['etag'] = etag unless etag.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_operation(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::Operation

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters:

  • name (String)

    The name of the operation resource.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



108
109
110
111
112
113
114
115
116
# File 'lib/google/apis/apikeys_v2/service.rb', line 108

def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}', options)
  command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
  command.response_class = Google::Apis::ApikeysV2::Operation
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_project_location_key(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::V2Key

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.

Parameters:

  • name (String)

    Required. The resource name of the API key to get.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



218
219
220
221
222
223
224
225
226
# File 'lib/google/apis/apikeys_v2/service.rb', line 218

def get_project_location_key(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}', options)
  command.response_representation = Google::Apis::ApikeysV2::V2Key::Representation
  command.response_class = Google::Apis::ApikeysV2::V2Key
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#get_project_location_key_key_string(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::V2GetKeyStringResponse

Get the key string for an API key. NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters:

  • name (String)

    Required. The resource name of the API key to be retrieved.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



249
250
251
252
253
254
255
256
257
# File 'lib/google/apis/apikeys_v2/service.rb', line 249

def get_project_location_key_key_string(name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+name}/keyString', options)
  command.response_representation = Google::Apis::ApikeysV2::V2GetKeyStringResponse::Representation
  command.response_class = Google::Apis::ApikeysV2::V2GetKeyStringResponse
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_project_location_keys(parent, page_size: nil, page_token: nil, show_deleted: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::V2ListKeysResponse

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.

Parameters:

  • parent (String)

    Required. Lists all API keys associated with this project.

  • page_size (Fixnum) (defaults to: nil)

    Optional. Specifies the maximum number of results to be returned at a time.

  • page_token (String) (defaults to: nil)

    Optional. Requests a specific page of results.

  • show_deleted (Boolean) (defaults to: nil)

    Optional. Indicate that keys deleted in the past 30 days should also be returned.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/google/apis/apikeys_v2/service.rb', line 288

def list_project_location_keys(parent, page_size: nil, page_token: nil, show_deleted: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/{+parent}/keys', options)
  command.response_representation = Google::Apis::ApikeysV2::V2ListKeysResponse::Representation
  command.response_class = Google::Apis::ApikeysV2::V2ListKeysResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['showDeleted'] = show_deleted unless show_deleted.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#lookup_key_key(key_string: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::V2LookupKeyResponse

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.

Parameters:

  • key_string (String) (defaults to: nil)

    Required. Finds the project that owns the key string value.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



77
78
79
80
81
82
83
84
85
# File 'lib/google/apis/apikeys_v2/service.rb', line 77

def lookup_key_key(key_string: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v2/keys:lookupKey', options)
  command.response_representation = Google::Apis::ApikeysV2::V2LookupKeyResponse::Representation
  command.response_class = Google::Apis::ApikeysV2::V2LookupKeyResponse
  command.query['keyString'] = key_string unless key_string.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#patch_project_location_key(name, v2_key_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::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.

Parameters:

  • name (String)

    Output only. The resource name of the key. The name has the form: projects// locations/global/keys/. For example: projects/123456867718/locations/global/ keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2 NOTE: Key is a global resource; hence the only supported value for location is global.

  • v2_key_object (Google::Apis::ApikeysV2::V2Key) (defaults to: nil)
  • update_mask (String) (defaults to: nil)

    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, and annotations. 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.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/google/apis/apikeys_v2/service.rb', line 334

def patch_project_location_key(name, v2_key_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v2/{+name}', options)
  command.request_representation = Google::Apis::ApikeysV2::V2Key::Representation
  command.request_object = v2_key_object
  command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
  command.response_class = Google::Apis::ApikeysV2::Operation
  command.params['name'] = name unless name.nil?
  command.query['updateMask'] = update_mask unless update_mask.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#undelete_project_location_key(name, v2_undelete_key_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::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.

Parameters:

  • name (String)

    Required. The resource name of the API key to be undeleted.

  • v2_undelete_key_request_object (Google::Apis::ApikeysV2::V2UndeleteKeyRequest) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



369
370
371
372
373
374
375
376
377
378
379
# File 'lib/google/apis/apikeys_v2/service.rb', line 369

def undelete_project_location_key(name, v2_undelete_key_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v2/{+name}:undelete', options)
  command.request_representation = Google::Apis::ApikeysV2::V2UndeleteKeyRequest::Representation
  command.request_object = v2_undelete_key_request_object
  command.response_representation = Google::Apis::ApikeysV2::Operation::Representation
  command.response_class = Google::Apis::ApikeysV2::Operation
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end