Class MockKeyManagementServiceConnection (2.32.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
Type Description
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
Name Description
request google::cloud::kms::v1::ListKeyRingsRequest
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::ListCryptoKeysRequest
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::ListCryptoKeyVersionsRequest
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::ListImportJobsRequest
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::GetKeyRingRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::GetCryptoKeyRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::GetCryptoKeyVersionRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::GetPublicKeyRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::GetImportJobRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::CreateKeyRingRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::CreateCryptoKeyRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::CreateCryptoKeyVersionRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::ImportCryptoKeyVersionRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::CreateImportJobRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::UpdateCryptoKeyRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::UpdateCryptoKeyVersionRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::UpdateCryptoKeyPrimaryVersionRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::DestroyCryptoKeyVersionRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::RestoreCryptoKeyVersionRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::EncryptRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::DecryptRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::RawEncryptRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::RawDecryptRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::AsymmetricSignRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::AsymmetricDecryptRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::MacSignRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::MacVerifyRequest const &
Returns
Type Description
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
Name Description
request google::cloud::kms::v1::GenerateRandomBytesRequest const &
Returns
Type Description
StatusOr< google::cloud::kms::v1::GenerateRandomBytesResponse >

virtual ListLocations(google::cloud::location::ListLocationsRequest)

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

Parameter
Name Description
request google::cloud::location::ListLocationsRequest
Returns
Type Description
StreamRange< google::cloud::location::Location >

virtual GetLocation(google::cloud::location::GetLocationRequest const &)

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

Parameter
Name Description
request google::cloud::location::GetLocationRequest const &
Returns
Type Description
StatusOr< google::cloud::location::Location >

virtual SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &)

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

Parameter
Name Description
request google::iam::v1::SetIamPolicyRequest const &
Returns
Type Description
StatusOr< google::iam::v1::Policy >

virtual GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &)

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

Parameter
Name Description
request google::iam::v1::GetIamPolicyRequest const &
Returns
Type Description
StatusOr< google::iam::v1::Policy >

virtual TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &)

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

Parameter
Name Description
request google::iam::v1::TestIamPermissionsRequest const &
Returns
Type Description
StatusOr< google::iam::v1::TestIamPermissionsResponse >

virtual GetOperation(google::longrunning::GetOperationRequest const &)

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

Parameter
Name Description
request google::longrunning::GetOperationRequest const &
Returns
Type Description
StatusOr< google::longrunning::Operation >