From 3789ffa168cfbfce0056022e52e822844fde3ec3 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Mon, 9 Jul 2018 12:47:23 -0700 Subject: [PATCH 1/5] Update for the new gapic configuration --- Kms/src/V1/CreateCryptoKeyRequest.php | 20 ++- Kms/src/V1/CreateCryptoKeyVersionRequest.php | 17 ++- Kms/src/V1/CreateKeyRingRequest.php | 20 ++- Kms/src/V1/CryptoKey.php | 41 +++++- Kms/src/V1/CryptoKey/CryptoKeyPurpose.php | 34 +++++ Kms/src/V1/CryptoKeyVersion.php | 27 +++- .../CryptoKeyVersionState.php | 54 +++++++ ...CryptoKeyVersion_CryptoKeyVersionState.php | 47 +----- Kms/src/V1/CryptoKey_CryptoKeyPurpose.php | 27 +--- Kms/src/V1/DecryptRequest.php | 21 ++- Kms/src/V1/DecryptResponse.php | 14 +- Kms/src/V1/DestroyCryptoKeyVersionRequest.php | 14 +- Kms/src/V1/EncryptRequest.php | 23 ++- Kms/src/V1/EncryptResponse.php | 16 ++- .../Gapic/KeyManagementServiceGapicClient.php | 134 ++++++++++++++++++ Kms/src/V1/GetCryptoKeyRequest.php | 14 +- Kms/src/V1/GetCryptoKeyVersionRequest.php | 14 +- Kms/src/V1/GetKeyRingRequest.php | 14 +- Kms/src/V1/KeyRing.php | 17 ++- Kms/src/V1/ListCryptoKeyVersionsRequest.php | 24 +++- Kms/src/V1/ListCryptoKeyVersionsResponse.php | 21 ++- Kms/src/V1/ListCryptoKeysRequest.php | 23 ++- Kms/src/V1/ListCryptoKeysResponse.php | 19 ++- Kms/src/V1/ListKeyRingsRequest.php | 23 ++- Kms/src/V1/ListKeyRingsResponse.php | 19 ++- Kms/src/V1/RestoreCryptoKeyVersionRequest.php | 14 +- .../UpdateCryptoKeyPrimaryVersionRequest.php | 16 ++- Kms/src/V1/UpdateCryptoKeyRequest.php | 16 ++- Kms/src/V1/UpdateCryptoKeyVersionRequest.php | 16 ++- 29 files changed, 649 insertions(+), 110 deletions(-) create mode 100644 Kms/src/V1/CryptoKey/CryptoKeyPurpose.php create mode 100644 Kms/src/V1/CryptoKeyVersion/CryptoKeyVersionState.php diff --git a/Kms/src/V1/CreateCryptoKeyRequest.php b/Kms/src/V1/CreateCryptoKeyRequest.php index 57c5b58f04a4..dba0e4f5b360 100644 --- a/Kms/src/V1/CreateCryptoKeyRequest.php +++ b/Kms/src/V1/CreateCryptoKeyRequest.php @@ -36,9 +36,25 @@ class CreateCryptoKeyRequest extends \Google\Protobuf\Internal\Message */ private $crypto_key = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the + * [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * @type string $crypto_key_id + * Required. It must be unique within a KeyRing and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @type \Google\Cloud\Kms\V1\CryptoKey $crypto_key + * A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CreateCryptoKeyVersionRequest.php b/Kms/src/V1/CreateCryptoKeyVersionRequest.php index f356a10e92ea..65c9f949bf40 100644 --- a/Kms/src/V1/CreateCryptoKeyVersionRequest.php +++ b/Kms/src/V1/CreateCryptoKeyVersionRequest.php @@ -29,9 +29,22 @@ class CreateCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $crypto_key_version = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with + * the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * @type \Google\Cloud\Kms\V1\CryptoKeyVersion $crypto_key_version + * A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CreateKeyRingRequest.php b/Kms/src/V1/CreateKeyRingRequest.php index 5bfcef876e66..d839035cf3ff 100644 --- a/Kms/src/V1/CreateKeyRingRequest.php +++ b/Kms/src/V1/CreateKeyRingRequest.php @@ -36,9 +36,25 @@ class CreateKeyRingRequest extends \Google\Protobuf\Internal\Message */ private $key_ring = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @type string $key_ring_id + * Required. It must be unique within a location and match the regular + * expression `[a-zA-Z0-9_-]{1,63}` + * @type \Google\Cloud\Kms\V1\KeyRing $key_ring + * A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CryptoKey.php b/Kms/src/V1/CryptoKey.php index 5104214bcf2e..54fbcffd5522 100644 --- a/Kms/src/V1/CryptoKey.php +++ b/Kms/src/V1/CryptoKey.php @@ -69,9 +69,46 @@ class CryptoKey extends \Google\Protobuf\Internal\Message private $labels; protected $rotation_schedule; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format + * `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * @type \Google\Cloud\Kms\V1\CryptoKeyVersion $primary + * Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used + * by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given + * in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name]. + * The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via + * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. + * @type int $purpose + * The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. Currently, the only acceptable + * purpose is [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created. + * @type \Google\Protobuf\Timestamp $next_rotation_time + * At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically: + * 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. + * 2. Mark the new version as primary. + * Key rotations performed manually via + * [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and + * [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion] + * do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]. + * @type \Google\Protobuf\Duration $rotation_period + * [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service + * automatically rotates a key. Must be at least one day. + * If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set. + * @type array|\Google\Protobuf\Internal\MapField $labels + * Labels with user-defined metadata. For more information, see + * [Labeling Keys](/kms/docs/labeling-keys). + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Resources::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CryptoKey/CryptoKeyPurpose.php b/Kms/src/V1/CryptoKey/CryptoKeyPurpose.php new file mode 100644 index 000000000000..8ce5171b69a4 --- /dev/null +++ b/Kms/src/V1/CryptoKey/CryptoKeyPurpose.php @@ -0,0 +1,34 @@ +google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose + */ +class CryptoKeyPurpose +{ + /** + * Not specified. + * + * Generated from protobuf enum CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + */ + const CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + /** + * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + * + * Generated from protobuf enum ENCRYPT_DECRYPT = 1; + */ + const ENCRYPT_DECRYPT = 1; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CryptoKeyPurpose::class, \Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose::class); + diff --git a/Kms/src/V1/CryptoKeyVersion.php b/Kms/src/V1/CryptoKeyVersion.php index 9af4c4a0feda..e7f2e5be02f9 100644 --- a/Kms/src/V1/CryptoKeyVersion.php +++ b/Kms/src/V1/CryptoKeyVersion.php @@ -59,9 +59,32 @@ class CryptoKeyVersion extends \Google\Protobuf\Internal\Message */ private $destroy_event_time = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format + * `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. + * @type int $state + * The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created. + * @type \Google\Protobuf\Timestamp $destroy_time + * Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled + * for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + * [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]. + * @type \Google\Protobuf\Timestamp $destroy_event_time + * Output only. The time this CryptoKeyVersion's key material was + * destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is + * [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Resources::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/CryptoKeyVersion/CryptoKeyVersionState.php b/Kms/src/V1/CryptoKeyVersion/CryptoKeyVersionState.php new file mode 100644 index 000000000000..f572885cf2ab --- /dev/null +++ b/Kms/src/V1/CryptoKeyVersion/CryptoKeyVersionState.php @@ -0,0 +1,54 @@ +google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState + */ +class CryptoKeyVersionState +{ + /** + * Not specified. + * + * Generated from protobuf enum CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + */ + const CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + /** + * This version may be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] requests. + * + * Generated from protobuf enum ENABLED = 1; + */ + const ENABLED = 1; + /** + * This version may not be used, but the key material is still available, + * and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. + * + * Generated from protobuf enum DISABLED = 2; + */ + const DISABLED = 2; + /** + * This version is destroyed, and the key material is no longer stored. + * A version may not leave this state once entered. + * + * Generated from protobuf enum DESTROYED = 3; + */ + const DESTROYED = 3; + /** + * This version is scheduled for destruction, and will be destroyed soon. + * Call + * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + * to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. + * + * Generated from protobuf enum DESTROY_SCHEDULED = 4; + */ + const DESTROY_SCHEDULED = 4; +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CryptoKeyVersionState::class, \Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionState::class); + diff --git a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php index 762544b828e4..7d9db84c6868 100644 --- a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php +++ b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php @@ -4,48 +4,13 @@ namespace Google\Cloud\Kms\V1; -/** - * The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating if it can be used. - * - * Protobuf enum Google\Cloud\Kms\V1\CryptoKeyVersion\CryptoKeyVersionState - */ -class CryptoKeyVersion_CryptoKeyVersionState -{ +if (false) { /** - * Not specified. - * - * Generated from protobuf enum CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\Kms\V1\CryptoKeyVersion\CryptoKeyVersionState instead. + * @deprecated */ - const CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; - /** - * This version may be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt] requests. - * - * Generated from protobuf enum ENABLED = 1; - */ - const ENABLED = 1; - /** - * This version may not be used, but the key material is still available, - * and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. - * - * Generated from protobuf enum DISABLED = 2; - */ - const DISABLED = 2; - /** - * This version is destroyed, and the key material is no longer stored. - * A version may not leave this state once entered. - * - * Generated from protobuf enum DESTROYED = 3; - */ - const DESTROYED = 3; - /** - * This version is scheduled for destruction, and will be destroyed soon. - * Call - * [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] - * to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. - * - * Generated from protobuf enum DESTROY_SCHEDULED = 4; - */ - const DESTROY_SCHEDULED = 4; + class CryptoKeyVersion_CryptoKeyVersionState {} } +class_exists(CryptoKeyVersion\CryptoKeyVersionState::class); +@trigger_error('Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionState is deprecated and will be removed in the next major release. Use Google\Cloud\Kms\V1\CryptoKeyVersion\CryptoKeyVersionState instead', E_USER_DEPRECATED); diff --git a/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php b/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php index 40bfd2567a41..42ebcff7b628 100644 --- a/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php +++ b/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php @@ -4,28 +4,13 @@ namespace Google\Cloud\Kms\V1; -/** - * [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] describes the capabilities of a [CryptoKey][google.cloud.kms.v1.CryptoKey]. Two - * keys with the same purpose may use different underlying algorithms, but - * must support the same set of operations. - * - * Protobuf enum Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose - */ -class CryptoKey_CryptoKeyPurpose -{ +if (false) { /** - * Not specified. - * - * Generated from protobuf enum CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; + * This class is deprecated. Use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose instead. + * @deprecated */ - const CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; - /** - * [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - * [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. - * - * Generated from protobuf enum ENCRYPT_DECRYPT = 1; - */ - const ENCRYPT_DECRYPT = 1; + class CryptoKey_CryptoKeyPurpose {} } +class_exists(CryptoKey\CryptoKeyPurpose::class); +@trigger_error('Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose is deprecated and will be removed in the next major release. Use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose instead', E_USER_DEPRECATED); diff --git a/Kms/src/V1/DecryptRequest.php b/Kms/src/V1/DecryptRequest.php index 917f2e2e5f78..d3caf54f7139 100644 --- a/Kms/src/V1/DecryptRequest.php +++ b/Kms/src/V1/DecryptRequest.php @@ -37,9 +37,26 @@ class DecryptRequest extends \Google\Protobuf\Internal\Message */ private $additional_authenticated_data = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. + * The server will choose the appropriate version. + * @type string $ciphertext + * Required. The encrypted data originally returned in + * [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. + * @type string $additional_authenticated_data + * Optional data that must match the data originally supplied in + * [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/DecryptResponse.php b/Kms/src/V1/DecryptResponse.php index 86e69c7a7fc3..edf43b0a3ddf 100644 --- a/Kms/src/V1/DecryptResponse.php +++ b/Kms/src/V1/DecryptResponse.php @@ -22,9 +22,19 @@ class DecryptResponse extends \Google\Protobuf\Internal\Message */ private $plaintext = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $plaintext + * The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/DestroyCryptoKeyVersionRequest.php b/Kms/src/V1/DestroyCryptoKeyVersionRequest.php index 6f3605f37794..7a651102b01b 100644 --- a/Kms/src/V1/DestroyCryptoKeyVersionRequest.php +++ b/Kms/src/V1/DestroyCryptoKeyVersionRequest.php @@ -22,9 +22,19 @@ class DestroyCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/EncryptRequest.php b/Kms/src/V1/EncryptRequest.php index ef98e7a893ff..418dda7e5a05 100644 --- a/Kms/src/V1/EncryptRequest.php +++ b/Kms/src/V1/EncryptRequest.php @@ -39,9 +39,28 @@ class EncryptRequest extends \Google\Protobuf\Internal\Message */ private $additional_authenticated_data = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] + * to use for encryption. + * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its + * [primary version][google.cloud.kms.v1.CryptoKey.primary]. + * @type string $plaintext + * Required. The data to encrypt. Must be no larger than 64KiB. + * @type string $additional_authenticated_data + * Optional data that, if specified, must also be provided during decryption + * through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. Must be no + * larger than 64KiB. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/EncryptResponse.php b/Kms/src/V1/EncryptResponse.php index 1d2ff07b1b40..1f32fae72eb7 100644 --- a/Kms/src/V1/EncryptResponse.php +++ b/Kms/src/V1/EncryptResponse.php @@ -28,9 +28,21 @@ class EncryptResponse extends \Google\Protobuf\Internal\Message */ private $ciphertext = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption. + * @type string $ciphertext + * The encrypted data. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php b/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php index 8bf154babec2..d95e0dcd3740 100644 --- a/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php +++ b/Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php @@ -32,6 +32,7 @@ use Google\ApiCore\FetchAuthTokenInterface; use Google\ApiCore\GapicClientTrait; use Google\ApiCore\PathTemplate; +use Google\ApiCore\RequestParamsHeaderDescriptor; use Google\ApiCore\RetrySettings; use Google\ApiCore\Transport\TransportInterface; use Google\ApiCore\ValidationException; @@ -495,6 +496,13 @@ public function listKeyRings($parent, array $optionalArgs = []) $request->setPageToken($optionalArgs['pageToken']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListKeyRings', $optionalArgs, @@ -566,6 +574,13 @@ public function listCryptoKeys($parent, array $optionalArgs = []) $request->setPageToken($optionalArgs['pageToken']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListCryptoKeys', $optionalArgs, @@ -637,6 +652,13 @@ public function listCryptoKeyVersions($parent, array $optionalArgs = []) $request->setPageToken($optionalArgs['pageToken']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->getPagedListResponse( 'ListCryptoKeyVersions', $optionalArgs, @@ -680,6 +702,13 @@ public function getKeyRing($name, array $optionalArgs = []) $request = new GetKeyRingRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetKeyRing', KeyRing::class, @@ -724,6 +753,13 @@ public function getCryptoKey($name, array $optionalArgs = []) $request = new GetCryptoKeyRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetCryptoKey', CryptoKey::class, @@ -767,6 +803,13 @@ public function getCryptoKeyVersion($name, array $optionalArgs = []) $request = new GetCryptoKeyVersionRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetCryptoKeyVersion', CryptoKeyVersion::class, @@ -818,6 +861,13 @@ public function createKeyRing($parent, $keyRingId, $keyRing, array $optionalArgs $request->setKeyRingId($keyRingId); $request->setKeyRing($keyRing); + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'CreateKeyRing', KeyRing::class, @@ -881,6 +931,13 @@ public function createCryptoKey($parent, $cryptoKeyId, $cryptoKey, array $option $request->setCryptoKeyId($cryptoKeyId); $request->setCryptoKey($cryptoKey); + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'CreateCryptoKey', CryptoKey::class, @@ -932,6 +989,13 @@ public function createCryptoKeyVersion($parent, $cryptoKeyVersion, array $option $request->setParent($parent); $request->setCryptoKeyVersion($cryptoKeyVersion); + $requestParams = new RequestParamsHeaderDescriptor([ + 'parent' => $request->getParent(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'CreateCryptoKeyVersion', CryptoKeyVersion::class, @@ -978,6 +1042,13 @@ public function updateCryptoKey($cryptoKey, $updateMask, array $optionalArgs = [ $request->setCryptoKey($cryptoKey); $request->setUpdateMask($updateMask); + $requestParams = new RequestParamsHeaderDescriptor([ + 'crypto_key.name' => $request->getCryptoKey()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'UpdateCryptoKey', CryptoKey::class, @@ -1030,6 +1101,13 @@ public function updateCryptoKeyVersion($cryptoKeyVersion, $updateMask, array $op $request->setCryptoKeyVersion($cryptoKeyVersion); $request->setUpdateMask($updateMask); + $requestParams = new RequestParamsHeaderDescriptor([ + 'crypto_key_version.name' => $request->getCryptoKeyVersion()->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'UpdateCryptoKeyVersion', CryptoKeyVersion::class, @@ -1087,6 +1165,13 @@ public function encrypt($name, $plaintext, array $optionalArgs = []) $request->setAdditionalAuthenticatedData($optionalArgs['additionalAuthenticatedData']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'Encrypt', EncryptResponse::class, @@ -1141,6 +1226,13 @@ public function decrypt($name, $ciphertext, array $optionalArgs = []) $request->setAdditionalAuthenticatedData($optionalArgs['additionalAuthenticatedData']); } + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'Decrypt', DecryptResponse::class, @@ -1187,6 +1279,13 @@ public function updateCryptoKeyPrimaryVersion($name, $cryptoKeyVersionId, array $request->setName($name); $request->setCryptoKeyVersionId($cryptoKeyVersionId); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'UpdateCryptoKeyPrimaryVersion', CryptoKey::class, @@ -1241,6 +1340,13 @@ public function destroyCryptoKeyVersion($name, array $optionalArgs = []) $request = new DestroyCryptoKeyVersionRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'DestroyCryptoKeyVersion', CryptoKeyVersion::class, @@ -1290,6 +1396,13 @@ public function restoreCryptoKeyVersion($name, array $optionalArgs = []) $request = new RestoreCryptoKeyVersionRequest(); $request->setName($name); + $requestParams = new RequestParamsHeaderDescriptor([ + 'name' => $request->getName(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'RestoreCryptoKeyVersion', CryptoKeyVersion::class, @@ -1342,6 +1455,13 @@ public function setIamPolicy($resource, $policy, array $optionalArgs = []) $request->setResource($resource); $request->setPolicy($policy); + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'SetIamPolicy', Policy::class, @@ -1391,6 +1511,13 @@ public function getIamPolicy($resource, array $optionalArgs = []) $request = new GetIamPolicyRequest(); $request->setResource($resource); + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'GetIamPolicy', Policy::class, @@ -1446,6 +1573,13 @@ public function testIamPermissions($resource, $permissions, array $optionalArgs $request->setResource($resource); $request->setPermissions($permissions); + $requestParams = new RequestParamsHeaderDescriptor([ + 'resource' => $request->getResource(), + ]); + $optionalArgs['headers'] = isset($optionalArgs['headers']) + ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) + : $requestParams->getHeader(); + return $this->startCall( 'TestIamPermissions', TestIamPermissionsResponse::class, diff --git a/Kms/src/V1/GetCryptoKeyRequest.php b/Kms/src/V1/GetCryptoKeyRequest.php index f0fcf26ff4d1..34f76b73eb9e 100644 --- a/Kms/src/V1/GetCryptoKeyRequest.php +++ b/Kms/src/V1/GetCryptoKeyRequest.php @@ -22,9 +22,19 @@ class GetCryptoKeyRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/GetCryptoKeyVersionRequest.php b/Kms/src/V1/GetCryptoKeyVersionRequest.php index 3a2aa7f71fc3..76c7d48fcf72 100644 --- a/Kms/src/V1/GetCryptoKeyVersionRequest.php +++ b/Kms/src/V1/GetCryptoKeyVersionRequest.php @@ -22,9 +22,19 @@ class GetCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/GetKeyRingRequest.php b/Kms/src/V1/GetKeyRingRequest.php index b1e5c3aa8fcb..7374fee9a4c1 100644 --- a/Kms/src/V1/GetKeyRingRequest.php +++ b/Kms/src/V1/GetKeyRingRequest.php @@ -22,9 +22,19 @@ class GetKeyRingRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/KeyRing.php b/Kms/src/V1/KeyRing.php index 2d43d5990fca..a9619f7f0c01 100644 --- a/Kms/src/V1/KeyRing.php +++ b/Kms/src/V1/KeyRing.php @@ -29,9 +29,22 @@ class KeyRing extends \Google\Protobuf\Internal\Message */ private $create_time = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format + * `projects/*/locations/*/keyRings/*`. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Resources::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListCryptoKeyVersionsRequest.php b/Kms/src/V1/ListCryptoKeyVersionsRequest.php index e49c1f37e030..e85246fb7a4b 100644 --- a/Kms/src/V1/ListCryptoKeyVersionsRequest.php +++ b/Kms/src/V1/ListCryptoKeyVersionsRequest.php @@ -40,9 +40,29 @@ class ListCryptoKeyVersionsRequest extends \Google\Protobuf\Internal\Message */ private $page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format + * `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + * @type int $page_size + * Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to + * include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can + * subsequently be obtained by including the + * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request. + * If unspecified, the server will pick an appropriate default. + * @type string $page_token + * Optional pagination token, returned earlier via + * [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListCryptoKeyVersionsResponse.php b/Kms/src/V1/ListCryptoKeyVersionsResponse.php index a0f7e5a7f80f..5ecefbcbde61 100644 --- a/Kms/src/V1/ListCryptoKeyVersionsResponse.php +++ b/Kms/src/V1/ListCryptoKeyVersionsResponse.php @@ -37,9 +37,26 @@ class ListCryptoKeyVersionsResponse extends \Google\Protobuf\Internal\Message */ private $total_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\CryptoKeyVersion[]|\Google\Protobuf\Internal\RepeatedField $crypto_key_versions + * The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. + * @type string $next_page_token + * A token to retrieve next page of results. Pass this value in + * [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of + * results. + * @type int $total_size + * The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the + * query. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListCryptoKeysRequest.php b/Kms/src/V1/ListCryptoKeysRequest.php index 5113689092ba..11da90ea1f52 100644 --- a/Kms/src/V1/ListCryptoKeysRequest.php +++ b/Kms/src/V1/ListCryptoKeysRequest.php @@ -39,9 +39,28 @@ class ListCryptoKeysRequest extends \Google\Protobuf\Internal\Message */ private $page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format + * `projects/*/locations/*/keyRings/*`. + * @type int $page_size + * Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the + * response. Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by + * including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @type string $page_token + * Optional pagination token, returned earlier via + * [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListCryptoKeysResponse.php b/Kms/src/V1/ListCryptoKeysResponse.php index 2ebab46334c0..4fe6b561323c 100644 --- a/Kms/src/V1/ListCryptoKeysResponse.php +++ b/Kms/src/V1/ListCryptoKeysResponse.php @@ -35,9 +35,24 @@ class ListCryptoKeysResponse extends \Google\Protobuf\Internal\Message */ private $total_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\CryptoKey[]|\Google\Protobuf\Internal\RepeatedField $crypto_keys + * The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. + * @type string $next_page_token + * A token to retrieve next page of results. Pass this value in + * [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results. + * @type int $total_size + * The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListKeyRingsRequest.php b/Kms/src/V1/ListKeyRingsRequest.php index 24fc95d30219..956e2dc0c13e 100644 --- a/Kms/src/V1/ListKeyRingsRequest.php +++ b/Kms/src/V1/ListKeyRingsRequest.php @@ -39,9 +39,28 @@ class ListKeyRingsRequest extends \Google\Protobuf\Internal\Message */ private $page_token = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the location associated with the + * [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. + * @type int $page_size + * Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the + * response. Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by + * including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent + * request. If unspecified, the server will pick an appropriate default. + * @type string $page_token + * Optional pagination token, returned earlier via + * [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/ListKeyRingsResponse.php b/Kms/src/V1/ListKeyRingsResponse.php index 1cf9add01122..fc052f41ba63 100644 --- a/Kms/src/V1/ListKeyRingsResponse.php +++ b/Kms/src/V1/ListKeyRingsResponse.php @@ -35,9 +35,24 @@ class ListKeyRingsResponse extends \Google\Protobuf\Internal\Message */ private $total_size = 0; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\KeyRing[]|\Google\Protobuf\Internal\RepeatedField $key_rings + * The list of [KeyRings][google.cloud.kms.v1.KeyRing]. + * @type string $next_page_token + * A token to retrieve next page of results. Pass this value in + * [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results. + * @type int $total_size + * The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/RestoreCryptoKeyVersionRequest.php b/Kms/src/V1/RestoreCryptoKeyVersionRequest.php index 19addd9a95f5..0f52336c85ae 100644 --- a/Kms/src/V1/RestoreCryptoKeyVersionRequest.php +++ b/Kms/src/V1/RestoreCryptoKeyVersionRequest.php @@ -22,9 +22,19 @@ class RestoreCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $name = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/UpdateCryptoKeyPrimaryVersionRequest.php b/Kms/src/V1/UpdateCryptoKeyPrimaryVersionRequest.php index 573dbed536df..b21c2727f4ec 100644 --- a/Kms/src/V1/UpdateCryptoKeyPrimaryVersionRequest.php +++ b/Kms/src/V1/UpdateCryptoKeyPrimaryVersionRequest.php @@ -28,9 +28,21 @@ class UpdateCryptoKeyPrimaryVersionRequest extends \Google\Protobuf\Internal\Mes */ private $crypto_key_version_id = ''; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. + * @type string $crypto_key_version_id + * The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/UpdateCryptoKeyRequest.php b/Kms/src/V1/UpdateCryptoKeyRequest.php index fe6ca2a2bd03..2fd1140d14b2 100644 --- a/Kms/src/V1/UpdateCryptoKeyRequest.php +++ b/Kms/src/V1/UpdateCryptoKeyRequest.php @@ -28,9 +28,21 @@ class UpdateCryptoKeyRequest extends \Google\Protobuf\Internal\Message */ private $update_mask = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\CryptoKey $crypto_key + * [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. + * @type \Google\Protobuf\FieldMask $update_mask + * Required list of fields to be updated in this request. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** diff --git a/Kms/src/V1/UpdateCryptoKeyVersionRequest.php b/Kms/src/V1/UpdateCryptoKeyVersionRequest.php index 6f5fc3d80c53..df0b11cae709 100644 --- a/Kms/src/V1/UpdateCryptoKeyVersionRequest.php +++ b/Kms/src/V1/UpdateCryptoKeyVersionRequest.php @@ -28,9 +28,21 @@ class UpdateCryptoKeyVersionRequest extends \Google\Protobuf\Internal\Message */ private $update_mask = null; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Kms\V1\CryptoKeyVersion $crypto_key_version + * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values. + * @type \Google\Protobuf\FieldMask $update_mask + * Required list of fields to be updated in this request. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Kms\V1\Service::initOnce(); - parent::__construct(); + parent::__construct($data); } /** From 63cb004a88318f91eac6d6bdaa70b25144182c74 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Mon, 9 Jul 2018 12:52:46 -0700 Subject: [PATCH 2/5] Docs update for the new and nicer namespace --- Kms/README.md | 4 ++-- Kms/src/V1/README.md | 4 ++-- README.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Kms/README.md b/Kms/README.md index bec197abd2ee..2cb04df2dd85 100644 --- a/Kms/README.md +++ b/Kms/README.md @@ -41,7 +41,7 @@ require __DIR__ . '/vendor/autoload.php'; use Google\ApiCore\ApiException; use Google\Cloud\Kms\V1\CryptoKey; -use Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose; +use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose; use Google\Cloud\Kms\V1\KeyManagementServiceClient; use Google\Cloud\Kms\V1\KeyRing; @@ -74,7 +74,7 @@ try { } catch (ApiException $e) { if ($e->getStatus() === 'NOT_FOUND') { $cryptoKey = new CryptoKey(); - $cryptoKey->setPurpose(CryptoKey_CryptoKeyPurpose::ENCRYPT_DECRYPT); + $cryptoKey->setPurpose(CryptoKeyPurpose::ENCRYPT_DECRYPT); $cryptoKey = $client->createCryptoKey($keyRingName, $keyId, $cryptoKey); } } diff --git a/Kms/src/V1/README.md b/Kms/src/V1/README.md index 17d08bfb3032..97dc2073162d 100644 --- a/Kms/src/V1/README.md +++ b/Kms/src/V1/README.md @@ -7,7 +7,7 @@ require __DIR__ . '/vendor/autoload.php'; use Google\ApiCore\ApiException; use Google\Cloud\Kms\V1\CryptoKey; -use Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose; +use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose; use Google\Cloud\Kms\V1\KeyManagementServiceClient; use Google\Cloud\Kms\V1\KeyRing; @@ -40,7 +40,7 @@ try { } catch (ApiException $e) { if ($e->getStatus() === 'NOT_FOUND') { $cryptoKey = new CryptoKey(); - $cryptoKey->setPurpose(CryptoKey_CryptoKeyPurpose::ENCRYPT_DECRYPT); + $cryptoKey->setPurpose(CryptoKeyPurpose::ENCRYPT_DECRYPT); $cryptoKey = $client->createCryptoKey($keyRingName, $keyId, $cryptoKey); } } diff --git a/README.md b/README.md index 2b50064f7aab..4de6f954b4fa 100644 --- a/README.md +++ b/README.md @@ -584,7 +584,7 @@ require __DIR__ . '/vendor/autoload.php'; use Google\ApiCore\ApiException; use Google\Cloud\Kms\V1\CryptoKey; -use Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose; +use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose; use Google\Cloud\Kms\V1\KeyManagementServiceClient; use Google\Cloud\Kms\V1\KeyRing; @@ -617,7 +617,7 @@ try { } catch (ApiException $e) { if ($e->getStatus() === 'NOT_FOUND') { $cryptoKey = new CryptoKey(); - $cryptoKey->setPurpose(CryptoKey_CryptoKeyPurpose::ENCRYPT_DECRYPT); + $cryptoKey->setPurpose(CryptoKeyPurpose::ENCRYPT_DECRYPT); $cryptoKey = $client->createCryptoKey($keyRingName, $keyId, $cryptoKey); } } From 95d2dd7215af1fd20892b573fcdea8244939c843 Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Mon, 9 Jul 2018 13:39:04 -0700 Subject: [PATCH 3/5] Removed the files with the old namespace --- .../CryptoKeyVersion_CryptoKeyVersionState.php | 16 ---------------- Kms/src/V1/CryptoKey_CryptoKeyPurpose.php | 16 ---------------- 2 files changed, 32 deletions(-) delete mode 100644 Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php delete mode 100644 Kms/src/V1/CryptoKey_CryptoKeyPurpose.php diff --git a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php deleted file mode 100644 index 7d9db84c6868..000000000000 --- a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php +++ /dev/null @@ -1,16 +0,0 @@ - Date: Wed, 11 Jul 2018 14:54:02 -0700 Subject: [PATCH 4/5] Use the new namespace in the code sample Add back the deprecated files --- .../CryptoKeyVersion_CryptoKeyVersionState.php | 16 ++++++++++++++++ Kms/src/V1/CryptoKey_CryptoKeyPurpose.php | 16 ++++++++++++++++ .../V1/Gapic/KeyManagementServiceGapicClient.php | 2 +- Kms/synth.py | 7 +++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php create mode 100644 Kms/src/V1/CryptoKey_CryptoKeyPurpose.php diff --git a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php new file mode 100644 index 000000000000..7d9db84c6868 --- /dev/null +++ b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php @@ -0,0 +1,16 @@ +keyRingName('[PROJECT]', '[LOCATION]', '[KEY_RING]'); * $cryptoKeyId = 'my-app-key'; - * $purpose = CryptoKey_CryptoKeyPurpose::ENCRYPT_DECRYPT; + * $purpose = CryptoKeyPurpose::ENCRYPT_DECRYPT; * $seconds = 2147483647; * $nextRotationTime = new Timestamp(); * $nextRotationTime->setSeconds($seconds); diff --git a/Kms/synth.py b/Kms/synth.py index 6a5331b498ad..e224fac62404 100644 --- a/Kms/synth.py +++ b/Kms/synth.py @@ -43,3 +43,10 @@ 'tests/**/V1/*Test.php', r'Copyright \d{4}', r'Copyright 2018') + +# Use new namespace in the doc sample. See +# https://github.com/googleapis/gapic-generator/issues/2141 +s.replace( + 'src/V1/Gapic/KeyManagementServiceGapicClient.php', + r'CryptoKey_CryptoKeyPurpose', + 'CryptoKeyPurpose') From cf47ce3294dc0dd9cb8ce4a6c164167b6600955a Mon Sep 17 00:00:00 2001 From: Takashi Matsuo Date: Thu, 12 Jul 2018 09:49:14 -0700 Subject: [PATCH 5/5] Changed the wording for the deprecation warning --- Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php | 2 +- Kms/src/V1/CryptoKey_CryptoKeyPurpose.php | 2 +- Kms/synth.py | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php index 7d9db84c6868..1cd489fcf69a 100644 --- a/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php +++ b/Kms/src/V1/CryptoKeyVersion_CryptoKeyVersionState.php @@ -12,5 +12,5 @@ class CryptoKeyVersion_CryptoKeyVersionState {} } class_exists(CryptoKeyVersion\CryptoKeyVersionState::class); -@trigger_error('Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionState is deprecated and will be removed in the next major release. Use Google\Cloud\Kms\V1\CryptoKeyVersion\CryptoKeyVersionState instead', E_USER_DEPRECATED); +@trigger_error('Google\Cloud\Kms\V1\CryptoKeyVersion_CryptoKeyVersionState is deprecated and will be removed in a future release. Use Google\Cloud\Kms\V1\CryptoKeyVersion\CryptoKeyVersionState instead', E_USER_DEPRECATED); diff --git a/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php b/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php index 42ebcff7b628..7c6f9388bd95 100644 --- a/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php +++ b/Kms/src/V1/CryptoKey_CryptoKeyPurpose.php @@ -12,5 +12,5 @@ class CryptoKey_CryptoKeyPurpose {} } class_exists(CryptoKey\CryptoKeyPurpose::class); -@trigger_error('Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose is deprecated and will be removed in the next major release. Use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose instead', E_USER_DEPRECATED); +@trigger_error('Google\Cloud\Kms\V1\CryptoKey_CryptoKeyPurpose is deprecated and will be removed in a future release. Use Google\Cloud\Kms\V1\CryptoKey\CryptoKeyPurpose instead', E_USER_DEPRECATED); diff --git a/Kms/synth.py b/Kms/synth.py index e224fac62404..6e5b024ffb97 100644 --- a/Kms/synth.py +++ b/Kms/synth.py @@ -50,3 +50,8 @@ 'src/V1/Gapic/KeyManagementServiceGapicClient.php', r'CryptoKey_CryptoKeyPurpose', 'CryptoKeyPurpose') +# Change the wording for the deprecation warning. +s.replace( + 'src/V1/CryptoKey*_*.php', + r'will be removed in the next major release', + 'will be removed in a future release')