diff --git a/CommerceConsumerProcurement/metadata/V1/LicenseManagementService.php b/CommerceConsumerProcurement/metadata/V1/LicenseManagementService.php
new file mode 100644
index 000000000000..35aced28e7f0
Binary files /dev/null and b/CommerceConsumerProcurement/metadata/V1/LicenseManagementService.php differ
diff --git a/CommerceConsumerProcurement/metadata/V1/ProcurementService.php b/CommerceConsumerProcurement/metadata/V1/ProcurementService.php
index 7be6cab52a7b..f71ca250fd21 100644
Binary files a/CommerceConsumerProcurement/metadata/V1/ProcurementService.php and b/CommerceConsumerProcurement/metadata/V1/ProcurementService.php differ
diff --git a/CommerceConsumerProcurement/samples/V1/ConsumerProcurementServiceClient/cancel_order.php b/CommerceConsumerProcurement/samples/V1/ConsumerProcurementServiceClient/cancel_order.php
new file mode 100644
index 000000000000..34945b1ab793
--- /dev/null
+++ b/CommerceConsumerProcurement/samples/V1/ConsumerProcurementServiceClient/cancel_order.php
@@ -0,0 +1,84 @@
+setName($name);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var OperationResponse $response */
+ $response = $consumerProcurementServiceClient->cancelOrder($request);
+ $response->pollUntilComplete();
+
+ if ($response->operationSucceeded()) {
+ /** @var Order $result */
+ $result = $response->getResult();
+ printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
+ } else {
+ /** @var Status $error */
+ $error = $response->getError();
+ printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
+ }
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $name = '[NAME]';
+
+ cancel_order_sample($name);
+}
+// [END cloudcommerceconsumerprocurement_v1_generated_ConsumerProcurementService_CancelOrder_sync]
diff --git a/CommerceConsumerProcurement/samples/V1/ConsumerProcurementServiceClient/modify_order.php b/CommerceConsumerProcurement/samples/V1/ConsumerProcurementServiceClient/modify_order.php
new file mode 100644
index 000000000000..2ea79ce79c8f
--- /dev/null
+++ b/CommerceConsumerProcurement/samples/V1/ConsumerProcurementServiceClient/modify_order.php
@@ -0,0 +1,83 @@
+setName($name);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var OperationResponse $response */
+ $response = $consumerProcurementServiceClient->modifyOrder($request);
+ $response->pollUntilComplete();
+
+ if ($response->operationSucceeded()) {
+ /** @var Order $result */
+ $result = $response->getResult();
+ printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
+ } else {
+ /** @var Status $error */
+ $error = $response->getError();
+ printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
+ }
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $name = '[NAME]';
+
+ modify_order_sample($name);
+}
+// [END cloudcommerceconsumerprocurement_v1_generated_ConsumerProcurementService_ModifyOrder_sync]
diff --git a/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/assign.php b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/assign.php
new file mode 100644
index 000000000000..c33ec70102dc
--- /dev/null
+++ b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/assign.php
@@ -0,0 +1,75 @@
+setParent($parent)
+ ->setUsernames($usernames);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var AssignResponse $response */
+ $response = $licenseManagementServiceClient->assign($request);
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $parent = '[PARENT]';
+ $usernamesElement = '[USERNAMES]';
+
+ assign_sample($parent, $usernamesElement);
+}
+// [END cloudcommerceconsumerprocurement_v1_generated_LicenseManagementService_Assign_sync]
diff --git a/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/enumerate_licensed_users.php b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/enumerate_licensed_users.php
new file mode 100644
index 000000000000..c5a983d791d4
--- /dev/null
+++ b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/enumerate_licensed_users.php
@@ -0,0 +1,75 @@
+setParent($parent);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var PagedListResponse $response */
+ $response = $licenseManagementServiceClient->enumerateLicensedUsers($request);
+
+ /** @var LicensedUser $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());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $parent = '[PARENT]';
+
+ enumerate_licensed_users_sample($parent);
+}
+// [END cloudcommerceconsumerprocurement_v1_generated_LicenseManagementService_EnumerateLicensedUsers_sync]
diff --git a/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/get_license_pool.php b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/get_license_pool.php
new file mode 100644
index 000000000000..623e2151ab21
--- /dev/null
+++ b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/get_license_pool.php
@@ -0,0 +1,71 @@
+setName($name);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var LicensePool $response */
+ $response = $licenseManagementServiceClient->getLicensePool($request);
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $name = '[NAME]';
+
+ get_license_pool_sample($name);
+}
+// [END cloudcommerceconsumerprocurement_v1_generated_LicenseManagementService_GetLicensePool_sync]
diff --git a/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/unassign.php b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/unassign.php
new file mode 100644
index 000000000000..2843103ad5d2
--- /dev/null
+++ b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/unassign.php
@@ -0,0 +1,75 @@
+setParent($parent)
+ ->setUsernames($usernames);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var UnassignResponse $response */
+ $response = $licenseManagementServiceClient->unassign($request);
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+
+/**
+ * Helper to execute the sample.
+ *
+ * This sample has been automatically generated and should be regarded as a code
+ * template only. It will require modifications to work:
+ * - It may require correct/in-range values for request initialization.
+ * - It may require specifying regional endpoints when creating the service client,
+ * please see the apiEndpoint client configuration option for more details.
+ */
+function callSample(): void
+{
+ $parent = '[PARENT]';
+ $usernamesElement = '[USERNAMES]';
+
+ unassign_sample($parent, $usernamesElement);
+}
+// [END cloudcommerceconsumerprocurement_v1_generated_LicenseManagementService_Unassign_sync]
diff --git a/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/update_license_pool.php b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/update_license_pool.php
new file mode 100644
index 000000000000..29d7325e6ec6
--- /dev/null
+++ b/CommerceConsumerProcurement/samples/V1/LicenseManagementServiceClient/update_license_pool.php
@@ -0,0 +1,65 @@
+setLicenseAssignmentProtocol($licensePoolLicenseAssignmentProtocol);
+ $updateMask = new FieldMask();
+ $request = (new UpdateLicensePoolRequest())
+ ->setLicensePool($licensePool)
+ ->setUpdateMask($updateMask);
+
+ // Call the API and handle any network failures.
+ try {
+ /** @var LicensePool $response */
+ $response = $licenseManagementServiceClient->updateLicensePool($request);
+ printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
+ } catch (ApiException $ex) {
+ printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
+ }
+}
+// [END cloudcommerceconsumerprocurement_v1_generated_LicenseManagementService_UpdateLicensePool_sync]
diff --git a/CommerceConsumerProcurement/src/V1/AssignRequest.php b/CommerceConsumerProcurement/src/V1/AssignRequest.php
new file mode 100644
index 000000000000..7cad3988cfd4
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/AssignRequest.php
@@ -0,0 +1,122 @@
+google.cloud.commerce.consumer.procurement.v1.AssignRequest
+ */
+class AssignRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $parent = '';
+ /**
+ * Required. Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field repeated string usernames = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $usernames;
+
+ /**
+ * @param string $parent Required. License pool name.
+ * @param string[] $usernames Required. Username.
+ * Format: `name@domain.com`.
+ *
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent, array $usernames): self
+ {
+ return (new self())
+ ->setParent($parent)
+ ->setUsernames($usernames);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. License pool name.
+ * @type array|\Google\Protobuf\Internal\RepeatedField $usernames
+ * Required. Username.
+ * Format: `name@domain.com`.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field repeated string usernames = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getUsernames()
+ {
+ return $this->usernames;
+ }
+
+ /**
+ * Required. Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field repeated string usernames = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param array|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setUsernames($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->usernames = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/AssignResponse.php b/CommerceConsumerProcurement/src/V1/AssignResponse.php
new file mode 100644
index 000000000000..8dc2ea6b662b
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/AssignResponse.php
@@ -0,0 +1,34 @@
+google.cloud.commerce.consumer.procurement.v1.AssignResponse
+ */
+class AssignResponse extends \Google\Protobuf\Internal\Message
+{
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/AssignmentProtocol.php b/CommerceConsumerProcurement/src/V1/AssignmentProtocol.php
new file mode 100644
index 000000000000..1d068020ee10
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/AssignmentProtocol.php
@@ -0,0 +1,108 @@
+google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol
+ */
+class AssignmentProtocol extends \Google\Protobuf\Internal\Message
+{
+ protected $assignment_type;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol\ManualAssignmentType $manual_assignment_type
+ * Allow manual assignments triggered by administrative operations only.
+ * @type \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol\AutoAssignmentType $auto_assignment_type
+ * Allow automatic assignments triggered by data plane operations.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Allow manual assignments triggered by administrative operations only.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol.ManualAssignmentType manual_assignment_type = 2;
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol\ManualAssignmentType|null
+ */
+ public function getManualAssignmentType()
+ {
+ return $this->readOneof(2);
+ }
+
+ public function hasManualAssignmentType()
+ {
+ return $this->hasOneof(2);
+ }
+
+ /**
+ * Allow manual assignments triggered by administrative operations only.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol.ManualAssignmentType manual_assignment_type = 2;
+ * @param \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol\ManualAssignmentType $var
+ * @return $this
+ */
+ public function setManualAssignmentType($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol\ManualAssignmentType::class);
+ $this->writeOneof(2, $var);
+
+ return $this;
+ }
+
+ /**
+ * Allow automatic assignments triggered by data plane operations.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol.AutoAssignmentType auto_assignment_type = 3;
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol\AutoAssignmentType|null
+ */
+ public function getAutoAssignmentType()
+ {
+ return $this->readOneof(3);
+ }
+
+ public function hasAutoAssignmentType()
+ {
+ return $this->hasOneof(3);
+ }
+
+ /**
+ * Allow automatic assignments triggered by data plane operations.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol.AutoAssignmentType auto_assignment_type = 3;
+ * @param \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol\AutoAssignmentType $var
+ * @return $this
+ */
+ public function setAutoAssignmentType($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol\AutoAssignmentType::class);
+ $this->writeOneof(3, $var);
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getAssignmentType()
+ {
+ return $this->whichOneof("assignment_type");
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/AssignmentProtocol/AutoAssignmentType.php b/CommerceConsumerProcurement/src/V1/AssignmentProtocol/AutoAssignmentType.php
new file mode 100644
index 000000000000..14e80415f81d
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/AssignmentProtocol/AutoAssignmentType.php
@@ -0,0 +1,86 @@
+google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol.AutoAssignmentType
+ */
+class AutoAssignmentType extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Optional. The time to live for an inactive license. After this time has
+ * passed, the license will be automatically unassigned from the user. Must
+ * be at least 7 days, if set. If unset, the license will never expire.
+ *
+ * Generated from protobuf field .google.protobuf.Duration inactive_license_ttl = 1 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $inactive_license_ttl = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Protobuf\Duration $inactive_license_ttl
+ * Optional. The time to live for an inactive license. After this time has
+ * passed, the license will be automatically unassigned from the user. Must
+ * be at least 7 days, if set. If unset, the license will never expire.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Optional. The time to live for an inactive license. After this time has
+ * passed, the license will be automatically unassigned from the user. Must
+ * be at least 7 days, if set. If unset, the license will never expire.
+ *
+ * Generated from protobuf field .google.protobuf.Duration inactive_license_ttl = 1 [(.google.api.field_behavior) = OPTIONAL];
+ * @return \Google\Protobuf\Duration|null
+ */
+ public function getInactiveLicenseTtl()
+ {
+ return $this->inactive_license_ttl;
+ }
+
+ public function hasInactiveLicenseTtl()
+ {
+ return isset($this->inactive_license_ttl);
+ }
+
+ public function clearInactiveLicenseTtl()
+ {
+ unset($this->inactive_license_ttl);
+ }
+
+ /**
+ * Optional. The time to live for an inactive license. After this time has
+ * passed, the license will be automatically unassigned from the user. Must
+ * be at least 7 days, if set. If unset, the license will never expire.
+ *
+ * Generated from protobuf field .google.protobuf.Duration inactive_license_ttl = 1 [(.google.api.field_behavior) = OPTIONAL];
+ * @param \Google\Protobuf\Duration $var
+ * @return $this
+ */
+ public function setInactiveLicenseTtl($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
+ $this->inactive_license_ttl = $var;
+
+ return $this;
+ }
+
+}
+
+
diff --git a/CommerceConsumerProcurement/src/V1/AssignmentProtocol/ManualAssignmentType.php b/CommerceConsumerProcurement/src/V1/AssignmentProtocol/ManualAssignmentType.php
new file mode 100644
index 000000000000..25d147e3b0ab
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/AssignmentProtocol/ManualAssignmentType.php
@@ -0,0 +1,34 @@
+google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol.ManualAssignmentType
+ */
+class ManualAssignmentType extends \Google\Protobuf\Internal\Message
+{
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+}
+
+
diff --git a/CommerceConsumerProcurement/src/V1/AutoRenewalBehavior.php b/CommerceConsumerProcurement/src/V1/AutoRenewalBehavior.php
new file mode 100644
index 000000000000..ac3e70593302
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/AutoRenewalBehavior.php
@@ -0,0 +1,61 @@
+google.cloud.commerce.consumer.procurement.v1.AutoRenewalBehavior
+ */
+class AutoRenewalBehavior
+{
+ /**
+ * If unspecified, the auto renewal behavior will follow the default config.
+ *
+ * Generated from protobuf enum AUTO_RENEWAL_BEHAVIOR_UNSPECIFIED = 0;
+ */
+ const AUTO_RENEWAL_BEHAVIOR_UNSPECIFIED = 0;
+ /**
+ * Auto Renewal will be enabled on subscription.
+ *
+ * Generated from protobuf enum AUTO_RENEWAL_BEHAVIOR_ENABLE = 1;
+ */
+ const AUTO_RENEWAL_BEHAVIOR_ENABLE = 1;
+ /**
+ * Auto Renewal will be disabled on subscription.
+ *
+ * Generated from protobuf enum AUTO_RENEWAL_BEHAVIOR_DISABLE = 2;
+ */
+ const AUTO_RENEWAL_BEHAVIOR_DISABLE = 2;
+
+ private static $valueToName = [
+ self::AUTO_RENEWAL_BEHAVIOR_UNSPECIFIED => 'AUTO_RENEWAL_BEHAVIOR_UNSPECIFIED',
+ self::AUTO_RENEWAL_BEHAVIOR_ENABLE => 'AUTO_RENEWAL_BEHAVIOR_ENABLE',
+ self::AUTO_RENEWAL_BEHAVIOR_DISABLE => 'AUTO_RENEWAL_BEHAVIOR_DISABLE',
+ ];
+
+ 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/CommerceConsumerProcurement/src/V1/CancelOrderMetadata.php b/CommerceConsumerProcurement/src/V1/CancelOrderMetadata.php
new file mode 100644
index 000000000000..58e2200fed76
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/CancelOrderMetadata.php
@@ -0,0 +1,34 @@
+google.cloud.commerce.consumer.procurement.v1.CancelOrderMetadata
+ */
+class CancelOrderMetadata extends \Google\Protobuf\Internal\Message
+{
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\ProcurementService::initOnce();
+ parent::__construct($data);
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/CancelOrderRequest.php b/CommerceConsumerProcurement/src/V1/CancelOrderRequest.php
new file mode 100644
index 000000000000..bf6be9598319
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/CancelOrderRequest.php
@@ -0,0 +1,144 @@
+google.cloud.commerce.consumer.procurement.v1.CancelOrderRequest
+ */
+class CancelOrderRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The resource name of the order.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $name = '';
+ /**
+ * Optional. The weak etag, which can be optionally populated, of the order
+ * that this cancel request is based on. Validation checking will only happen
+ * if the invoker supplies this field.
+ *
+ * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $etag = '';
+ /**
+ * Optional. Cancellation policy of this request.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.CancelOrderRequest.CancellationPolicy cancellation_policy = 3 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $cancellation_policy = 0;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. The resource name of the order.
+ * @type string $etag
+ * Optional. The weak etag, which can be optionally populated, of the order
+ * that this cancel request is based on. Validation checking will only happen
+ * if the invoker supplies this field.
+ * @type int $cancellation_policy
+ * Optional. Cancellation policy of this request.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\ProcurementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The resource name of the order.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. The resource name of the order.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. The weak etag, which can be optionally populated, of the order
+ * that this cancel request is based on. Validation checking will only happen
+ * if the invoker supplies this field.
+ *
+ * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ /**
+ * Optional. The weak etag, which can be optionally populated, of the order
+ * that this cancel request is based on. Validation checking will only happen
+ * if the invoker supplies this field.
+ *
+ * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setEtag($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->etag = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. Cancellation policy of this request.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.CancelOrderRequest.CancellationPolicy cancellation_policy = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @return int
+ */
+ public function getCancellationPolicy()
+ {
+ return $this->cancellation_policy;
+ }
+
+ /**
+ * Optional. Cancellation policy of this request.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.CancelOrderRequest.CancellationPolicy cancellation_policy = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @param int $var
+ * @return $this
+ */
+ public function setCancellationPolicy($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Commerce\Consumer\Procurement\V1\CancelOrderRequest\CancellationPolicy::class);
+ $this->cancellation_policy = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/CancelOrderRequest/CancellationPolicy.php b/CommerceConsumerProcurement/src/V1/CancelOrderRequest/CancellationPolicy.php
new file mode 100644
index 000000000000..3044ad0c4f8f
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/CancelOrderRequest/CancellationPolicy.php
@@ -0,0 +1,68 @@
+google.cloud.commerce.consumer.procurement.v1.CancelOrderRequest.CancellationPolicy
+ */
+class CancellationPolicy
+{
+ /**
+ * If unspecified, cancellation will try to cancel the order, if order
+ * cannot be immediately cancelled, auto renewal will be turned off.
+ * However, caller should avoid using the value as it will yield a
+ * non-deterministic result. This is still supported mainly to maintain
+ * existing integrated usages and ensure backwards compatibility.
+ *
+ * Generated from protobuf enum CANCELLATION_POLICY_UNSPECIFIED = 0;
+ */
+ const CANCELLATION_POLICY_UNSPECIFIED = 0;
+ /**
+ * Request will cancel the whole order immediately, if order cannot be
+ * immediately cancelled, the request will fail.
+ *
+ * Generated from protobuf enum CANCELLATION_POLICY_CANCEL_IMMEDIATELY = 1;
+ */
+ const CANCELLATION_POLICY_CANCEL_IMMEDIATELY = 1;
+ /**
+ * Request will cancel the auto renewal, if order is not subscription based,
+ * the request will fail.
+ *
+ * Generated from protobuf enum CANCELLATION_POLICY_CANCEL_AT_TERM_END = 2;
+ */
+ const CANCELLATION_POLICY_CANCEL_AT_TERM_END = 2;
+
+ private static $valueToName = [
+ self::CANCELLATION_POLICY_UNSPECIFIED => 'CANCELLATION_POLICY_UNSPECIFIED',
+ self::CANCELLATION_POLICY_CANCEL_IMMEDIATELY => 'CANCELLATION_POLICY_CANCEL_IMMEDIATELY',
+ self::CANCELLATION_POLICY_CANCEL_AT_TERM_END => 'CANCELLATION_POLICY_CANCEL_AT_TERM_END',
+ ];
+
+ 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/CommerceConsumerProcurement/src/V1/Client/ConsumerProcurementServiceClient.php b/CommerceConsumerProcurement/src/V1/Client/ConsumerProcurementServiceClient.php
index 2130ace770de..201f8e45d39b 100644
--- a/CommerceConsumerProcurement/src/V1/Client/ConsumerProcurementServiceClient.php
+++ b/CommerceConsumerProcurement/src/V1/Client/ConsumerProcurementServiceClient.php
@@ -34,8 +34,10 @@
use Google\ApiCore\Transport\TransportInterface;
use Google\ApiCore\ValidationException;
use Google\Auth\FetchAuthTokenInterface;
+use Google\Cloud\Commerce\Consumer\Procurement\V1\CancelOrderRequest;
use Google\Cloud\Commerce\Consumer\Procurement\V1\GetOrderRequest;
use Google\Cloud\Commerce\Consumer\Procurement\V1\ListOrdersRequest;
+use Google\Cloud\Commerce\Consumer\Procurement\V1\ModifyOrderRequest;
use Google\Cloud\Commerce\Consumer\Procurement\V1\Order;
use Google\Cloud\Commerce\Consumer\Procurement\V1\PlaceOrderRequest;
use Google\LongRunning\Client\OperationsClient;
@@ -62,8 +64,10 @@
* name, and additionally a parseName method to extract the individual identifiers
* contained within formatted names that are returned by the API.
*
+ * @method PromiseInterface cancelOrderAsync(CancelOrderRequest $request, array $optionalArgs = [])
* @method PromiseInterface getOrderAsync(GetOrderRequest $request, array $optionalArgs = [])
* @method PromiseInterface listOrdersAsync(ListOrdersRequest $request, array $optionalArgs = [])
+ * @method PromiseInterface modifyOrderAsync(ModifyOrderRequest $request, array $optionalArgs = [])
* @method PromiseInterface placeOrderAsync(PlaceOrderRequest $request, array $optionalArgs = [])
*/
final class ConsumerProcurementServiceClient
@@ -331,6 +335,35 @@ public function __call($method, $args)
return call_user_func_array([$this, 'startAsyncCall'], $args);
}
+ /**
+ * Cancels an existing
+ * [Order][google.cloud.commerce.consumer.procurement.v1.Order]. Every product
+ * procured in the Order will be cancelled.
+ *
+ * The async variant is {@see ConsumerProcurementServiceClient::cancelOrderAsync()}
+ * .
+ *
+ * @example samples/V1/ConsumerProcurementServiceClient/cancel_order.php
+ *
+ * @param CancelOrderRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return OperationResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function cancelOrder(CancelOrderRequest $request, array $callOptions = []): OperationResponse
+ {
+ return $this->startApiCall('CancelOrder', $request, $callOptions)->wait();
+ }
+
/**
* Returns the requested
* [Order][google.cloud.commerce.consumer.procurement.v1.Order] resource.
@@ -387,6 +420,34 @@ public function listOrders(ListOrdersRequest $request, array $callOptions = []):
return $this->startApiCall('ListOrders', $request, $callOptions);
}
+ /**
+ * Modifies an existing
+ * [Order][google.cloud.commerce.consumer.procurement.v1.Order] resource.
+ *
+ * The async variant is {@see ConsumerProcurementServiceClient::modifyOrderAsync()}
+ * .
+ *
+ * @example samples/V1/ConsumerProcurementServiceClient/modify_order.php
+ *
+ * @param ModifyOrderRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return OperationResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function modifyOrder(ModifyOrderRequest $request, array $callOptions = []): OperationResponse
+ {
+ return $this->startApiCall('ModifyOrder', $request, $callOptions)->wait();
+ }
+
/**
* Creates a new [Order][google.cloud.commerce.consumer.procurement.v1.Order].
*
diff --git a/CommerceConsumerProcurement/src/V1/Client/LicenseManagementServiceClient.php b/CommerceConsumerProcurement/src/V1/Client/LicenseManagementServiceClient.php
new file mode 100644
index 000000000000..e0e8cf45cd8a
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/Client/LicenseManagementServiceClient.php
@@ -0,0 +1,357 @@
+ self::SERVICE_NAME,
+ 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT,
+ 'clientConfig' => __DIR__ . '/../resources/license_management_service_client_config.json',
+ 'descriptorsConfigPath' => __DIR__ . '/../resources/license_management_service_descriptor_config.php',
+ 'gcpApiConfigPath' => __DIR__ . '/../resources/license_management_service_grpc_config.json',
+ 'credentialsConfig' => [
+ 'defaultScopes' => self::$serviceScopes,
+ ],
+ 'transportConfig' => [
+ 'rest' => [
+ 'restClientConfigPath' =>
+ __DIR__ . '/../resources/license_management_service_rest_client_config.php',
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Formats a string containing the fully-qualified path to represent a license_pool
+ * resource.
+ *
+ * @param string $billingAccount
+ * @param string $order
+ *
+ * @return string The formatted license_pool resource.
+ */
+ public static function licensePoolName(string $billingAccount, string $order): string
+ {
+ return self::getPathTemplate('licensePool')->render([
+ 'billing_account' => $billingAccount,
+ 'order' => $order,
+ ]);
+ }
+
+ /**
+ * Parses a formatted name string and returns an associative array of the components in the name.
+ * The following name formats are supported:
+ * Template: Pattern
+ * - licensePool: billingAccounts/{billing_account}/orders/{order}/licensePool
+ *
+ * The optional $template argument can be supplied to specify a particular pattern,
+ * and must match one of the templates listed above. If no $template argument is
+ * provided, or if the $template argument does not match one of the templates
+ * listed, then parseName will check each of the supported templates, and return
+ * the first match.
+ *
+ * @param string $formattedName The formatted name string
+ * @param string $template Optional name of template to match
+ *
+ * @return array An associative array from name component IDs to component values.
+ *
+ * @throws ValidationException If $formattedName could not be matched.
+ */
+ public static function parseName(string $formattedName, string $template = null): array
+ {
+ return self::parseFormattedName($formattedName, $template);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $options {
+ * Optional. Options for configuring the service API wrapper.
+ *
+ * @type string $apiEndpoint
+ * The address of the API remote host. May optionally include the port, formatted
+ * as ":". Default
+ * 'cloudcommerceconsumerprocurement.googleapis.com:443'.
+ * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials
+ * The credentials to be used by the client to authorize API calls. This option
+ * accepts either a path to a credentials file, or a decoded credentials file as a
+ * PHP array.
+ * *Advanced usage*: In addition, this option can also accept a pre-constructed
+ * {@see \Google\Auth\FetchAuthTokenInterface} object or
+ * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these
+ * objects are provided, any settings in $credentialsConfig will be ignored.
+ * @type array $credentialsConfig
+ * Options used to configure credentials, including auth token caching, for the
+ * client. For a full list of supporting configuration options, see
+ * {@see \Google\ApiCore\CredentialsWrapper::build()} .
+ * @type bool $disableRetries
+ * Determines whether or not retries defined by the client configuration should be
+ * disabled. Defaults to `false`.
+ * @type string|array $clientConfig
+ * Client method configuration, including retry settings. This option can be either
+ * a path to a JSON file, or a PHP array containing the decoded JSON data. By
+ * default this settings points to the default client config file, which is
+ * provided in the resources folder.
+ * @type string|TransportInterface $transport
+ * The transport used for executing network requests. May be either the string
+ * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system.
+ * *Advanced usage*: Additionally, it is possible to pass in an already
+ * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note
+ * that when this object is provided, any settings in $transportConfig, and any
+ * $apiEndpoint setting, will be ignored.
+ * @type array $transportConfig
+ * Configuration options that will be used to construct the transport. Options for
+ * each supported transport type should be passed in a key for that transport. For
+ * example:
+ * $transportConfig = [
+ * 'grpc' => [...],
+ * 'rest' => [...],
+ * ];
+ * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and
+ * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the
+ * supported options.
+ * @type callable $clientCertSource
+ * A callable which returns the client cert as a string. This can be used to
+ * provide a certificate and private key to the transport layer for mTLS.
+ * }
+ *
+ * @throws ValidationException
+ */
+ public function __construct(array $options = [])
+ {
+ $clientOptions = $this->buildClientOptions($options);
+ $this->setClientOptions($clientOptions);
+ }
+
+ /** Handles execution of the async variants for each documented method. */
+ public function __call($method, $args)
+ {
+ if (substr($method, -5) !== 'Async') {
+ trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR);
+ }
+
+ array_unshift($args, substr($method, 0, -5));
+ return call_user_func_array([$this, 'startAsyncCall'], $args);
+ }
+
+ /**
+ * Assigns a license to a user.
+ *
+ * The async variant is {@see LicenseManagementServiceClient::assignAsync()} .
+ *
+ * @example samples/V1/LicenseManagementServiceClient/assign.php
+ *
+ * @param AssignRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return AssignResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function assign(AssignRequest $request, array $callOptions = []): AssignResponse
+ {
+ return $this->startApiCall('Assign', $request, $callOptions)->wait();
+ }
+
+ /**
+ * Enumerates all users assigned a license.
+ *
+ * The async variant is
+ * {@see LicenseManagementServiceClient::enumerateLicensedUsersAsync()} .
+ *
+ * @example samples/V1/LicenseManagementServiceClient/enumerate_licensed_users.php
+ *
+ * @param EnumerateLicensedUsersRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return PagedListResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function enumerateLicensedUsers(
+ EnumerateLicensedUsersRequest $request,
+ array $callOptions = []
+ ): PagedListResponse {
+ return $this->startApiCall('EnumerateLicensedUsers', $request, $callOptions);
+ }
+
+ /**
+ * Gets the license pool.
+ *
+ * The async variant is
+ * {@see LicenseManagementServiceClient::getLicensePoolAsync()} .
+ *
+ * @example samples/V1/LicenseManagementServiceClient/get_license_pool.php
+ *
+ * @param GetLicensePoolRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return LicensePool
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function getLicensePool(GetLicensePoolRequest $request, array $callOptions = []): LicensePool
+ {
+ return $this->startApiCall('GetLicensePool', $request, $callOptions)->wait();
+ }
+
+ /**
+ * Unassigns a license from a user.
+ *
+ * The async variant is {@see LicenseManagementServiceClient::unassignAsync()} .
+ *
+ * @example samples/V1/LicenseManagementServiceClient/unassign.php
+ *
+ * @param UnassignRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return UnassignResponse
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function unassign(UnassignRequest $request, array $callOptions = []): UnassignResponse
+ {
+ return $this->startApiCall('Unassign', $request, $callOptions)->wait();
+ }
+
+ /**
+ * Updates the license pool if one exists for this Order.
+ *
+ * The async variant is
+ * {@see LicenseManagementServiceClient::updateLicensePoolAsync()} .
+ *
+ * @example samples/V1/LicenseManagementServiceClient/update_license_pool.php
+ *
+ * @param UpdateLicensePoolRequest $request A request to house fields associated with the call.
+ * @param array $callOptions {
+ * Optional.
+ *
+ * @type RetrySettings|array $retrySettings
+ * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
+ * associative array of retry settings parameters. See the documentation on
+ * {@see RetrySettings} for example usage.
+ * }
+ *
+ * @return LicensePool
+ *
+ * @throws ApiException Thrown if the API call fails.
+ */
+ public function updateLicensePool(UpdateLicensePoolRequest $request, array $callOptions = []): LicensePool
+ {
+ return $this->startApiCall('UpdateLicensePool', $request, $callOptions)->wait();
+ }
+}
diff --git a/CommerceConsumerProcurement/src/V1/EnumerateLicensedUsersRequest.php b/CommerceConsumerProcurement/src/V1/EnumerateLicensedUsersRequest.php
new file mode 100644
index 000000000000..37bb56e1839a
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/EnumerateLicensedUsersRequest.php
@@ -0,0 +1,157 @@
+google.cloud.commerce.consumer.procurement.v1.EnumerateLicensedUsersRequest
+ */
+class EnumerateLicensedUsersRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $parent = '';
+ /**
+ * Optional. The maximum number of users to return. The service may return
+ * fewer than this value.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $page_size = 0;
+ /**
+ * Optional. A page token, received from a previous `EnumerateLicensedUsers`
+ * call. Provide this to retrieve the subsequent page.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $page_token = '';
+
+ /**
+ * @param string $parent Required. License pool name.
+ *
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\EnumerateLicensedUsersRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent): self
+ {
+ return (new self())
+ ->setParent($parent);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. License pool name.
+ * @type int $page_size
+ * Optional. The maximum number of users to return. The service may return
+ * fewer than this value.
+ * @type string $page_token
+ * Optional. A page token, received from a previous `EnumerateLicensedUsers`
+ * call. Provide this to retrieve the subsequent page.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. The maximum number of users to return. The service may return
+ * fewer than this value.
+ *
+ * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL];
+ * @return int
+ */
+ public function getPageSize()
+ {
+ return $this->page_size;
+ }
+
+ /**
+ * Optional. The maximum number of users to return. The service may return
+ * fewer than this value.
+ *
+ * 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. A page token, received from a previous `EnumerateLicensedUsers`
+ * call. Provide this to retrieve the subsequent page.
+ *
+ * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getPageToken()
+ {
+ return $this->page_token;
+ }
+
+ /**
+ * Optional. A page token, received from a previous `EnumerateLicensedUsers`
+ * call. Provide this to retrieve the subsequent page.
+ *
+ * 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;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/EnumerateLicensedUsersResponse.php b/CommerceConsumerProcurement/src/V1/EnumerateLicensedUsersResponse.php
new file mode 100644
index 000000000000..ad994465605b
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/EnumerateLicensedUsersResponse.php
@@ -0,0 +1,106 @@
+google.cloud.commerce.consumer.procurement.v1.EnumerateLicensedUsersResponse
+ */
+class EnumerateLicensedUsersResponse extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * The list of licensed users.
+ *
+ * Generated from protobuf field repeated .google.cloud.commerce.consumer.procurement.v1.LicensedUser licensed_users = 1;
+ */
+ private $licensed_users;
+ /**
+ * A token that can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ */
+ protected $next_page_token = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type array<\Google\Cloud\Commerce\Consumer\Procurement\V1\LicensedUser>|\Google\Protobuf\Internal\RepeatedField $licensed_users
+ * The list of licensed users.
+ * @type string $next_page_token
+ * A token that can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * The list of licensed users.
+ *
+ * Generated from protobuf field repeated .google.cloud.commerce.consumer.procurement.v1.LicensedUser licensed_users = 1;
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getLicensedUsers()
+ {
+ return $this->licensed_users;
+ }
+
+ /**
+ * The list of licensed users.
+ *
+ * Generated from protobuf field repeated .google.cloud.commerce.consumer.procurement.v1.LicensedUser licensed_users = 1;
+ * @param array<\Google\Cloud\Commerce\Consumer\Procurement\V1\LicensedUser>|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setLicensedUsers($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Commerce\Consumer\Procurement\V1\LicensedUser::class);
+ $this->licensed_users = $arr;
+
+ return $this;
+ }
+
+ /**
+ * A token that can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ *
+ * Generated from protobuf field string next_page_token = 2;
+ * @return string
+ */
+ public function getNextPageToken()
+ {
+ return $this->next_page_token;
+ }
+
+ /**
+ * A token that can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ *
+ * 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/CommerceConsumerProcurement/src/V1/GetLicensePoolRequest.php b/CommerceConsumerProcurement/src/V1/GetLicensePoolRequest.php
new file mode 100644
index 000000000000..23e2d4af8b0e
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/GetLicensePoolRequest.php
@@ -0,0 +1,85 @@
+google.cloud.commerce.consumer.procurement.v1.GetLicensePoolRequest
+ */
+class GetLicensePoolRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The name of the license pool to get.
+ * Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $name = '';
+
+ /**
+ * @param string $name Required. The name of the license pool to get.
+ * Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ *
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\GetLicensePoolRequest
+ *
+ * @experimental
+ */
+ public static function build(string $name): self
+ {
+ return (new self())
+ ->setName($name);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. The name of the license pool to get.
+ * Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The name of the license pool to get.
+ * Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. The name of the license pool to get.
+ * Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/LicensePool.php b/CommerceConsumerProcurement/src/V1/LicensePool.php
new file mode 100644
index 000000000000..cc37fd0582f8
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/LicensePool.php
@@ -0,0 +1,183 @@
+google.cloud.commerce.consumer.procurement.v1.LicensePool
+ */
+class LicensePool extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Identifier. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER];
+ */
+ protected $name = '';
+ /**
+ * Required. Assignment protocol for the license pool.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol license_assignment_protocol = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $license_assignment_protocol = null;
+ /**
+ * Output only. Licenses count that are available to be assigned.
+ *
+ * Generated from protobuf field int32 available_license_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ protected $available_license_count = 0;
+ /**
+ * Output only. Total number of licenses in the pool.
+ *
+ * Generated from protobuf field int32 total_license_count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ protected $total_license_count = 0;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Identifier. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ * @type \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol $license_assignment_protocol
+ * Required. Assignment protocol for the license pool.
+ * @type int $available_license_count
+ * Output only. Licenses count that are available to be assigned.
+ * @type int $total_license_count
+ * Output only. Total number of licenses in the pool.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Identifier. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER];
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Identifier. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER];
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. Assignment protocol for the license pool.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol license_assignment_protocol = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol|null
+ */
+ public function getLicenseAssignmentProtocol()
+ {
+ return $this->license_assignment_protocol;
+ }
+
+ public function hasLicenseAssignmentProtocol()
+ {
+ return isset($this->license_assignment_protocol);
+ }
+
+ public function clearLicenseAssignmentProtocol()
+ {
+ unset($this->license_assignment_protocol);
+ }
+
+ /**
+ * Required. Assignment protocol for the license pool.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AssignmentProtocol license_assignment_protocol = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol $var
+ * @return $this
+ */
+ public function setLicenseAssignmentProtocol($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Commerce\Consumer\Procurement\V1\AssignmentProtocol::class);
+ $this->license_assignment_protocol = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Licenses count that are available to be assigned.
+ *
+ * Generated from protobuf field int32 available_license_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return int
+ */
+ public function getAvailableLicenseCount()
+ {
+ return $this->available_license_count;
+ }
+
+ /**
+ * Output only. Licenses count that are available to be assigned.
+ *
+ * Generated from protobuf field int32 available_license_count = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param int $var
+ * @return $this
+ */
+ public function setAvailableLicenseCount($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->available_license_count = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Total number of licenses in the pool.
+ *
+ * Generated from protobuf field int32 total_license_count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return int
+ */
+ public function getTotalLicenseCount()
+ {
+ return $this->total_license_count;
+ }
+
+ /**
+ * Output only. Total number of licenses in the pool.
+ *
+ * Generated from protobuf field int32 total_license_count = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param int $var
+ * @return $this
+ */
+ public function setTotalLicenseCount($var)
+ {
+ GPBUtil::checkInt32($var);
+ $this->total_license_count = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/LicensedUser.php b/CommerceConsumerProcurement/src/V1/LicensedUser.php
new file mode 100644
index 000000000000..959c7b3cd26e
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/LicensedUser.php
@@ -0,0 +1,167 @@
+google.cloud.commerce.consumer.procurement.v1.LicensedUser
+ */
+class LicensedUser extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field string username = 1;
+ */
+ protected $username = '';
+ /**
+ * Output only. Timestamp when the license was assigned.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp assign_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ protected $assign_time = null;
+ /**
+ * Output only. Timestamp when the license was recently used. This may not be
+ * the most recent usage time, and will be updated regularly (within 24
+ * hours).
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp recent_usage_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ */
+ protected $recent_usage_time = null;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $username
+ * Username.
+ * Format: `name@domain.com`.
+ * @type \Google\Protobuf\Timestamp $assign_time
+ * Output only. Timestamp when the license was assigned.
+ * @type \Google\Protobuf\Timestamp $recent_usage_time
+ * Output only. Timestamp when the license was recently used. This may not be
+ * the most recent usage time, and will be updated regularly (within 24
+ * hours).
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field string username = 1;
+ * @return string
+ */
+ public function getUsername()
+ {
+ return $this->username;
+ }
+
+ /**
+ * Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field string username = 1;
+ * @param string $var
+ * @return $this
+ */
+ public function setUsername($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->username = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Timestamp when the license was assigned.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp assign_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Timestamp|null
+ */
+ public function getAssignTime()
+ {
+ return $this->assign_time;
+ }
+
+ public function hasAssignTime()
+ {
+ return isset($this->assign_time);
+ }
+
+ public function clearAssignTime()
+ {
+ unset($this->assign_time);
+ }
+
+ /**
+ * Output only. Timestamp when the license was assigned.
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp assign_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setAssignTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->assign_time = $var;
+
+ return $this;
+ }
+
+ /**
+ * Output only. Timestamp when the license was recently used. This may not be
+ * the most recent usage time, and will be updated regularly (within 24
+ * hours).
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp recent_usage_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @return \Google\Protobuf\Timestamp|null
+ */
+ public function getRecentUsageTime()
+ {
+ return $this->recent_usage_time;
+ }
+
+ public function hasRecentUsageTime()
+ {
+ return isset($this->recent_usage_time);
+ }
+
+ public function clearRecentUsageTime()
+ {
+ unset($this->recent_usage_time);
+ }
+
+ /**
+ * Output only. Timestamp when the license was recently used. This may not be
+ * the most recent usage time, and will be updated regularly (within 24
+ * hours).
+ *
+ * Generated from protobuf field .google.protobuf.Timestamp recent_usage_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];
+ * @param \Google\Protobuf\Timestamp $var
+ * @return $this
+ */
+ public function setRecentUsageTime($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
+ $this->recent_usage_time = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/LineItemChangeState.php b/CommerceConsumerProcurement/src/V1/LineItemChangeState.php
index 357ddcaba7c8..0f578e994c1a 100644
--- a/CommerceConsumerProcurement/src/V1/LineItemChangeState.php
+++ b/CommerceConsumerProcurement/src/V1/LineItemChangeState.php
@@ -20,43 +20,47 @@ class LineItemChangeState
*/
const LINE_ITEM_CHANGE_STATE_UNSPECIFIED = 0;
/**
- * Change is in this state when a change is initiated and waiting for
- * partner approval.
+ * Change is in this state when a change is initiated and waiting for partner
+ * approval. This state is only applicable for pending change.
*
* Generated from protobuf enum LINE_ITEM_CHANGE_STATE_PENDING_APPROVAL = 1;
*/
const LINE_ITEM_CHANGE_STATE_PENDING_APPROVAL = 1;
/**
* Change is in this state after it's approved by the partner or auto-approved
- * but before it takes effect. The change can be overwritten
- * or cancelled depending on the new line item info property (pending Private
- * Offer change cannot be cancelled and can only be overwritten by another
- * Private Offer).
+ * but before it takes effect. The change can be overwritten or cancelled
+ * depending on the new line item info property (pending Private Offer change
+ * cannot be cancelled and can only be overwritten by another Private Offer).
+ * This state is only applicable for pending change.
*
* Generated from protobuf enum LINE_ITEM_CHANGE_STATE_APPROVED = 2;
*/
const LINE_ITEM_CHANGE_STATE_APPROVED = 2;
/**
- * Change is in this state after it's been activated.
+ * Change is in this state after it's been activated. This state is only
+ * applicable for change in history.
*
* Generated from protobuf enum LINE_ITEM_CHANGE_STATE_COMPLETED = 3;
*/
const LINE_ITEM_CHANGE_STATE_COMPLETED = 3;
/**
- * Change is in this state if it was rejected by the partner.
+ * Change is in this state if it was rejected by the partner. This state is
+ * only applicable for change in history.
*
* Generated from protobuf enum LINE_ITEM_CHANGE_STATE_REJECTED = 4;
*/
const LINE_ITEM_CHANGE_STATE_REJECTED = 4;
/**
- * Change is in this state if it was abandoned by the user.
+ * Change is in this state if it was abandoned by the user. This state is only
+ * applicable for change in history.
*
* Generated from protobuf enum LINE_ITEM_CHANGE_STATE_ABANDONED = 5;
*/
const LINE_ITEM_CHANGE_STATE_ABANDONED = 5;
/**
* Change is in this state if it's currently being provisioned downstream. The
- * change can't be overwritten or cancelled when it's in this state.
+ * change can't be overwritten or cancelled when it's in this state. This
+ * state is only applicable for pending change.
*
* Generated from protobuf enum LINE_ITEM_CHANGE_STATE_ACTIVATING = 6;
*/
diff --git a/CommerceConsumerProcurement/src/V1/ModifyOrderMetadata.php b/CommerceConsumerProcurement/src/V1/ModifyOrderMetadata.php
new file mode 100644
index 000000000000..e457f78bd1eb
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/ModifyOrderMetadata.php
@@ -0,0 +1,34 @@
+google.cloud.commerce.consumer.procurement.v1.ModifyOrderMetadata
+ */
+class ModifyOrderMetadata extends \Google\Protobuf\Internal\Message
+{
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\ProcurementService::initOnce();
+ parent::__construct($data);
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/ModifyOrderRequest.php b/CommerceConsumerProcurement/src/V1/ModifyOrderRequest.php
new file mode 100644
index 000000000000..f9638efd58e9
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/ModifyOrderRequest.php
@@ -0,0 +1,190 @@
+google.cloud.commerce.consumer.procurement.v1.ModifyOrderRequest
+ */
+class ModifyOrderRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. Name of the order to update.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $name = '';
+ /**
+ * Optional. Modifications for an existing Order created by an Offer.
+ * Required when Offer based Order is being modified, except for when going
+ * from an offer to a public plan.
+ *
+ * Generated from protobuf field repeated .google.cloud.commerce.consumer.procurement.v1.ModifyOrderRequest.Modification modifications = 6 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ private $modifications;
+ /**
+ * Optional. Updated display name of the order, leave as empty if you do not
+ * want to update current display name.
+ *
+ * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $display_name = '';
+ /**
+ * Optional. The weak etag, which can be optionally populated, of the order
+ * that this modify request is based on. Validation checking will only happen
+ * if the invoker supplies this field.
+ *
+ * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $etag = '';
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Required. Name of the order to update.
+ * @type array<\Google\Cloud\Commerce\Consumer\Procurement\V1\ModifyOrderRequest\Modification>|\Google\Protobuf\Internal\RepeatedField $modifications
+ * Optional. Modifications for an existing Order created by an Offer.
+ * Required when Offer based Order is being modified, except for when going
+ * from an offer to a public plan.
+ * @type string $display_name
+ * Optional. Updated display name of the order, leave as empty if you do not
+ * want to update current display name.
+ * @type string $etag
+ * Optional. The weak etag, which can be optionally populated, of the order
+ * that this modify request is based on. Validation checking will only happen
+ * if the invoker supplies this field.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\ProcurementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. Name of the order to update.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Required. Name of the order to update.
+ *
+ * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->name = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. Modifications for an existing Order created by an Offer.
+ * Required when Offer based Order is being modified, except for when going
+ * from an offer to a public plan.
+ *
+ * Generated from protobuf field repeated .google.cloud.commerce.consumer.procurement.v1.ModifyOrderRequest.Modification modifications = 6 [(.google.api.field_behavior) = OPTIONAL];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getModifications()
+ {
+ return $this->modifications;
+ }
+
+ /**
+ * Optional. Modifications for an existing Order created by an Offer.
+ * Required when Offer based Order is being modified, except for when going
+ * from an offer to a public plan.
+ *
+ * Generated from protobuf field repeated .google.cloud.commerce.consumer.procurement.v1.ModifyOrderRequest.Modification modifications = 6 [(.google.api.field_behavior) = OPTIONAL];
+ * @param array<\Google\Cloud\Commerce\Consumer\Procurement\V1\ModifyOrderRequest\Modification>|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setModifications($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Commerce\Consumer\Procurement\V1\ModifyOrderRequest\Modification::class);
+ $this->modifications = $arr;
+
+ return $this;
+ }
+
+ /**
+ * Optional. Updated display name of the order, leave as empty if you do not
+ * want to update current display name.
+ *
+ * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getDisplayName()
+ {
+ return $this->display_name;
+ }
+
+ /**
+ * Optional. Updated display name of the order, leave as empty if you do not
+ * want to update current display name.
+ *
+ * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setDisplayName($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->display_name = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. The weak etag, which can be optionally populated, of the order
+ * that this modify request is based on. Validation checking will only happen
+ * if the invoker supplies this field.
+ *
+ * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL];
+ * @return string
+ */
+ public function getEtag()
+ {
+ return $this->etag;
+ }
+
+ /**
+ * Optional. The weak etag, which can be optionally populated, of the order
+ * that this modify request is based on. Validation checking will only happen
+ * if the invoker supplies this field.
+ *
+ * Generated from protobuf field string etag = 4 [(.google.api.field_behavior) = OPTIONAL];
+ * @param string $var
+ * @return $this
+ */
+ public function setEtag($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->etag = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/ModifyOrderRequest/Modification.php b/CommerceConsumerProcurement/src/V1/ModifyOrderRequest/Modification.php
new file mode 100644
index 000000000000..51db5bb537e3
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/ModifyOrderRequest/Modification.php
@@ -0,0 +1,216 @@
+google.cloud.commerce.consumer.procurement.v1.ModifyOrderRequest.Modification
+ */
+class Modification extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. ID of the existing line item to make change to.
+ * Required when change type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE] or
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CANCEL].
+ *
+ * Generated from protobuf field string line_item_id = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $line_item_id = '';
+ /**
+ * Required. Type of change to make.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LineItemChangeType change_type = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $change_type = 0;
+ /**
+ * Optional. The line item to update to.
+ * Required when change_type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CREATE] or
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE].
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LineItemInfo new_line_item_info = 3 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $new_line_item_info = null;
+ /**
+ * Optional. Auto renewal behavior of the subscription for the update.
+ * Applied when change_type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE]. Follows plan default
+ * config when this field is not specified.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AutoRenewalBehavior auto_renewal_behavior = 4 [(.google.api.field_behavior) = OPTIONAL];
+ */
+ protected $auto_renewal_behavior = 0;
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $line_item_id
+ * Required. ID of the existing line item to make change to.
+ * Required when change type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE] or
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CANCEL].
+ * @type int $change_type
+ * Required. Type of change to make.
+ * @type \Google\Cloud\Commerce\Consumer\Procurement\V1\LineItemInfo $new_line_item_info
+ * Optional. The line item to update to.
+ * Required when change_type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CREATE] or
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE].
+ * @type int $auto_renewal_behavior
+ * Optional. Auto renewal behavior of the subscription for the update.
+ * Applied when change_type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE]. Follows plan default
+ * config when this field is not specified.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\ProcurementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. ID of the existing line item to make change to.
+ * Required when change type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE] or
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CANCEL].
+ *
+ * Generated from protobuf field string line_item_id = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getLineItemId()
+ {
+ return $this->line_item_id;
+ }
+
+ /**
+ * Required. ID of the existing line item to make change to.
+ * Required when change type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE] or
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CANCEL].
+ *
+ * Generated from protobuf field string line_item_id = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setLineItemId($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->line_item_id = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. Type of change to make.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LineItemChangeType change_type = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return int
+ */
+ public function getChangeType()
+ {
+ return $this->change_type;
+ }
+
+ /**
+ * Required. Type of change to make.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LineItemChangeType change_type = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param int $var
+ * @return $this
+ */
+ public function setChangeType($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Commerce\Consumer\Procurement\V1\LineItemChangeType::class);
+ $this->change_type = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. The line item to update to.
+ * Required when change_type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CREATE] or
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE].
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LineItemInfo new_line_item_info = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\LineItemInfo|null
+ */
+ public function getNewLineItemInfo()
+ {
+ return $this->new_line_item_info;
+ }
+
+ public function hasNewLineItemInfo()
+ {
+ return isset($this->new_line_item_info);
+ }
+
+ public function clearNewLineItemInfo()
+ {
+ unset($this->new_line_item_info);
+ }
+
+ /**
+ * Optional. The line item to update to.
+ * Required when change_type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_CREATE] or
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE].
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LineItemInfo new_line_item_info = 3 [(.google.api.field_behavior) = OPTIONAL];
+ * @param \Google\Cloud\Commerce\Consumer\Procurement\V1\LineItemInfo $var
+ * @return $this
+ */
+ public function setNewLineItemInfo($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Commerce\Consumer\Procurement\V1\LineItemInfo::class);
+ $this->new_line_item_info = $var;
+
+ return $this;
+ }
+
+ /**
+ * Optional. Auto renewal behavior of the subscription for the update.
+ * Applied when change_type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE]. Follows plan default
+ * config when this field is not specified.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AutoRenewalBehavior auto_renewal_behavior = 4 [(.google.api.field_behavior) = OPTIONAL];
+ * @return int
+ */
+ public function getAutoRenewalBehavior()
+ {
+ return $this->auto_renewal_behavior;
+ }
+
+ /**
+ * Optional. Auto renewal behavior of the subscription for the update.
+ * Applied when change_type is
+ * [LineItemChangeType.LINE_ITEM_CHANGE_TYPE_UPDATE]. Follows plan default
+ * config when this field is not specified.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.AutoRenewalBehavior auto_renewal_behavior = 4 [(.google.api.field_behavior) = OPTIONAL];
+ * @param int $var
+ * @return $this
+ */
+ public function setAutoRenewalBehavior($var)
+ {
+ GPBUtil::checkEnum($var, \Google\Cloud\Commerce\Consumer\Procurement\V1\AutoRenewalBehavior::class);
+ $this->auto_renewal_behavior = $var;
+
+ return $this;
+ }
+
+}
+
+
diff --git a/CommerceConsumerProcurement/src/V1/PlaceOrderRequest.php b/CommerceConsumerProcurement/src/V1/PlaceOrderRequest.php
index 1821ffd71844..38716b51963c 100644
--- a/CommerceConsumerProcurement/src/V1/PlaceOrderRequest.php
+++ b/CommerceConsumerProcurement/src/V1/PlaceOrderRequest.php
@@ -39,7 +39,7 @@ class PlaceOrderRequest extends \Google\Protobuf\Internal\Message
/**
* Optional. A unique identifier for this request.
* The server will ignore subsequent requests that provide a duplicate request
- * ID for at least 120 minutes after the first request.
+ * ID for at least 24 hours after the first request.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
*
@@ -64,7 +64,7 @@ class PlaceOrderRequest extends \Google\Protobuf\Internal\Message
* @type string $request_id
* Optional. A unique identifier for this request.
* The server will ignore subsequent requests that provide a duplicate request
- * ID for at least 120 minutes after the first request.
+ * ID for at least 24 hours after the first request.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
* }
@@ -159,7 +159,7 @@ public function setLineItemInfo($var)
/**
* Optional. A unique identifier for this request.
* The server will ignore subsequent requests that provide a duplicate request
- * ID for at least 120 minutes after the first request.
+ * ID for at least 24 hours after the first request.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
*
@@ -174,7 +174,7 @@ public function getRequestId()
/**
* Optional. A unique identifier for this request.
* The server will ignore subsequent requests that provide a duplicate request
- * ID for at least 120 minutes after the first request.
+ * ID for at least 24 hours after the first request.
* The request ID must be a valid
* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Format).
*
diff --git a/CommerceConsumerProcurement/src/V1/UnassignRequest.php b/CommerceConsumerProcurement/src/V1/UnassignRequest.php
new file mode 100644
index 000000000000..b61d1f46d9bb
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/UnassignRequest.php
@@ -0,0 +1,122 @@
+google.cloud.commerce.consumer.procurement.v1.UnassignRequest
+ */
+class UnassignRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $parent = '';
+ /**
+ * Required. Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field repeated string usernames = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ private $usernames;
+
+ /**
+ * @param string $parent Required. License pool name.
+ * @param string[] $usernames Required. Username.
+ * Format: `name@domain.com`.
+ *
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\UnassignRequest
+ *
+ * @experimental
+ */
+ public static function build(string $parent, array $usernames): self
+ {
+ return (new self())
+ ->setParent($parent)
+ ->setUsernames($usernames);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $parent
+ * Required. License pool name.
+ * @type array|\Google\Protobuf\Internal\RepeatedField $usernames
+ * Required. Username.
+ * Format: `name@domain.com`.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return string
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Required. License pool name.
+ *
+ * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param string $var
+ * @return $this
+ */
+ public function setParent($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->parent = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field repeated string usernames = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Protobuf\Internal\RepeatedField
+ */
+ public function getUsernames()
+ {
+ return $this->usernames;
+ }
+
+ /**
+ * Required. Username.
+ * Format: `name@domain.com`.
+ *
+ * Generated from protobuf field repeated string usernames = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param array|\Google\Protobuf\Internal\RepeatedField $var
+ * @return $this
+ */
+ public function setUsernames($var)
+ {
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->usernames = $arr;
+
+ return $this;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/UnassignResponse.php b/CommerceConsumerProcurement/src/V1/UnassignResponse.php
new file mode 100644
index 000000000000..80b8d97dccc0
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/UnassignResponse.php
@@ -0,0 +1,34 @@
+google.cloud.commerce.consumer.procurement.v1.UnassignResponse
+ */
+class UnassignResponse extends \Google\Protobuf\Internal\Message
+{
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/UpdateLicensePoolRequest.php b/CommerceConsumerProcurement/src/V1/UpdateLicensePoolRequest.php
new file mode 100644
index 000000000000..58377294310c
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/UpdateLicensePoolRequest.php
@@ -0,0 +1,152 @@
+google.cloud.commerce.consumer.procurement.v1.UpdateLicensePoolRequest
+ */
+class UpdateLicensePoolRequest extends \Google\Protobuf\Internal\Message
+{
+ /**
+ * Required. The license pool to update.
+ * The license pool's name field is used to identify the license pool to
+ * update. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LicensePool license_pool = 1 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $license_pool = null;
+ /**
+ * Required. The list of fields to update.
+ *
+ * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
+ */
+ protected $update_mask = null;
+
+ /**
+ * @param \Google\Cloud\Commerce\Consumer\Procurement\V1\LicensePool $licensePool Required. The license pool to update.
+ *
+ * The license pool's name field is used to identify the license pool to
+ * update. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`.
+ * @param \Google\Protobuf\FieldMask $updateMask Required. The list of fields to update.
+ *
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\UpdateLicensePoolRequest
+ *
+ * @experimental
+ */
+ public static function build(\Google\Cloud\Commerce\Consumer\Procurement\V1\LicensePool $licensePool, \Google\Protobuf\FieldMask $updateMask): self
+ {
+ return (new self())
+ ->setLicensePool($licensePool)
+ ->setUpdateMask($updateMask);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Cloud\Commerce\Consumer\Procurement\V1\LicensePool $license_pool
+ * Required. The license pool to update.
+ * The license pool's name field is used to identify the license pool to
+ * update. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`.
+ * @type \Google\Protobuf\FieldMask $update_mask
+ * Required. The list of fields to update.
+ * }
+ */
+ public function __construct($data = NULL) {
+ \GPBMetadata\Google\Cloud\Commerce\Consumer\Procurement\V1\LicenseManagementService::initOnce();
+ parent::__construct($data);
+ }
+
+ /**
+ * Required. The license pool to update.
+ * The license pool's name field is used to identify the license pool to
+ * update. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LicensePool license_pool = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Cloud\Commerce\Consumer\Procurement\V1\LicensePool|null
+ */
+ public function getLicensePool()
+ {
+ return $this->license_pool;
+ }
+
+ public function hasLicensePool()
+ {
+ return isset($this->license_pool);
+ }
+
+ public function clearLicensePool()
+ {
+ unset($this->license_pool);
+ }
+
+ /**
+ * Required. The license pool to update.
+ * The license pool's name field is used to identify the license pool to
+ * update. Format:
+ * `billingAccounts/{billing_account}/orders/{order}/licensePool`.
+ *
+ * Generated from protobuf field .google.cloud.commerce.consumer.procurement.v1.LicensePool license_pool = 1 [(.google.api.field_behavior) = REQUIRED];
+ * @param \Google\Cloud\Commerce\Consumer\Procurement\V1\LicensePool $var
+ * @return $this
+ */
+ public function setLicensePool($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Cloud\Commerce\Consumer\Procurement\V1\LicensePool::class);
+ $this->license_pool = $var;
+
+ return $this;
+ }
+
+ /**
+ * Required. The list of fields to update.
+ *
+ * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @return \Google\Protobuf\FieldMask|null
+ */
+ public function getUpdateMask()
+ {
+ return $this->update_mask;
+ }
+
+ public function hasUpdateMask()
+ {
+ return isset($this->update_mask);
+ }
+
+ public function clearUpdateMask()
+ {
+ unset($this->update_mask);
+ }
+
+ /**
+ * Required. The list of fields to update.
+ *
+ * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];
+ * @param \Google\Protobuf\FieldMask $var
+ * @return $this
+ */
+ public function setUpdateMask($var)
+ {
+ GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class);
+ $this->update_mask = $var;
+
+ return $this;
+ }
+
+}
+
diff --git a/CommerceConsumerProcurement/src/V1/gapic_metadata.json b/CommerceConsumerProcurement/src/V1/gapic_metadata.json
index cb38272d584e..eade9d314231 100644
--- a/CommerceConsumerProcurement/src/V1/gapic_metadata.json
+++ b/CommerceConsumerProcurement/src/V1/gapic_metadata.json
@@ -5,11 +5,50 @@
"protoPackage": "google.cloud.commerce.consumer.procurement.v1",
"libraryPackage": "Google\\Cloud\\Commerce\\Consumer\\Procurement\\V1",
"services": {
+ "LicenseManagementService": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "LicenseManagementServiceGapicClient",
+ "rpcs": {
+ "Assign": {
+ "methods": [
+ "assign"
+ ]
+ },
+ "EnumerateLicensedUsers": {
+ "methods": [
+ "enumerateLicensedUsers"
+ ]
+ },
+ "GetLicensePool": {
+ "methods": [
+ "getLicensePool"
+ ]
+ },
+ "Unassign": {
+ "methods": [
+ "unassign"
+ ]
+ },
+ "UpdateLicensePool": {
+ "methods": [
+ "updateLicensePool"
+ ]
+ }
+ }
+ }
+ }
+ },
"ConsumerProcurementService": {
"clients": {
"grpc": {
"libraryClient": "ConsumerProcurementServiceGapicClient",
"rpcs": {
+ "CancelOrder": {
+ "methods": [
+ "cancelOrder"
+ ]
+ },
"GetOrder": {
"methods": [
"getOrder"
@@ -20,6 +59,11 @@
"listOrders"
]
},
+ "ModifyOrder": {
+ "methods": [
+ "modifyOrder"
+ ]
+ },
"PlaceOrder": {
"methods": [
"placeOrder"
diff --git a/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_client_config.json b/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_client_config.json
index 620c6d0fc1d4..e35a772bd53f 100644
--- a/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_client_config.json
+++ b/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_client_config.json
@@ -38,6 +38,11 @@
}
},
"methods": {
+ "CancelOrder": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
"GetOrder": {
"timeout_millis": 60000,
"retry_codes_name": "retry_policy_1_codes",
@@ -48,6 +53,11 @@
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params"
},
+ "ModifyOrder": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
"PlaceOrder": {
"timeout_millis": 60000,
"retry_codes_name": "no_retry_1_codes",
diff --git a/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_descriptor_config.php b/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_descriptor_config.php
index c49b87798bc3..1c547a193562 100644
--- a/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_descriptor_config.php
+++ b/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_descriptor_config.php
@@ -23,6 +23,44 @@
return [
'interfaces' => [
'google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService' => [
+ 'CancelOrder' => [
+ 'longRunning' => [
+ 'operationReturnType' => '\Google\Cloud\Commerce\Consumer\Procurement\V1\Order',
+ 'metadataReturnType' => '\Google\Cloud\Commerce\Consumer\Procurement\V1\CancelOrderMetadata',
+ 'initialPollDelayMillis' => '500',
+ 'pollDelayMultiplier' => '1.5',
+ 'maxPollDelayMillis' => '5000',
+ 'totalPollTimeoutMillis' => '300000',
+ ],
+ 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL,
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'ModifyOrder' => [
+ 'longRunning' => [
+ 'operationReturnType' => '\Google\Cloud\Commerce\Consumer\Procurement\V1\Order',
+ 'metadataReturnType' => '\Google\Cloud\Commerce\Consumer\Procurement\V1\ModifyOrderMetadata',
+ 'initialPollDelayMillis' => '500',
+ 'pollDelayMultiplier' => '1.5',
+ 'maxPollDelayMillis' => '5000',
+ 'totalPollTimeoutMillis' => '300000',
+ ],
+ 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL,
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'PlaceOrder' => [
'longRunning' => [
'operationReturnType' => '\Google\Cloud\Commerce\Consumer\Procurement\V1\Order',
diff --git a/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_rest_client_config.php b/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_rest_client_config.php
index 940b479b9f04..b29e89ae9fbc 100644
--- a/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_rest_client_config.php
+++ b/CommerceConsumerProcurement/src/V1/resources/consumer_procurement_service_rest_client_config.php
@@ -23,6 +23,18 @@
return [
'interfaces' => [
'google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService' => [
+ 'CancelOrder' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{name=billingAccounts/*/orders/*}:cancel',
+ 'body' => '*',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'GetOrder' => [
'method' => 'get',
'uriTemplate' => '/v1/{name=billingAccounts/*/orders/*}',
@@ -45,6 +57,18 @@
],
],
],
+ 'ModifyOrder' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{name=billingAccounts/*/orders/*}:modify',
+ 'body' => '*',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
'PlaceOrder' => [
'method' => 'post',
'uriTemplate' => '/v1/{parent=billingAccounts/*}/orders:place',
diff --git a/CommerceConsumerProcurement/src/V1/resources/license_management_service_client_config.json b/CommerceConsumerProcurement/src/V1/resources/license_management_service_client_config.json
new file mode 100644
index 000000000000..98dd2f4c2dd0
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/resources/license_management_service_client_config.json
@@ -0,0 +1,47 @@
+{
+ "interfaces": {
+ "google.cloud.commerce.consumer.procurement.v1.LicenseManagementService": {
+ "retry_codes": {
+ "no_retry_codes": []
+ },
+ "retry_params": {
+ "no_retry_params": {
+ "initial_retry_delay_millis": 0,
+ "retry_delay_multiplier": 0.0,
+ "max_retry_delay_millis": 0,
+ "initial_rpc_timeout_millis": 0,
+ "rpc_timeout_multiplier": 1.0,
+ "max_rpc_timeout_millis": 0,
+ "total_timeout_millis": 0
+ }
+ },
+ "methods": {
+ "Assign": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "EnumerateLicensedUsers": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "GetLicensePool": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "Unassign": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ },
+ "UpdateLicensePool": {
+ "timeout_millis": 60000,
+ "retry_codes_name": "no_retry_codes",
+ "retry_params_name": "no_retry_params"
+ }
+ }
+ }
+ }
+}
diff --git a/CommerceConsumerProcurement/src/V1/resources/license_management_service_descriptor_config.php b/CommerceConsumerProcurement/src/V1/resources/license_management_service_descriptor_config.php
new file mode 100644
index 000000000000..6e93fa011f59
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/resources/license_management_service_descriptor_config.php
@@ -0,0 +1,100 @@
+ [
+ 'google.cloud.commerce.consumer.procurement.v1.LicenseManagementService' => [
+ 'Assign' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Commerce\Consumer\Procurement\V1\AssignResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'EnumerateLicensedUsers' => [
+ 'pageStreaming' => [
+ 'requestPageTokenGetMethod' => 'getPageToken',
+ 'requestPageTokenSetMethod' => 'setPageToken',
+ 'requestPageSizeGetMethod' => 'getPageSize',
+ 'requestPageSizeSetMethod' => 'setPageSize',
+ 'responsePageTokenGetMethod' => 'getNextPageToken',
+ 'resourcesGetMethod' => 'getLicensedUsers',
+ ],
+ 'callType' => \Google\ApiCore\Call::PAGINATED_CALL,
+ 'responseType' => 'Google\Cloud\Commerce\Consumer\Procurement\V1\EnumerateLicensedUsersResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'GetLicensePool' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Commerce\Consumer\Procurement\V1\LicensePool',
+ 'headerParams' => [
+ [
+ 'keyName' => 'name',
+ 'fieldAccessors' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'Unassign' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Commerce\Consumer\Procurement\V1\UnassignResponse',
+ 'headerParams' => [
+ [
+ 'keyName' => 'parent',
+ 'fieldAccessors' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'UpdateLicensePool' => [
+ 'callType' => \Google\ApiCore\Call::UNARY_CALL,
+ 'responseType' => 'Google\Cloud\Commerce\Consumer\Procurement\V1\LicensePool',
+ 'headerParams' => [
+ [
+ 'keyName' => 'license_pool.name',
+ 'fieldAccessors' => [
+ 'getLicensePool',
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'templateMap' => [
+ 'licensePool' => 'billingAccounts/{billing_account}/orders/{order}/licensePool',
+ ],
+ ],
+ ],
+];
diff --git a/CommerceConsumerProcurement/src/V1/resources/license_management_service_rest_client_config.php b/CommerceConsumerProcurement/src/V1/resources/license_management_service_rest_client_config.php
new file mode 100644
index 000000000000..c8a2ad883774
--- /dev/null
+++ b/CommerceConsumerProcurement/src/V1/resources/license_management_service_rest_client_config.php
@@ -0,0 +1,104 @@
+ [
+ 'google.cloud.commerce.consumer.procurement.v1.LicenseManagementService' => [
+ 'Assign' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{parent=billingAccounts/*/orders/*/licensePool}:assign',
+ 'body' => '*',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'EnumerateLicensedUsers' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v1/{parent=billingAccounts/*/orders/*/licensePool}:enumerateLicensedUsers',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'GetLicensePool' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v1/{name=billingAccounts/*/orders/*/licensePool}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ 'Unassign' => [
+ 'method' => 'post',
+ 'uriTemplate' => '/v1/{parent=billingAccounts/*/orders/*/licensePool}:unassign',
+ 'body' => '*',
+ 'placeholders' => [
+ 'parent' => [
+ 'getters' => [
+ 'getParent',
+ ],
+ ],
+ ],
+ ],
+ 'UpdateLicensePool' => [
+ 'method' => 'patch',
+ 'uriTemplate' => '/v1/{license_pool.name=billingAccounts/*/orders/*/licensePool/*}',
+ 'body' => 'license_pool',
+ 'placeholders' => [
+ 'license_pool.name' => [
+ 'getters' => [
+ 'getLicensePool',
+ 'getName',
+ ],
+ ],
+ ],
+ 'queryParams' => [
+ 'update_mask',
+ ],
+ ],
+ ],
+ 'google.longrunning.Operations' => [
+ 'GetOperation' => [
+ 'method' => 'get',
+ 'uriTemplate' => '/v1/{name=billingAccounts/*/orders/*/operations/*}',
+ 'placeholders' => [
+ 'name' => [
+ 'getters' => [
+ 'getName',
+ ],
+ ],
+ ],
+ ],
+ ],
+ ],
+ 'numericEnums' => true,
+];
diff --git a/CommerceConsumerProcurement/tests/Unit/V1/Client/ConsumerProcurementServiceClientTest.php b/CommerceConsumerProcurement/tests/Unit/V1/Client/ConsumerProcurementServiceClientTest.php
index 5832dc58b3ee..0b8e62ec30b5 100644
--- a/CommerceConsumerProcurement/tests/Unit/V1/Client/ConsumerProcurementServiceClientTest.php
+++ b/CommerceConsumerProcurement/tests/Unit/V1/Client/ConsumerProcurementServiceClientTest.php
@@ -26,10 +26,12 @@
use Google\ApiCore\CredentialsWrapper;
use Google\ApiCore\Testing\GeneratedTest;
use Google\ApiCore\Testing\MockTransport;
+use Google\Cloud\Commerce\Consumer\Procurement\V1\CancelOrderRequest;
use Google\Cloud\Commerce\Consumer\Procurement\V1\Client\ConsumerProcurementServiceClient;
use Google\Cloud\Commerce\Consumer\Procurement\V1\GetOrderRequest;
use Google\Cloud\Commerce\Consumer\Procurement\V1\ListOrdersRequest;
use Google\Cloud\Commerce\Consumer\Procurement\V1\ListOrdersResponse;
+use Google\Cloud\Commerce\Consumer\Procurement\V1\ModifyOrderRequest;
use Google\Cloud\Commerce\Consumer\Procurement\V1\Order;
use Google\Cloud\Commerce\Consumer\Procurement\V1\PlaceOrderRequest;
use Google\LongRunning\Client\OperationsClient;
@@ -69,6 +71,137 @@ private function createClient(array $options = [])
return new ConsumerProcurementServiceClient($options);
}
+ /** @test */
+ public function cancelOrderTest()
+ {
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ 'operationsClient' => $operationsClient,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ // Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/cancelOrderTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $name2 = 'name2-1052831874';
+ $displayName = 'displayName1615086568';
+ $etag2 = 'etag2-1293302904';
+ $expectedResponse = new Order();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setDisplayName($displayName);
+ $expectedResponse->setEtag($etag2);
+ $anyResponse = new Any();
+ $anyResponse->setValue($expectedResponse->serializeToString());
+ $completeOperation = new Operation();
+ $completeOperation->setName('operations/cancelOrderTest');
+ $completeOperation->setDone(true);
+ $completeOperation->setResponse($anyResponse);
+ $operationsTransport->addResponse($completeOperation);
+ // Mock request
+ $name = 'name3373707';
+ $request = (new CancelOrderRequest())->setName($name);
+ $response = $gapicClient->cancelOrder($request);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $apiRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($apiRequests));
+ $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
+ $this->assertSame(0, count($operationsRequestsEmpty));
+ $actualApiFuncCall = $apiRequests[0]->getFuncCall();
+ $actualApiRequestObject = $apiRequests[0]->getRequestObject();
+ $this->assertSame(
+ '/google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService/CancelOrder',
+ $actualApiFuncCall
+ );
+ $actualValue = $actualApiRequestObject->getName();
+ $this->assertProtobufEquals($name, $actualValue);
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/cancelOrderTest');
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ $this->assertTrue($response->isDone());
+ $this->assertEquals($expectedResponse, $response->getResult());
+ $apiRequestsEmpty = $transport->popReceivedCalls();
+ $this->assertSame(0, count($apiRequestsEmpty));
+ $operationsRequests = $operationsTransport->popReceivedCalls();
+ $this->assertSame(1, count($operationsRequests));
+ $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
+ $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
+ $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
+ $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ }
+
+ /** @test */
+ public function cancelOrderExceptionTest()
+ {
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ 'operationsClient' => $operationsClient,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ // Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/cancelOrderTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
+ $operationsTransport->addResponse(null, $status);
+ // Mock request
+ $name = 'name3373707';
+ $request = (new CancelOrderRequest())->setName($name);
+ $response = $gapicClient->cancelOrder($request);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/cancelOrderTest');
+ try {
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ // If the pollUntilComplete() method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stubs are exhausted
+ $transport->popReceivedCalls();
+ $operationsTransport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ }
+
/** @test */
public function getOrderTest()
{
@@ -215,6 +348,137 @@ public function listOrdersExceptionTest()
$this->assertTrue($transport->isExhausted());
}
+ /** @test */
+ public function modifyOrderTest()
+ {
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ 'operationsClient' => $operationsClient,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ // Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/modifyOrderTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $name2 = 'name2-1052831874';
+ $displayName2 = 'displayName21615000987';
+ $etag2 = 'etag2-1293302904';
+ $expectedResponse = new Order();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setDisplayName($displayName2);
+ $expectedResponse->setEtag($etag2);
+ $anyResponse = new Any();
+ $anyResponse->setValue($expectedResponse->serializeToString());
+ $completeOperation = new Operation();
+ $completeOperation->setName('operations/modifyOrderTest');
+ $completeOperation->setDone(true);
+ $completeOperation->setResponse($anyResponse);
+ $operationsTransport->addResponse($completeOperation);
+ // Mock request
+ $name = 'name3373707';
+ $request = (new ModifyOrderRequest())->setName($name);
+ $response = $gapicClient->modifyOrder($request);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $apiRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($apiRequests));
+ $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
+ $this->assertSame(0, count($operationsRequestsEmpty));
+ $actualApiFuncCall = $apiRequests[0]->getFuncCall();
+ $actualApiRequestObject = $apiRequests[0]->getRequestObject();
+ $this->assertSame(
+ '/google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService/ModifyOrder',
+ $actualApiFuncCall
+ );
+ $actualValue = $actualApiRequestObject->getName();
+ $this->assertProtobufEquals($name, $actualValue);
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/modifyOrderTest');
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ $this->assertTrue($response->isDone());
+ $this->assertEquals($expectedResponse, $response->getResult());
+ $apiRequestsEmpty = $transport->popReceivedCalls();
+ $this->assertSame(0, count($apiRequestsEmpty));
+ $operationsRequests = $operationsTransport->popReceivedCalls();
+ $this->assertSame(1, count($operationsRequests));
+ $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
+ $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
+ $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
+ $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ }
+
+ /** @test */
+ public function modifyOrderExceptionTest()
+ {
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ 'operationsClient' => $operationsClient,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ // Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/modifyOrderTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
+ $operationsTransport->addResponse(null, $status);
+ // Mock request
+ $name = 'name3373707';
+ $request = (new ModifyOrderRequest())->setName($name);
+ $response = $gapicClient->modifyOrder($request);
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/modifyOrderTest');
+ try {
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ // If the pollUntilComplete() method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stubs are exhausted
+ $transport->popReceivedCalls();
+ $operationsTransport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
+ }
+
/** @test */
public function placeOrderTest()
{
@@ -351,37 +615,74 @@ public function placeOrderExceptionTest()
}
/** @test */
- public function getOrderAsyncTest()
+ public function cancelOrderAsyncTest()
{
+ $operationsTransport = $this->createTransport();
+ $operationsClient = new OperationsClient([
+ 'apiEndpoint' => '',
+ 'transport' => $operationsTransport,
+ 'credentials' => $this->createCredentials(),
+ ]);
$transport = $this->createTransport();
$gapicClient = $this->createClient([
'transport' => $transport,
+ 'operationsClient' => $operationsClient,
]);
$this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
// Mock response
+ $incompleteOperation = new Operation();
+ $incompleteOperation->setName('operations/cancelOrderTest');
+ $incompleteOperation->setDone(false);
+ $transport->addResponse($incompleteOperation);
$name2 = 'name2-1052831874';
$displayName = 'displayName1615086568';
- $etag = 'etag3123477';
+ $etag2 = 'etag2-1293302904';
$expectedResponse = new Order();
$expectedResponse->setName($name2);
$expectedResponse->setDisplayName($displayName);
- $expectedResponse->setEtag($etag);
- $transport->addResponse($expectedResponse);
+ $expectedResponse->setEtag($etag2);
+ $anyResponse = new Any();
+ $anyResponse->setValue($expectedResponse->serializeToString());
+ $completeOperation = new Operation();
+ $completeOperation->setName('operations/cancelOrderTest');
+ $completeOperation->setDone(true);
+ $completeOperation->setResponse($anyResponse);
+ $operationsTransport->addResponse($completeOperation);
// Mock request
$name = 'name3373707';
- $request = (new GetOrderRequest())->setName($name);
- $response = $gapicClient->getOrderAsync($request)->wait();
- $this->assertEquals($expectedResponse, $response);
- $actualRequests = $transport->popReceivedCalls();
- $this->assertSame(1, count($actualRequests));
- $actualFuncCall = $actualRequests[0]->getFuncCall();
- $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $request = (new CancelOrderRequest())->setName($name);
+ $response = $gapicClient->cancelOrderAsync($request)->wait();
+ $this->assertFalse($response->isDone());
+ $this->assertNull($response->getResult());
+ $apiRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($apiRequests));
+ $operationsRequestsEmpty = $operationsTransport->popReceivedCalls();
+ $this->assertSame(0, count($operationsRequestsEmpty));
+ $actualApiFuncCall = $apiRequests[0]->getFuncCall();
+ $actualApiRequestObject = $apiRequests[0]->getRequestObject();
$this->assertSame(
- '/google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService/GetOrder',
- $actualFuncCall
+ '/google.cloud.commerce.consumer.procurement.v1.ConsumerProcurementService/CancelOrder',
+ $actualApiFuncCall
);
- $actualValue = $actualRequestObject->getName();
+ $actualValue = $actualApiRequestObject->getName();
$this->assertProtobufEquals($name, $actualValue);
+ $expectedOperationsRequestObject = new GetOperationRequest();
+ $expectedOperationsRequestObject->setName('operations/cancelOrderTest');
+ $response->pollUntilComplete([
+ 'initialPollDelayMillis' => 1,
+ ]);
+ $this->assertTrue($response->isDone());
+ $this->assertEquals($expectedResponse, $response->getResult());
+ $apiRequestsEmpty = $transport->popReceivedCalls();
+ $this->assertSame(0, count($apiRequestsEmpty));
+ $operationsRequests = $operationsTransport->popReceivedCalls();
+ $this->assertSame(1, count($operationsRequests));
+ $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall();
+ $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject();
+ $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall);
+ $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject);
$this->assertTrue($transport->isExhausted());
+ $this->assertTrue($operationsTransport->isExhausted());
}
}
diff --git a/CommerceConsumerProcurement/tests/Unit/V1/Client/LicenseManagementServiceClientTest.php b/CommerceConsumerProcurement/tests/Unit/V1/Client/LicenseManagementServiceClientTest.php
new file mode 100644
index 000000000000..a0dcd999b2ea
--- /dev/null
+++ b/CommerceConsumerProcurement/tests/Unit/V1/Client/LicenseManagementServiceClientTest.php
@@ -0,0 +1,472 @@
+getMockBuilder(CredentialsWrapper::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ }
+
+ /** @return LicenseManagementServiceClient */
+ private function createClient(array $options = [])
+ {
+ $options += [
+ 'credentials' => $this->createCredentials(),
+ ];
+ return new LicenseManagementServiceClient($options);
+ }
+
+ /** @test */
+ public function assignTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new AssignResponse();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $parent = 'parent-995424086';
+ $usernames = [];
+ $request = (new AssignRequest())->setParent($parent)->setUsernames($usernames);
+ $response = $gapicClient->assign($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame(
+ '/google.cloud.commerce.consumer.procurement.v1.LicenseManagementService/Assign',
+ $actualFuncCall
+ );
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($parent, $actualValue);
+ $actualValue = $actualRequestObject->getUsernames();
+ $this->assertProtobufEquals($usernames, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function assignExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
+ $transport->addResponse(null, $status);
+ // Mock request
+ $parent = 'parent-995424086';
+ $usernames = [];
+ $request = (new AssignRequest())->setParent($parent)->setUsernames($usernames);
+ try {
+ $gapicClient->assign($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function enumerateLicensedUsersTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $nextPageToken = '';
+ $licensedUsersElement = new LicensedUser();
+ $licensedUsers = [$licensedUsersElement];
+ $expectedResponse = new EnumerateLicensedUsersResponse();
+ $expectedResponse->setNextPageToken($nextPageToken);
+ $expectedResponse->setLicensedUsers($licensedUsers);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $parent = 'parent-995424086';
+ $request = (new EnumerateLicensedUsersRequest())->setParent($parent);
+ $response = $gapicClient->enumerateLicensedUsers($request);
+ $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
+ $resources = iterator_to_array($response->iterateAllElements());
+ $this->assertSame(1, count($resources));
+ $this->assertEquals($expectedResponse->getLicensedUsers()[0], $resources[0]);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame(
+ '/google.cloud.commerce.consumer.procurement.v1.LicenseManagementService/EnumerateLicensedUsers',
+ $actualFuncCall
+ );
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($parent, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function enumerateLicensedUsersExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
+ $transport->addResponse(null, $status);
+ // Mock request
+ $parent = 'parent-995424086';
+ $request = (new EnumerateLicensedUsersRequest())->setParent($parent);
+ try {
+ $gapicClient->enumerateLicensedUsers($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getLicensePoolTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name2 = 'name2-1052831874';
+ $availableLicenseCount = 387091611;
+ $totalLicenseCount = 834147882;
+ $expectedResponse = new LicensePool();
+ $expectedResponse->setName($name2);
+ $expectedResponse->setAvailableLicenseCount($availableLicenseCount);
+ $expectedResponse->setTotalLicenseCount($totalLicenseCount);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $name = 'name3373707';
+ $request = (new GetLicensePoolRequest())->setName($name);
+ $response = $gapicClient->getLicensePool($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame(
+ '/google.cloud.commerce.consumer.procurement.v1.LicenseManagementService/GetLicensePool',
+ $actualFuncCall
+ );
+ $actualValue = $actualRequestObject->getName();
+ $this->assertProtobufEquals($name, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function getLicensePoolExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
+ $transport->addResponse(null, $status);
+ // Mock request
+ $name = 'name3373707';
+ $request = (new GetLicensePoolRequest())->setName($name);
+ try {
+ $gapicClient->getLicensePool($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function unassignTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new UnassignResponse();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $parent = 'parent-995424086';
+ $usernames = [];
+ $request = (new UnassignRequest())->setParent($parent)->setUsernames($usernames);
+ $response = $gapicClient->unassign($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame(
+ '/google.cloud.commerce.consumer.procurement.v1.LicenseManagementService/Unassign',
+ $actualFuncCall
+ );
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($parent, $actualValue);
+ $actualValue = $actualRequestObject->getUsernames();
+ $this->assertProtobufEquals($usernames, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function unassignExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
+ $transport->addResponse(null, $status);
+ // Mock request
+ $parent = 'parent-995424086';
+ $usernames = [];
+ $request = (new UnassignRequest())->setParent($parent)->setUsernames($usernames);
+ try {
+ $gapicClient->unassign($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function updateLicensePoolTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $name = 'name3373707';
+ $availableLicenseCount = 387091611;
+ $totalLicenseCount = 834147882;
+ $expectedResponse = new LicensePool();
+ $expectedResponse->setName($name);
+ $expectedResponse->setAvailableLicenseCount($availableLicenseCount);
+ $expectedResponse->setTotalLicenseCount($totalLicenseCount);
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $licensePool = new LicensePool();
+ $licensePoolLicenseAssignmentProtocol = new AssignmentProtocol();
+ $licensePool->setLicenseAssignmentProtocol($licensePoolLicenseAssignmentProtocol);
+ $updateMask = new FieldMask();
+ $request = (new UpdateLicensePoolRequest())->setLicensePool($licensePool)->setUpdateMask($updateMask);
+ $response = $gapicClient->updateLicensePool($request);
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame(
+ '/google.cloud.commerce.consumer.procurement.v1.LicenseManagementService/UpdateLicensePool',
+ $actualFuncCall
+ );
+ $actualValue = $actualRequestObject->getLicensePool();
+ $this->assertProtobufEquals($licensePool, $actualValue);
+ $actualValue = $actualRequestObject->getUpdateMask();
+ $this->assertProtobufEquals($updateMask, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function updateLicensePoolExceptionTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ $status = new stdClass();
+ $status->code = Code::DATA_LOSS;
+ $status->details = 'internal error';
+ $expectedExceptionMessage = json_encode(
+ [
+ 'message' => 'internal error',
+ 'code' => Code::DATA_LOSS,
+ 'status' => 'DATA_LOSS',
+ 'details' => [],
+ ],
+ JSON_PRETTY_PRINT
+ );
+ $transport->addResponse(null, $status);
+ // Mock request
+ $licensePool = new LicensePool();
+ $licensePoolLicenseAssignmentProtocol = new AssignmentProtocol();
+ $licensePool->setLicenseAssignmentProtocol($licensePoolLicenseAssignmentProtocol);
+ $updateMask = new FieldMask();
+ $request = (new UpdateLicensePoolRequest())->setLicensePool($licensePool)->setUpdateMask($updateMask);
+ try {
+ $gapicClient->updateLicensePool($request);
+ // If the $gapicClient method call did not throw, fail the test
+ $this->fail('Expected an ApiException, but no exception was thrown.');
+ } catch (ApiException $ex) {
+ $this->assertEquals($status->code, $ex->getCode());
+ $this->assertEquals($expectedExceptionMessage, $ex->getMessage());
+ }
+ // Call popReceivedCalls to ensure the stub is exhausted
+ $transport->popReceivedCalls();
+ $this->assertTrue($transport->isExhausted());
+ }
+
+ /** @test */
+ public function assignAsyncTest()
+ {
+ $transport = $this->createTransport();
+ $gapicClient = $this->createClient([
+ 'transport' => $transport,
+ ]);
+ $this->assertTrue($transport->isExhausted());
+ // Mock response
+ $expectedResponse = new AssignResponse();
+ $transport->addResponse($expectedResponse);
+ // Mock request
+ $parent = 'parent-995424086';
+ $usernames = [];
+ $request = (new AssignRequest())->setParent($parent)->setUsernames($usernames);
+ $response = $gapicClient->assignAsync($request)->wait();
+ $this->assertEquals($expectedResponse, $response);
+ $actualRequests = $transport->popReceivedCalls();
+ $this->assertSame(1, count($actualRequests));
+ $actualFuncCall = $actualRequests[0]->getFuncCall();
+ $actualRequestObject = $actualRequests[0]->getRequestObject();
+ $this->assertSame(
+ '/google.cloud.commerce.consumer.procurement.v1.LicenseManagementService/Assign',
+ $actualFuncCall
+ );
+ $actualValue = $actualRequestObject->getParent();
+ $this->assertProtobufEquals($parent, $actualValue);
+ $actualValue = $actualRequestObject->getUsernames();
+ $this->assertProtobufEquals($usernames, $actualValue);
+ $this->assertTrue($transport->isExhausted());
+ }
+}