KeyRing.
// Creates an API client for the KMS API.
client = kms_v1.KeyManagementServiceClient()
// Construct the resource name of the CryptoKeyVersion.
name = client.crypto_key_version_path(project_id, location_id, key_ring_id,
crypto_key_id, version_id)
// Use the KMS API to enable the CryptoKeyVersion.
new_state = enums.CryptoKeyVersion.CryptoKeyVersionState.ENABLED
version = {"name": name, "state": new_state}
update_mask = {"paths": ["state"]}
// Print results
response = client.update_crypto_key_version(version, update_mask)
print("CryptoKeyVersion {}\"s state has been set to {}.".format(
name, response.state))
// [END kms_enable_cryptokey_version]