Class ApiKeysClient (2.11.0)

Manages the API keys associated with projects.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

ApiKeysClient(ApiKeysClient const &)

Copy and move support

Parameter
Name Description
ApiKeysClient const &

ApiKeysClient(ApiKeysClient &&)

Copy and move support

Parameter
Name Description
ApiKeysClient &&

ApiKeysClient(std::shared_ptr< ApiKeysConnection >, Options)

Parameters
Name Description
connection std::shared_ptr< ApiKeysConnection >
opts Options

Operators

operator=(ApiKeysClient const &)

Copy and move support

Parameter
Name Description
ApiKeysClient const &
Returns
Type Description
ApiKeysClient &

operator=(ApiKeysClient &&)

Copy and move support

Parameter
Name Description
ApiKeysClient &&
Returns
Type Description
ApiKeysClient &

Functions

CreateKey(std::string const &, google::api::apikeys::v2::Key const &, std::string const &, Options)

Creates a new API key.

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

Parameters
Name Description
parent std::string const &

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

key google::api::apikeys::v2::Key const &

Required. The API key fields to set at creation time. You can configure only the display_name, restrictions, and annotations fields.

key_id std::string const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::api::apikeys::v2::Key > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.api.apikeys.v2.Key proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

CreateKey(google::api::apikeys::v2::CreateKeyRequest const &, Options)

Creates a new API key.

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

Parameters
Name Description
request google::api::apikeys::v2::CreateKeyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.api.apikeys.v2.CreateKeyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::api::apikeys::v2::Key > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.api.apikeys.v2.Key proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

ListKeys(std::string const &, Options)

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
Name Description
parent std::string const &

Required. Lists all API keys associated with this project.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::api::apikeys::v2::Key >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.api.apikeys.v2.Key, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListKeys(google::api::apikeys::v2::ListKeysRequest, Options)

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
Name Description
request google::api::apikeys::v2::ListKeysRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.api.apikeys.v2.ListKeysRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StreamRange< google::api::apikeys::v2::Key >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.api.apikeys.v2.Key, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetKey(std::string const &, Options)

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 Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::api::apikeys::v2::Key >

the result of the RPC. The response message type (google.api.apikeys.v2.Key) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetKey(google::api::apikeys::v2::GetKeyRequest const &, Options)

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 Description
request google::api::apikeys::v2::GetKeyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.api.apikeys.v2.GetKeyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::api::apikeys::v2::Key >

the result of the RPC. The response message type (google.api.apikeys.v2.Key) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetKeyString(std::string const &, Options)

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 Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::api::apikeys::v2::GetKeyStringResponse >

the result of the RPC. The response message type (google.api.apikeys.v2.GetKeyStringResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetKeyString(google::api::apikeys::v2::GetKeyStringRequest const &, Options)

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 Description
request google::api::apikeys::v2::GetKeyStringRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.api.apikeys.v2.GetKeyStringRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::api::apikeys::v2::GetKeyStringResponse >

the result of the RPC. The response message type (google.api.apikeys.v2.GetKeyStringResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

UpdateKey(google::api::apikeys::v2::Key const &, google::protobuf::FieldMask const &, Options)

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 Description
key google::api::apikeys::v2::Key const &

Required. Set the name field to the resource name of the API key to be updated. You can update only the display_name, restrictions, and annotations fields.

update_mask google::protobuf::FieldMask const &

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.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::api::apikeys::v2::Key > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.api.apikeys.v2.Key proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

UpdateKey(google::api::apikeys::v2::UpdateKeyRequest const &, Options)

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 Description
request google::api::apikeys::v2::UpdateKeyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.api.apikeys.v2.UpdateKeyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::api::apikeys::v2::Key > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.api.apikeys.v2.Key proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

DeleteKey(std::string const &, Options)

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 Description
name std::string const &

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

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::api::apikeys::v2::Key > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.api.apikeys.v2.Key proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

DeleteKey(google::api::apikeys::v2::DeleteKeyRequest const &, Options)

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 Description
request google::api::apikeys::v2::DeleteKeyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.api.apikeys.v2.DeleteKeyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::api::apikeys::v2::Key > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.api.apikeys.v2.Key proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

UndeleteKey(google::api::apikeys::v2::UndeleteKeyRequest const &, Options)

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 Description
request google::api::apikeys::v2::UndeleteKeyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.api.apikeys.v2.UndeleteKeyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
future< StatusOr< google::api::apikeys::v2::Key > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.api.apikeys.v2.Key proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

LookupKey(google::api::apikeys::v2::LookupKeyRequest const &, Options)

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
Name Description
request google::api::apikeys::v2::LookupKeyRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.api.apikeys.v2.LookupKeyRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
Type Description
StatusOr< google::api::apikeys::v2::LookupKeyResponse >

the result of the RPC. The response message type (google.api.apikeys.v2.LookupKeyResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.