diff --git a/Kms/metadata/V1/Autokey.php b/Kms/metadata/V1/Autokey.php
index 70d2bde78227..ef11d5b06ac3 100644
--- a/Kms/metadata/V1/Autokey.php
+++ b/Kms/metadata/V1/Autokey.php
@@ -21,7 +21,7 @@ public static function initOnce() {
\GPBMetadata\Google\Longrunning\Operations::initOnce();
$pool->internalAddGeneratedFile(
'
-—
+â
!google/cloud/kms/v1/autokey.protogoogle.cloud.kms.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto#google/longrunning/operations.proto"¨
CreateKeyHandleRequest9
parent ( B)àAúA#
@@ -39,13 +39,17 @@ public static function initOnce() {
resource_type_selector ( BàA:~êA{
!cloudkms.googleapis.com/KeyHandle?projects/{project}/locations/{location}/keyHandles/{key_handle}*
keyHandles2 keyHandle"
-CreateKeyHandleMetadata"g
+CreateKeyHandleMetadata"˜
ListKeyHandlesRequest9
parent ( B)àAúA#
-!locations.googleapis.com/Location
-filter ( BàA"M
+!locations.googleapis.com/Location
+ page_size (BàA
+
+page_token ( BàA
+filter ( BàA"f
ListKeyHandlesResponse3
-key_handles (2.google.cloud.kms.v1.KeyHandle2´
+key_handles (2.google.cloud.kms.v1.KeyHandle
+next_page_token ( 2´
Autokeyë
CreateKeyHandle+.google.cloud.kms.v1.CreateKeyHandleRequest.google.longrunning.Operation"‹ÊA$
KeyHandleCreateKeyHandleMetadataÚAparent,key_handle,key_handle_id‚Óä“<"./v1/{parent=projects/*/locations/*}/keyHandles:
diff --git a/Kms/metadata/V1/AutokeyAdmin.php b/Kms/metadata/V1/AutokeyAdmin.php
index 99612e46685c..947aaed125ac 100644
Binary files a/Kms/metadata/V1/AutokeyAdmin.php and b/Kms/metadata/V1/AutokeyAdmin.php differ
diff --git a/Kms/metadata/V1/EkmService.php b/Kms/metadata/V1/EkmService.php
index 1a0843690b3a..8602060992a5 100644
Binary files a/Kms/metadata/V1/EkmService.php and b/Kms/metadata/V1/EkmService.php differ
diff --git a/Kms/samples/V1/AutokeyClient/list_key_handles.php b/Kms/samples/V1/AutokeyClient/list_key_handles.php
index fc36755063d5..900bc825fe12 100644
--- a/Kms/samples/V1/AutokeyClient/list_key_handles.php
+++ b/Kms/samples/V1/AutokeyClient/list_key_handles.php
@@ -24,9 +24,10 @@
// [START cloudkms_v1_generated_Autokey_ListKeyHandles_sync]
use Google\ApiCore\ApiException;
+use Google\ApiCore\PagedListResponse;
use Google\Cloud\Kms\V1\Client\AutokeyClient;
+use Google\Cloud\Kms\V1\KeyHandle;
use Google\Cloud\Kms\V1\ListKeyHandlesRequest;
-use Google\Cloud\Kms\V1\ListKeyHandlesResponse;
/**
* Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].
@@ -47,9 +48,13 @@ function list_key_handles_sample(string $formattedParent): void
// Call the API and handle any network failures.
try {
- /** @var ListKeyHandlesResponse $response */
+ /** @var PagedListResponse $response */
$response = $autokeyClient->listKeyHandles($request);
- printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+
+ /** @var KeyHandle $element */
+ foreach ($response as $element) {
+ printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
+ }
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
diff --git a/Kms/src/V1/AutokeyConfig.php b/Kms/src/V1/AutokeyConfig.php
index 30a7546a1a80..4473493d8774 100644
--- a/Kms/src/V1/AutokeyConfig.php
+++ b/Kms/src/V1/AutokeyConfig.php
@@ -38,6 +38,12 @@ class AutokeyConfig extends \Google\Protobuf\Internal\Message
* Generated from protobuf field string key_project = 2 [(.google.api.field_behavior) = OPTIONAL];
*/
protected $key_project = '';
+ /**
+ * Output only. The state for the AutokeyConfig.
+ *
+ * Generated from protobuf field .google.cloud.kms.v1.AutokeyConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ protected $state = 0;
/**
* Constructor.
@@ -60,6 +66,8 @@ class AutokeyConfig extends \Google\Protobuf\Internal\Message
* Cloud KMS Service Agent for this key project must be granted the
* `cloudkms.admin` role (or pertinent permissions). A request with an empty
* key project field will clear the configuration.
+ * @type int $state
+ * Output only. The state for the AutokeyConfig.
* }
*/
public function __construct($data = NULL) {
@@ -141,5 +149,31 @@ public function setKeyProject($var)
return $this;
}
+ /**
+ * Output only. The state for the AutokeyConfig.
+ *
+ * Generated from protobuf field .google.cloud.kms.v1.AutokeyConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return int
+ */
+ public function getState()
+ {
+ return $this->state;
+ }
+
+ /**
+ * Output only. The state for the AutokeyConfig.
+ *
+ * Generated from protobuf field .google.cloud.kms.v1.AutokeyConfig.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param int $var
+ * @return $this
+ */
+ public function setState($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Kms\V1\AutokeyConfig\State::class);
+ $this->state = $var;
+
+ return $this;
+ }
+
}
diff --git a/Kms/src/V1/AutokeyConfig/State.php b/Kms/src/V1/AutokeyConfig/State.php
new file mode 100644
index 000000000000..505b2b2aa890
--- /dev/null
+++ b/Kms/src/V1/AutokeyConfig/State.php
@@ -0,0 +1,71 @@
+google.cloud.kms.v1.AutokeyConfig.State
+ */
+class State
+{
+ /**
+ * The state of the AutokeyConfig is unspecified.
+ *
+ * Generated from protobuf enum STATE_UNSPECIFIED = 0;
+ */
+ const STATE_UNSPECIFIED = 0;
+ /**
+ * The AutokeyConfig is currently active.
+ *
+ * Generated from protobuf enum ACTIVE = 1;
+ */
+ const ACTIVE = 1;
+ /**
+ * A previously configured key project has been deleted and the current
+ * AutokeyConfig is unusable.
+ *
+ * Generated from protobuf enum KEY_PROJECT_DELETED = 2;
+ */
+ const KEY_PROJECT_DELETED = 2;
+ /**
+ * The AutokeyConfig is not yet initialized or has been reset to its default
+ * uninitialized state.
+ *
+ * Generated from protobuf enum UNINITIALIZED = 3;
+ */
+ const UNINITIALIZED = 3;
+
+ private static $valueToName = [
+ self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
+ self::ACTIVE => 'ACTIVE',
+ self::KEY_PROJECT_DELETED => 'KEY_PROJECT_DELETED',
+ self::UNINITIALIZED => 'UNINITIALIZED',
+ ];
+
+ public static function name($value)
+ {
+ if (!isset(self::$valueToName[$value])) {
+ throw new UnexpectedValueException(sprintf(
+ 'Enum %s has no name defined for value %s', __CLASS__, $value));
+ }
+ return self::$valueToName[$value];
+ }
+
+
+ public static function value($name)
+ {
+ $const = __CLASS__ . '::' . strtoupper($name);
+ if (!defined($const)) {
+ throw new UnexpectedValueException(sprintf(
+ 'Enum %s has no value defined for name %s', __CLASS__, $name));
+ }
+ return constant($const);
+ }
+}
+
+
diff --git a/Kms/src/V1/Client/AutokeyAdminClient.php b/Kms/src/V1/Client/AutokeyAdminClient.php
index 0a30853f05f3..76274d56a805 100644
--- a/Kms/src/V1/Client/AutokeyAdminClient.php
+++ b/Kms/src/V1/Client/AutokeyAdminClient.php
@@ -49,7 +49,8 @@
use GuzzleHttp\Promise\PromiseInterface;
/**
- * Service Description: Provides interfaces for managing Cloud KMS Autokey folder-level
+ * Service Description: Provides interfaces for managing [Cloud KMS
+ * Autokey](https://cloud.google.com/kms/help/autokey) folder-level
* configurations. A configuration is inherited by all descendent projects. A
* configuration at one folder overrides any other configurations in its
* ancestry. Setting a configuration on a folder is a prerequisite for Cloud KMS
diff --git a/Kms/src/V1/Client/AutokeyClient.php b/Kms/src/V1/Client/AutokeyClient.php
index 53752c9361c6..11480a761d57 100644
--- a/Kms/src/V1/Client/AutokeyClient.php
+++ b/Kms/src/V1/Client/AutokeyClient.php
@@ -43,7 +43,6 @@
use Google\Cloud\Kms\V1\GetKeyHandleRequest;
use Google\Cloud\Kms\V1\KeyHandle;
use Google\Cloud\Kms\V1\ListKeyHandlesRequest;
-use Google\Cloud\Kms\V1\ListKeyHandlesResponse;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
@@ -52,7 +51,8 @@
use GuzzleHttp\Promise\PromiseInterface;
/**
- * Service Description: Provides interfaces for using Cloud KMS Autokey to provision new
+ * Service Description: Provides interfaces for using [Cloud KMS
+ * Autokey](https://cloud.google.com/kms/help/autokey) to provision new
* [CryptoKeys][google.cloud.kms.v1.CryptoKey], ready for Customer Managed
* Encryption Key (CMEK) use, on-demand. To support certain client tooling, this
* feature is modeled around a [KeyHandle][google.cloud.kms.v1.KeyHandle]
@@ -418,13 +418,13 @@ public function getKeyHandle(GetKeyHandleRequest $request, array $callOptions =
* {@see RetrySettings} for example usage.
* }
*
- * @return ListKeyHandlesResponse
+ * @return PagedListResponse
*
* @throws ApiException Thrown if the API call fails.
*/
- public function listKeyHandles(ListKeyHandlesRequest $request, array $callOptions = []): ListKeyHandlesResponse
+ public function listKeyHandles(ListKeyHandlesRequest $request, array $callOptions = []): PagedListResponse
{
- return $this->startApiCall('ListKeyHandles', $request, $callOptions)->wait();
+ return $this->startApiCall('ListKeyHandles', $request, $callOptions);
}
/**
diff --git a/Kms/src/V1/CryptoKey.php b/Kms/src/V1/CryptoKey.php
index b72a94be5592..e82ffe8ab6ec 100644
--- a/Kms/src/V1/CryptoKey.php
+++ b/Kms/src/V1/CryptoKey.php
@@ -104,7 +104,7 @@ class CryptoKey extends \Google\Protobuf\Internal\Message
* [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
* state before transitioning to
* [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
- * If not specified at creation time, the default duration is 24 hours.
+ * If not specified at creation time, the default duration is 30 days.
*
* Generated from protobuf field .google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];
*/
@@ -209,7 +209,7 @@ class CryptoKey extends \Google\Protobuf\Internal\Message
* [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
* state before transitioning to
* [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
- * If not specified at creation time, the default duration is 24 hours.
+ * If not specified at creation time, the default duration is 30 days.
* @type string $crypto_key_backend
* Immutable. The resource name of the backend environment where the key
* material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
@@ -603,7 +603,7 @@ public function setImportOnly($var)
* [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
* state before transitioning to
* [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
- * If not specified at creation time, the default duration is 24 hours.
+ * If not specified at creation time, the default duration is 30 days.
*
* Generated from protobuf field .google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];
* @return \Google\Protobuf\Duration|null
@@ -628,7 +628,7 @@ public function clearDestroyScheduledDuration()
* [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
* state before transitioning to
* [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
- * If not specified at creation time, the default duration is 24 hours.
+ * If not specified at creation time, the default duration is 30 days.
*
* Generated from protobuf field .google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];
* @param \Google\Protobuf\Duration $var
diff --git a/Kms/src/V1/EkmConnection.php b/Kms/src/V1/EkmConnection.php
index d8bbf9c4606f..918f3dee31e3 100644
--- a/Kms/src/V1/EkmConnection.php
+++ b/Kms/src/V1/EkmConnection.php
@@ -38,14 +38,14 @@ class EkmConnection extends \Google\Protobuf\Internal\Message
*/
protected $create_time = null;
/**
- * A list of
+ * Optional. A list of
* [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
* the EKM can be reached. There should be one ServiceResolver per EKM
* replica. Currently, only a single
* [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
* supported.
*
- * Generated from protobuf field repeated .google.cloud.kms.v1.EkmConnection.ServiceResolver service_resolvers = 3;
+ * Generated from protobuf field repeated .google.cloud.kms.v1.EkmConnection.ServiceResolver service_resolvers = 3 [(.google.api.field_behavior) = OPTIONAL];
*/
private $service_resolvers;
/**
@@ -88,7 +88,7 @@ class EkmConnection extends \Google\Protobuf\Internal\Message
* Output only. The time at which the
* [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
* @type array<\Google\Cloud\Kms\V1\EkmConnection\ServiceResolver>|\Google\Protobuf\Internal\RepeatedField $service_resolvers
- * A list of
+ * Optional. A list of
* [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
* the EKM can be reached. There should be one ServiceResolver per EKM
* replica. Currently, only a single
@@ -183,14 +183,14 @@ public function setCreateTime($var)
}
/**
- * A list of
+ * Optional. A list of
* [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
* the EKM can be reached. There should be one ServiceResolver per EKM
* replica. Currently, only a single
* [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
* supported.
*
- * Generated from protobuf field repeated .google.cloud.kms.v1.EkmConnection.ServiceResolver service_resolvers = 3;
+ * Generated from protobuf field repeated .google.cloud.kms.v1.EkmConnection.ServiceResolver service_resolvers = 3 [(.google.api.field_behavior) = OPTIONAL];
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getServiceResolvers()
@@ -199,14 +199,14 @@ public function getServiceResolvers()
}
/**
- * A list of
+ * Optional. A list of
* [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
* the EKM can be reached. There should be one ServiceResolver per EKM
* replica. Currently, only a single
* [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
* supported.
*
- * Generated from protobuf field repeated .google.cloud.kms.v1.EkmConnection.ServiceResolver service_resolvers = 3;
+ * Generated from protobuf field repeated .google.cloud.kms.v1.EkmConnection.ServiceResolver service_resolvers = 3 [(.google.api.field_behavior) = OPTIONAL];
* @param array<\Google\Cloud\Kms\V1\EkmConnection\ServiceResolver>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
diff --git a/Kms/src/V1/ListKeyHandlesRequest.php b/Kms/src/V1/ListKeyHandlesRequest.php
index 57a18d0dffbc..89269423a3f0 100644
--- a/Kms/src/V1/ListKeyHandlesRequest.php
+++ b/Kms/src/V1/ListKeyHandlesRequest.php
@@ -24,6 +24,26 @@ class ListKeyHandlesRequest extends \Google\Protobuf\Internal\Message
* Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {
*/
protected $parent = '';
+ /**
+ * Optional. Optional limit on the number of
+ * [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
+ * service may return fewer than this value. Further
+ * [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
+ * including the
+ * [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
+ * in a subsequent request. If unspecified, at most
+ * 100 [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $page_size = 0;
+ /**
+ * Optional. Optional pagination token, returned earlier via
+ * [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $page_token = '';
/**
* Optional. Filter to apply when listing
* [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
@@ -59,6 +79,18 @@ public static function build(string $parent): self
* Required. Name of the resource project and location from which to list
* [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
* `projects/{PROJECT_ID}/locations/{LOCATION}`.
+ * @type int $page_size
+ * Optional. Optional limit on the number of
+ * [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
+ * service may return fewer than this value. Further
+ * [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
+ * including the
+ * [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
+ * in a subsequent request. If unspecified, at most
+ * 100 [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
+ * @type string $page_token
+ * Optional. Optional pagination token, returned earlier via
+ * [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
* @type string $filter
* Optional. Filter to apply when listing
* [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
@@ -100,6 +132,74 @@ public function setParent($var)
return $this;
}
+ /**
+ * Optional. Optional limit on the number of
+ * [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
+ * service may return fewer than this value. Further
+ * [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
+ * including the
+ * [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
+ * in a subsequent request. If unspecified, at most
+ * 100 [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @return int
+ */
+ public function getPageSize()
+ {
+ return $this->page_size;
+ }
+
+ /**
+ * Optional. Optional limit on the number of
+ * [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
+ * service may return fewer than this value. Further
+ * [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
+ * including the
+ * [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
+ * in a subsequent request. If unspecified, at most
+ * 100 [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @param int $var
+ * @return $this
+ */
+ public function setPageSize($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->page_size = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. Optional pagination token, returned earlier via
+ * [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getPageToken()
+ {
+ return $this->page_token;
+ }
+
+ /**
+ * Optional. Optional pagination token, returned earlier via
+ * [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->page_token = $var;
+
+ return $this;
+ }
+
/**
* Optional. Filter to apply when listing
* [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
diff --git a/Kms/src/V1/ListKeyHandlesResponse.php b/Kms/src/V1/ListKeyHandlesResponse.php
index 1739eef03634..eed5fc43ccb1 100644
--- a/Kms/src/V1/ListKeyHandlesResponse.php
+++ b/Kms/src/V1/ListKeyHandlesResponse.php
@@ -22,6 +22,14 @@ class ListKeyHandlesResponse extends \Google\Protobuf\Internal\Message
* Generated from protobuf field repeated .google.cloud.kms.v1.KeyHandle key_handles = 1;
*/
private $key_handles;
+ /**
+ * A token to retrieve next page of results. Pass this value in
+ * [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
+ * to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ */
+ protected $next_page_token = '';
/**
* Constructor.
@@ -31,6 +39,10 @@ class ListKeyHandlesResponse extends \Google\Protobuf\Internal\Message
*
* @type array<\Google\Cloud\Kms\V1\KeyHandle>|\Google\Protobuf\Internal\RepeatedField $key_handles
* Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
+ * @type string $next_page_token
+ * A token to retrieve next page of results. Pass this value in
+ * [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
+ * to retrieve the next page of results.
* }
*/
public function __construct($data = NULL) {
@@ -64,5 +76,35 @@ public function setKeyHandles($var)
return $this;
}
+ /**
+ * A token to retrieve next page of results. Pass this value in
+ * [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
+ * to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ * @return string
+ */
+ public function getNextPageToken()
+ {
+ return $this->next_page_token;
+ }
+
+ /**
+ * A token to retrieve next page of results. Pass this value in
+ * [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
+ * to retrieve the next page of results.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ * @param string $var
+ * @return $this
+ */
+ public function setNextPageToken($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->next_page_token = $var;
+
+ return $this;
+ }
+
}
diff --git a/Kms/src/V1/resources/autokey_descriptor_config.php b/Kms/src/V1/resources/autokey_descriptor_config.php
index 26007ed2e72d..fc3e7e0fa238 100644
--- a/Kms/src/V1/resources/autokey_descriptor_config.php
+++ b/Kms/src/V1/resources/autokey_descriptor_config.php
@@ -55,7 +55,15 @@
],
],
'ListKeyHandles' => [
- 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'pageStreaming' => [
+ 'requestPageTokenGetMethod' => 'getPageToken',
+ 'requestPageTokenSetMethod' => 'setPageToken',
+ 'requestPageSizeGetMethod' => 'getPageSize',
+ 'requestPageSizeSetMethod' => 'setPageSize',
+ 'responsePageTokenGetMethod' => 'getNextPageToken',
+ 'resourcesGetMethod' => 'getKeyHandles',
+ ],
+ 'callType' => \Google\ApiCore\Call::PAGINATED_CALL,
'responseType' => 'Google\Cloud\Kms\V1\ListKeyHandlesResponse',
'headerParams' => [
[
diff --git a/Kms/tests/Unit/V1/Client/AutokeyClientTest.php b/Kms/tests/Unit/V1/Client/AutokeyClientTest.php
index d3a5fd79f17d..6e1582664073 100644
--- a/Kms/tests/Unit/V1/Client/AutokeyClientTest.php
+++ b/Kms/tests/Unit/V1/Client/AutokeyClientTest.php
@@ -292,13 +292,21 @@ public function listKeyHandlesTest()
]);
$this->assertTrue($transport->isExhausted());
// Mock response
+ $nextPageToken = '';
+ $keyHandlesElement = new KeyHandle();
+ $keyHandles = [$keyHandlesElement];
$expectedResponse = new ListKeyHandlesResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setKeyHandles($keyHandles);
$transport->addResponse($expectedResponse);
// Mock request
$formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]');
$request = (new ListKeyHandlesRequest())->setParent($formattedParent);
$response = $gapicClient->listKeyHandles($request);
- $this->assertEquals($expectedResponse, $response);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getKeyHandles()[0], $resources[0]);
$actualRequests = $transport->popReceivedCalls();
$this->assertSame(1, count($actualRequests));
$actualFuncCall = $actualRequests[0]->getFuncCall();