Class MockKeyManagementServiceConnection (2.19.0)

A class to mock KeyManagementServiceConnection.

Application developers may want to test their code with simulated responses, including errors, from an object of type KeyManagementServiceClient. To do so, construct an object of type KeyManagementServiceClient with an instance of this class. Then use the Google Test framework functions to program the behavior of this mock.

See Also

This example for how to test your application with GoogleTest. While the example showcases types from the BigQuery library, the underlying principles apply for any pair of *Client and *Connection.

Functions

virtual options()

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Returns
TypeDescription
Options

virtual ListKeyRings(google::cloud::kms::v1::ListKeyRingsRequest)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::ListKeyRingsRequest
Returns
TypeDescription
StreamRange< google::cloud::kms::v1::KeyRing >

virtual ListCryptoKeys(google::cloud::kms::v1::ListCryptoKeysRequest)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::ListCryptoKeysRequest
Returns
TypeDescription
StreamRange< google::cloud::kms::v1::CryptoKey >

virtual ListCryptoKeyVersions(google::cloud::kms::v1::ListCryptoKeyVersionsRequest)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::ListCryptoKeyVersionsRequest
Returns
TypeDescription
StreamRange< google::cloud::kms::v1::CryptoKeyVersion >

virtual ListImportJobs(google::cloud::kms::v1::ListImportJobsRequest)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::ListImportJobsRequest
Returns
TypeDescription
StreamRange< google::cloud::kms::v1::ImportJob >

virtual GetKeyRing(google::cloud::kms::v1::GetKeyRingRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::GetKeyRingRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::KeyRing >

virtual GetCryptoKey(google::cloud::kms::v1::GetCryptoKeyRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::GetCryptoKeyRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKey >

virtual GetCryptoKeyVersion(google::cloud::kms::v1::GetCryptoKeyVersionRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::GetCryptoKeyVersionRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKeyVersion >

virtual GetPublicKey(google::cloud::kms::v1::GetPublicKeyRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::GetPublicKeyRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::PublicKey >

virtual GetImportJob(google::cloud::kms::v1::GetImportJobRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::GetImportJobRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::ImportJob >

virtual CreateKeyRing(google::cloud::kms::v1::CreateKeyRingRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::CreateKeyRingRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::KeyRing >

virtual CreateCryptoKey(google::cloud::kms::v1::CreateCryptoKeyRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::CreateCryptoKeyRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKey >

virtual CreateCryptoKeyVersion(google::cloud::kms::v1::CreateCryptoKeyVersionRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::CreateCryptoKeyVersionRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKeyVersion >

virtual ImportCryptoKeyVersion(google::cloud::kms::v1::ImportCryptoKeyVersionRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::ImportCryptoKeyVersionRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKeyVersion >

virtual CreateImportJob(google::cloud::kms::v1::CreateImportJobRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::CreateImportJobRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::ImportJob >

virtual UpdateCryptoKey(google::cloud::kms::v1::UpdateCryptoKeyRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::UpdateCryptoKeyRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKey >

virtual UpdateCryptoKeyVersion(google::cloud::kms::v1::UpdateCryptoKeyVersionRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::UpdateCryptoKeyVersionRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKeyVersion >

virtual UpdateCryptoKeyPrimaryVersion(google::cloud::kms::v1::UpdateCryptoKeyPrimaryVersionRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::UpdateCryptoKeyPrimaryVersionRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKey >

virtual DestroyCryptoKeyVersion(google::cloud::kms::v1::DestroyCryptoKeyVersionRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::DestroyCryptoKeyVersionRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKeyVersion >

virtual RestoreCryptoKeyVersion(google::cloud::kms::v1::RestoreCryptoKeyVersionRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::RestoreCryptoKeyVersionRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::CryptoKeyVersion >

virtual Encrypt(google::cloud::kms::v1::EncryptRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::EncryptRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::EncryptResponse >

virtual Decrypt(google::cloud::kms::v1::DecryptRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::DecryptRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::DecryptResponse >

virtual RawEncrypt(google::cloud::kms::v1::RawEncryptRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::RawEncryptRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::RawEncryptResponse >

virtual RawDecrypt(google::cloud::kms::v1::RawDecryptRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::RawDecryptRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::RawDecryptResponse >

virtual AsymmetricSign(google::cloud::kms::v1::AsymmetricSignRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::AsymmetricSignRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::AsymmetricSignResponse >

virtual AsymmetricDecrypt(google::cloud::kms::v1::AsymmetricDecryptRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::AsymmetricDecryptRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::AsymmetricDecryptResponse >

virtual MacSign(google::cloud::kms::v1::MacSignRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::MacSignRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::MacSignResponse >

virtual MacVerify(google::cloud::kms::v1::MacVerifyRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::MacVerifyRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::MacVerifyResponse >

virtual GenerateRandomBytes(google::cloud::kms::v1::GenerateRandomBytesRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::kms::v1::GenerateRandomBytesRequest const &
Returns
TypeDescription
StatusOr< google::cloud::kms::v1::GenerateRandomBytesResponse >