Class: Google::Apis::ApikeysV2::ApiKeysServiceService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::ApikeysV2::ApiKeysServiceService
- Defined in:
- lib/google/apis/apikeys_v2/service.rb
Overview
API Keys API
Manages the API keys associated with developer projects.
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Instance Method Summary collapse
-
#clone_project_location_key(name, v2_clone_key_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::Operation
Clones the existing key's restriction and display name to a new API key.
-
#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.
-
#delete_project_location_key(name, etag: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::Operation
Deletes an API key.
-
#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.
-
#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.
-
#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.
-
#initialize ⇒ ApiKeysServiceService
constructor
A new instance of ApiKeysServiceService.
-
#list_project_location_keys(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::V2ListKeysResponse
Lists the API keys owned by a project.
-
#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.
-
#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.
-
#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.
Constructor Details
#initialize ⇒ ApiKeysServiceService
Returns a new instance of ApiKeysServiceService.
45 46 47 48 49 50 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 45 def initialize super('https://apikeys.googleapis.com/', '', client_name: 'google-apis-apikeys_v2', client_version: Google::Apis::ApikeysV2::GEM_VERSION) @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
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.
38 39 40 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 38 def key @key end |
#quota_user ⇒ String
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.
43 44 45 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 43 def quota_user @quota_user end |
Instance Method Details
#clone_project_location_key(name, v2_clone_key_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ApikeysV2::Operation
Clones the existing key's restriction and display name to a new API key. The
service account must have the apikeys.keys.get and apikeys.keys.create
permissions in the project. NOTE: Key is a global resource; hence the only
supported value for location is global.
140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 140 def clone_project_location_key(name, v2_clone_key_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v2/{+name}:clone', ) command.request_representation = Google::Apis::ApikeysV2::V2CloneKeyRequest::Representation command.request_object = v2_clone_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 |
#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.
181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 181 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', ) 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.
219 220 221 222 223 224 225 226 227 228 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 219 def delete_project_location_key(name, etag: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:delete, 'v2/{+name}', ) 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.
106 107 108 109 110 111 112 113 114 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 106 def get_operation(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v2/{+name}', ) 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.
252 253 254 255 256 257 258 259 260 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 252 def get_project_location_key(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v2/{+name}', ) 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.
283 284 285 286 287 288 289 290 291 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 283 def get_project_location_key_key_string(name, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v2/{+name}/keyString', ) 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, filter: nil, page_size: nil, page_token: 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.
323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 323 def list_project_location_keys(parent, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v2/{+parent}/keys', ) command.response_representation = Google::Apis::ApikeysV2::V2ListKeysResponse::Representation command.response_class = Google::Apis::ApikeysV2::V2ListKeysResponse command.params['parent'] = parent unless parent.nil? command.query['filter'] = filter unless filter.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.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.
75 76 77 78 79 80 81 82 83 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 75 def lookup_key_key(key_string: nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:get, 'v2/keys:lookupKey', ) 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.
369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 369 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}', ) 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.
404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/google/apis/apikeys_v2/service.rb', line 404 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', ) 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 |