diff --git a/Channel/metadata/V1/Customers.php b/Channel/metadata/V1/Customers.php index f2d0e0228a6..804cf781f62 100644 --- a/Channel/metadata/V1/Customers.php +++ b/Channel/metadata/V1/Customers.php @@ -21,8 +21,8 @@ public static function initOnce() { \GPBMetadata\Google\Type\PostalAddress::initOnce(); $pool->internalAddGeneratedFile( ' - -\'google/cloud/channel/v1/customers.protogoogle.cloud.channel.v1google/api/resource.proto$google/cloud/channel/v1/common.protogoogle/protobuf/timestamp.proto google/type/postal_address.proto" + +\'google/cloud/channel/v1/customers.protogoogle.cloud.channel.v1google/api/resource.proto$google/cloud/channel/v1/common.protogoogle/protobuf/timestamp.proto google/type/postal_address.proto" Customer name ( BA org_display_name ( BA; @@ -36,7 +36,8 @@ public static function initOnce() { language_code ( BAL cloud_identity_info ( 2*.google.cloud.channel.v1.CloudIdentityInfoBA -channel_partner_id ( :RAO +channel_partner_id (  +correlation_id ( BA:RAO $cloudchannel.googleapis.com/Customer\'accounts/{account}/customers/{customer}" ContactInfo diff --git a/Channel/metadata/V1/EntitlementChanges.php b/Channel/metadata/V1/EntitlementChanges.php new file mode 100644 index 00000000000..76e17539b4c Binary files /dev/null and b/Channel/metadata/V1/EntitlementChanges.php differ diff --git a/Channel/metadata/V1/ReportsService.php b/Channel/metadata/V1/ReportsService.php index efa0b67f97b..df2e1c8442e 100644 Binary files a/Channel/metadata/V1/ReportsService.php and b/Channel/metadata/V1/ReportsService.php differ diff --git a/Channel/metadata/V1/Service.php b/Channel/metadata/V1/Service.php index 9244ae00e97..50819da2be8 100644 Binary files a/Channel/metadata/V1/Service.php and b/Channel/metadata/V1/Service.php differ diff --git a/Channel/samples/V1/CloudChannelServiceClient/list_entitlement_changes.php b/Channel/samples/V1/CloudChannelServiceClient/list_entitlement_changes.php new file mode 100644 index 00000000000..3b733049a2f --- /dev/null +++ b/Channel/samples/V1/CloudChannelServiceClient/list_entitlement_changes.php @@ -0,0 +1,95 @@ +listEntitlementChanges($formattedParent); + + /** @var EntitlementChange $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 +{ + $formattedParent = CloudChannelServiceClient::entitlementName( + '[ACCOUNT]', + '[CUSTOMER]', + '[ENTITLEMENT]' + ); + + list_entitlement_changes_sample($formattedParent); +} +// [END cloudchannel_v1_generated_CloudChannelService_ListEntitlementChanges_sync] diff --git a/Channel/src/V1/Customer.php b/Channel/src/V1/Customer.php index f8d3382511c..a5d171cb987 100644 --- a/Channel/src/V1/Customer.php +++ b/Channel/src/V1/Customer.php @@ -101,6 +101,13 @@ class Customer extends \Google\Protobuf\Internal\Message * Generated from protobuf field string channel_partner_id = 13; */ private $channel_partner_id = ''; + /** + * Optional. External CRM ID for the customer. + * Populated only if a CRM ID exists for this customer. + * + * Generated from protobuf field string correlation_id = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $correlation_id = ''; /** * Constructor. @@ -146,6 +153,9 @@ class Customer extends \Google\Protobuf\Internal\Message * @type string $channel_partner_id * Cloud Identity ID of the customer's channel partner. * Populated only if a channel partner exists for this customer. + * @type string $correlation_id + * Optional. External CRM ID for the customer. + * Populated only if a CRM ID exists for this customer. * } */ public function __construct($data = NULL) { @@ -543,5 +553,33 @@ public function setChannelPartnerId($var) return $this; } + /** + * Optional. External CRM ID for the customer. + * Populated only if a CRM ID exists for this customer. + * + * Generated from protobuf field string correlation_id = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCorrelationId() + { + return $this->correlation_id; + } + + /** + * Optional. External CRM ID for the customer. + * Populated only if a CRM ID exists for this customer. + * + * Generated from protobuf field string correlation_id = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCorrelationId($var) + { + GPBUtil::checkString($var, True); + $this->correlation_id = $var; + + return $this; + } + } diff --git a/Channel/src/V1/Entitlement.php b/Channel/src/V1/Entitlement.php index d86374204a6..c4cb68fefaa 100644 --- a/Channel/src/V1/Entitlement.php +++ b/Channel/src/V1/Entitlement.php @@ -93,10 +93,15 @@ class Entitlement extends \Google\Protobuf\Internal\Message * Extended entitlement parameters. When creating an entitlement, valid * parameter names and values are defined in the * [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions]. - * The response may include the following output-only Parameters: + * For Google Workspace, the following Parameters may be accepted as input: + * - max_units: The maximum assignable units for a flexible offer + * OR + * - num_units: The total commitment for commitment-based offers + * The response may additionally include the following output-only Parameters: * - assigned_units: The number of licenses assigned to users. - * - max_units: The maximum assignable units for a flexible offer. - * - num_units: The total commitment for commitment-based offers. + * For GCP billing subaccounts, the following Parameter may be accepted as + * input: + * - display_name: The display name of the billing subaccount. * * Generated from protobuf field repeated .google.cloud.channel.v1.Parameter parameters = 26; */ @@ -142,10 +147,15 @@ class Entitlement extends \Google\Protobuf\Internal\Message * Extended entitlement parameters. When creating an entitlement, valid * parameter names and values are defined in the * [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions]. - * The response may include the following output-only Parameters: + * For Google Workspace, the following Parameters may be accepted as input: + * - max_units: The maximum assignable units for a flexible offer + * OR + * - num_units: The total commitment for commitment-based offers + * The response may additionally include the following output-only Parameters: * - assigned_units: The number of licenses assigned to users. - * - max_units: The maximum assignable units for a flexible offer. - * - num_units: The total commitment for commitment-based offers. + * For GCP billing subaccounts, the following Parameter may be accepted as + * input: + * - display_name: The display name of the billing subaccount. * } */ public function __construct($data = NULL) { @@ -519,10 +529,15 @@ public function setAssociationInfo($var) * Extended entitlement parameters. When creating an entitlement, valid * parameter names and values are defined in the * [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions]. - * The response may include the following output-only Parameters: + * For Google Workspace, the following Parameters may be accepted as input: + * - max_units: The maximum assignable units for a flexible offer + * OR + * - num_units: The total commitment for commitment-based offers + * The response may additionally include the following output-only Parameters: * - assigned_units: The number of licenses assigned to users. - * - max_units: The maximum assignable units for a flexible offer. - * - num_units: The total commitment for commitment-based offers. + * For GCP billing subaccounts, the following Parameter may be accepted as + * input: + * - display_name: The display name of the billing subaccount. * * Generated from protobuf field repeated .google.cloud.channel.v1.Parameter parameters = 26; * @return \Google\Protobuf\Internal\RepeatedField @@ -536,10 +551,15 @@ public function getParameters() * Extended entitlement parameters. When creating an entitlement, valid * parameter names and values are defined in the * [Offer.parameter_definitions][google.cloud.channel.v1.Offer.parameter_definitions]. - * The response may include the following output-only Parameters: + * For Google Workspace, the following Parameters may be accepted as input: + * - max_units: The maximum assignable units for a flexible offer + * OR + * - num_units: The total commitment for commitment-based offers + * The response may additionally include the following output-only Parameters: * - assigned_units: The number of licenses assigned to users. - * - max_units: The maximum assignable units for a flexible offer. - * - num_units: The total commitment for commitment-based offers. + * For GCP billing subaccounts, the following Parameter may be accepted as + * input: + * - display_name: The display name of the billing subaccount. * * Generated from protobuf field repeated .google.cloud.channel.v1.Parameter parameters = 26; * @param array<\Google\Cloud\Channel\V1\Parameter>|\Google\Protobuf\Internal\RepeatedField $var diff --git a/Channel/src/V1/EntitlementChange.php b/Channel/src/V1/EntitlementChange.php new file mode 100644 index 00000000000..f2730041269 --- /dev/null +++ b/Channel/src/V1/EntitlementChange.php @@ -0,0 +1,494 @@ +google.cloud.channel.v1.EntitlementChange + */ +class EntitlementChange extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of an entitlement in the form: + * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * + * Generated from protobuf field string entitlement = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $entitlement = ''; + /** + * Required. Resource name of the Offer at the time of change. + * Takes the form: accounts/{account_id}/offers/{offer_id}. + * + * Generated from protobuf field string offer = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $offer = ''; + /** + * Service provisioned for an Entitlement. + * + * Generated from protobuf field .google.cloud.channel.v1.ProvisionedService provisioned_service = 3; + */ + private $provisioned_service = null; + /** + * The change action type. + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.ChangeType change_type = 4; + */ + private $change_type = 0; + /** + * The submitted time of the change. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + */ + private $create_time = null; + /** + * Operator type responsible for the change. + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.OperatorType operator_type = 6; + */ + private $operator_type = 0; + /** + * Extended parameters, such as: + * purchase_order_number, gcp_details; + * internal_correlation_id, long_running_operation_id, order_id; + * etc. + * + * Generated from protobuf field repeated .google.cloud.channel.v1.Parameter parameters = 8; + */ + private $parameters; + /** + * Human-readable identifier that shows what operator made a change. + * When the operator_type is RESELLER, this is the user's email address. + * For all other operator types, this is empty. + * + * Generated from protobuf field string operator = 12; + */ + private $operator = ''; + protected $change_reason; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $suspension_reason + * Suspension reason for the Entitlement. + * @type int $cancellation_reason + * Cancellation reason for the Entitlement. + * @type int $activation_reason + * The Entitlement's activation reason + * @type string $other_change_reason + * e.g. purchase_number change reason, entered by CRS. + * @type string $entitlement + * Required. Resource name of an entitlement in the form: + * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * @type string $offer + * Required. Resource name of the Offer at the time of change. + * Takes the form: accounts/{account_id}/offers/{offer_id}. + * @type \Google\Cloud\Channel\V1\ProvisionedService $provisioned_service + * Service provisioned for an Entitlement. + * @type int $change_type + * The change action type. + * @type \Google\Protobuf\Timestamp $create_time + * The submitted time of the change. + * @type int $operator_type + * Operator type responsible for the change. + * @type array<\Google\Cloud\Channel\V1\Parameter>|\Google\Protobuf\Internal\RepeatedField $parameters + * Extended parameters, such as: + * purchase_order_number, gcp_details; + * internal_correlation_id, long_running_operation_id, order_id; + * etc. + * @type string $operator + * Human-readable identifier that shows what operator made a change. + * When the operator_type is RESELLER, this is the user's email address. + * For all other operator types, this is empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Channel\V1\EntitlementChanges::initOnce(); + parent::__construct($data); + } + + /** + * Suspension reason for the Entitlement. + * + * Generated from protobuf field .google.cloud.channel.v1.Entitlement.SuspensionReason suspension_reason = 9; + * @return int + */ + public function getSuspensionReason() + { + return $this->readOneof(9); + } + + public function hasSuspensionReason() + { + return $this->hasOneof(9); + } + + /** + * Suspension reason for the Entitlement. + * + * Generated from protobuf field .google.cloud.channel.v1.Entitlement.SuspensionReason suspension_reason = 9; + * @param int $var + * @return $this + */ + public function setSuspensionReason($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Channel\V1\Entitlement\SuspensionReason::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Cancellation reason for the Entitlement. + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.CancellationReason cancellation_reason = 10; + * @return int + */ + public function getCancellationReason() + { + return $this->readOneof(10); + } + + public function hasCancellationReason() + { + return $this->hasOneof(10); + } + + /** + * Cancellation reason for the Entitlement. + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.CancellationReason cancellation_reason = 10; + * @param int $var + * @return $this + */ + public function setCancellationReason($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Channel\V1\EntitlementChange\CancellationReason::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * The Entitlement's activation reason + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.ActivationReason activation_reason = 11; + * @return int + */ + public function getActivationReason() + { + return $this->readOneof(11); + } + + public function hasActivationReason() + { + return $this->hasOneof(11); + } + + /** + * The Entitlement's activation reason + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.ActivationReason activation_reason = 11; + * @param int $var + * @return $this + */ + public function setActivationReason($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Channel\V1\EntitlementChange\ActivationReason::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * e.g. purchase_number change reason, entered by CRS. + * + * Generated from protobuf field string other_change_reason = 100; + * @return string + */ + public function getOtherChangeReason() + { + return $this->readOneof(100); + } + + public function hasOtherChangeReason() + { + return $this->hasOneof(100); + } + + /** + * e.g. purchase_number change reason, entered by CRS. + * + * Generated from protobuf field string other_change_reason = 100; + * @param string $var + * @return $this + */ + public function setOtherChangeReason($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(100, $var); + + return $this; + } + + /** + * Required. Resource name of an entitlement in the form: + * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * + * Generated from protobuf field string entitlement = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getEntitlement() + { + return $this->entitlement; + } + + /** + * Required. Resource name of an entitlement in the form: + * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * + * Generated from protobuf field string entitlement = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEntitlement($var) + { + GPBUtil::checkString($var, True); + $this->entitlement = $var; + + return $this; + } + + /** + * Required. Resource name of the Offer at the time of change. + * Takes the form: accounts/{account_id}/offers/{offer_id}. + * + * Generated from protobuf field string offer = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getOffer() + { + return $this->offer; + } + + /** + * Required. Resource name of the Offer at the time of change. + * Takes the form: accounts/{account_id}/offers/{offer_id}. + * + * Generated from protobuf field string offer = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setOffer($var) + { + GPBUtil::checkString($var, True); + $this->offer = $var; + + return $this; + } + + /** + * Service provisioned for an Entitlement. + * + * Generated from protobuf field .google.cloud.channel.v1.ProvisionedService provisioned_service = 3; + * @return \Google\Cloud\Channel\V1\ProvisionedService|null + */ + public function getProvisionedService() + { + return $this->provisioned_service; + } + + public function hasProvisionedService() + { + return isset($this->provisioned_service); + } + + public function clearProvisionedService() + { + unset($this->provisioned_service); + } + + /** + * Service provisioned for an Entitlement. + * + * Generated from protobuf field .google.cloud.channel.v1.ProvisionedService provisioned_service = 3; + * @param \Google\Cloud\Channel\V1\ProvisionedService $var + * @return $this + */ + public function setProvisionedService($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Channel\V1\ProvisionedService::class); + $this->provisioned_service = $var; + + return $this; + } + + /** + * The change action type. + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.ChangeType change_type = 4; + * @return int + */ + public function getChangeType() + { + return $this->change_type; + } + + /** + * The change action type. + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.ChangeType change_type = 4; + * @param int $var + * @return $this + */ + public function setChangeType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Channel\V1\EntitlementChange\ChangeType::class); + $this->change_type = $var; + + return $this; + } + + /** + * The submitted time of the change. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The submitted time of the change. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Operator type responsible for the change. + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.OperatorType operator_type = 6; + * @return int + */ + public function getOperatorType() + { + return $this->operator_type; + } + + /** + * Operator type responsible for the change. + * + * Generated from protobuf field .google.cloud.channel.v1.EntitlementChange.OperatorType operator_type = 6; + * @param int $var + * @return $this + */ + public function setOperatorType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Channel\V1\EntitlementChange\OperatorType::class); + $this->operator_type = $var; + + return $this; + } + + /** + * Extended parameters, such as: + * purchase_order_number, gcp_details; + * internal_correlation_id, long_running_operation_id, order_id; + * etc. + * + * Generated from protobuf field repeated .google.cloud.channel.v1.Parameter parameters = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * Extended parameters, such as: + * purchase_order_number, gcp_details; + * internal_correlation_id, long_running_operation_id, order_id; + * etc. + * + * Generated from protobuf field repeated .google.cloud.channel.v1.Parameter parameters = 8; + * @param array<\Google\Cloud\Channel\V1\Parameter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Channel\V1\Parameter::class); + $this->parameters = $arr; + + return $this; + } + + /** + * Human-readable identifier that shows what operator made a change. + * When the operator_type is RESELLER, this is the user's email address. + * For all other operator types, this is empty. + * + * Generated from protobuf field string operator = 12; + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Human-readable identifier that shows what operator made a change. + * When the operator_type is RESELLER, this is the user's email address. + * For all other operator types, this is empty. + * + * Generated from protobuf field string operator = 12; + * @param string $var + * @return $this + */ + public function setOperator($var) + { + GPBUtil::checkString($var, True); + $this->operator = $var; + + return $this; + } + + /** + * @return string + */ + public function getChangeReason() + { + return $this->whichOneof("change_reason"); + } + +} + diff --git a/Channel/src/V1/EntitlementChange/ActivationReason.php b/Channel/src/V1/EntitlementChange/ActivationReason.php new file mode 100644 index 00000000000..b384d8b8812 --- /dev/null +++ b/Channel/src/V1/EntitlementChange/ActivationReason.php @@ -0,0 +1,79 @@ +google.cloud.channel.v1.EntitlementChange.ActivationReason + */ +class ActivationReason +{ + /** + * Not used. + * + * Generated from protobuf enum ACTIVATION_REASON_UNSPECIFIED = 0; + */ + const ACTIVATION_REASON_UNSPECIFIED = 0; + /** + * Reseller reactivated a suspended Entitlement. + * + * Generated from protobuf enum RESELLER_REVOKED_SUSPENSION = 1; + */ + const RESELLER_REVOKED_SUSPENSION = 1; + /** + * Customer accepted pending terms of service. + * + * Generated from protobuf enum CUSTOMER_ACCEPTED_PENDING_TOS = 2; + */ + const CUSTOMER_ACCEPTED_PENDING_TOS = 2; + /** + * Reseller updated the renewal settings on an entitlement that was + * suspended due to cancellation, and this update reactivated the + * entitlement. + * + * Generated from protobuf enum RENEWAL_SETTINGS_CHANGED = 3; + */ + const RENEWAL_SETTINGS_CHANGED = 3; + /** + * Other reasons (Activated temporarily for cancellation, added a payment + * plan to a trial entitlement, etc.) + * + * Generated from protobuf enum OTHER_ACTIVATION_REASON = 100; + */ + const OTHER_ACTIVATION_REASON = 100; + + private static $valueToName = [ + self::ACTIVATION_REASON_UNSPECIFIED => 'ACTIVATION_REASON_UNSPECIFIED', + self::RESELLER_REVOKED_SUSPENSION => 'RESELLER_REVOKED_SUSPENSION', + self::CUSTOMER_ACCEPTED_PENDING_TOS => 'CUSTOMER_ACCEPTED_PENDING_TOS', + self::RENEWAL_SETTINGS_CHANGED => 'RENEWAL_SETTINGS_CHANGED', + self::OTHER_ACTIVATION_REASON => 'OTHER_ACTIVATION_REASON', + ]; + + 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/Channel/src/V1/EntitlementChange/CancellationReason.php b/Channel/src/V1/EntitlementChange/CancellationReason.php new file mode 100644 index 00000000000..b8bcdec6ab2 --- /dev/null +++ b/Channel/src/V1/EntitlementChange/CancellationReason.php @@ -0,0 +1,71 @@ +google.cloud.channel.v1.EntitlementChange.CancellationReason + */ +class CancellationReason +{ + /** + * Not used. + * + * Generated from protobuf enum CANCELLATION_REASON_UNSPECIFIED = 0; + */ + const CANCELLATION_REASON_UNSPECIFIED = 0; + /** + * Reseller triggered a cancellation of the service. + * + * Generated from protobuf enum SERVICE_TERMINATED = 1; + */ + const SERVICE_TERMINATED = 1; + /** + * Relationship between the reseller and customer has ended due to a + * transfer. + * + * Generated from protobuf enum RELATIONSHIP_ENDED = 2; + */ + const RELATIONSHIP_ENDED = 2; + /** + * Entitlement transferred away from reseller while still keeping other + * entitlement(s) with the reseller. + * + * Generated from protobuf enum PARTIAL_TRANSFER = 3; + */ + const PARTIAL_TRANSFER = 3; + + private static $valueToName = [ + self::CANCELLATION_REASON_UNSPECIFIED => 'CANCELLATION_REASON_UNSPECIFIED', + self::SERVICE_TERMINATED => 'SERVICE_TERMINATED', + self::RELATIONSHIP_ENDED => 'RELATIONSHIP_ENDED', + self::PARTIAL_TRANSFER => 'PARTIAL_TRANSFER', + ]; + + 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/Channel/src/V1/EntitlementChange/ChangeType.php b/Channel/src/V1/EntitlementChange/ChangeType.php new file mode 100644 index 00000000000..585ad13a30d --- /dev/null +++ b/Channel/src/V1/EntitlementChange/ChangeType.php @@ -0,0 +1,149 @@ +google.cloud.channel.v1.EntitlementChange.ChangeType + */ +class ChangeType +{ + /** + * Not used. + * + * Generated from protobuf enum CHANGE_TYPE_UNSPECIFIED = 0; + */ + const CHANGE_TYPE_UNSPECIFIED = 0; + /** + * New Entitlement was created. + * + * Generated from protobuf enum CREATED = 1; + */ + const CREATED = 1; + /** + * Price plan associated with an Entitlement was changed. + * + * Generated from protobuf enum PRICE_PLAN_SWITCHED = 3; + */ + const PRICE_PLAN_SWITCHED = 3; + /** + * Number of seats committed for a commitment Entitlement was changed. + * + * Generated from protobuf enum COMMITMENT_CHANGED = 4; + */ + const COMMITMENT_CHANGED = 4; + /** + * An annual Entitlement was renewed. + * + * Generated from protobuf enum RENEWED = 5; + */ + const RENEWED = 5; + /** + * Entitlement was suspended. + * + * Generated from protobuf enum SUSPENDED = 6; + */ + const SUSPENDED = 6; + /** + * Entitlement was activated. + * + * Generated from protobuf enum ACTIVATED = 7; + */ + const ACTIVATED = 7; + /** + * Entitlement was cancelled. + * + * Generated from protobuf enum CANCELLED = 8; + */ + const CANCELLED = 8; + /** + * Entitlement was upgraded or downgraded for ex. from Google Workspace + * Business Standard to Google Workspace Business Plus. + * + * Generated from protobuf enum SKU_CHANGED = 9; + */ + const SKU_CHANGED = 9; + /** + * The settings for renewal of an Entitlement have changed. + * + * Generated from protobuf enum RENEWAL_SETTING_CHANGED = 10; + */ + const RENEWAL_SETTING_CHANGED = 10; + /** + * Use for Google Workspace subscription. + * Either a trial was converted to a paid subscription or a new subscription + * with no trial is created. + * + * Generated from protobuf enum PAID_SUBSCRIPTION_STARTED = 11; + */ + const PAID_SUBSCRIPTION_STARTED = 11; + /** + * License cap was changed for the entitlement. + * + * Generated from protobuf enum LICENSE_CAP_CHANGED = 12; + */ + const LICENSE_CAP_CHANGED = 12; + /** + * The suspension details have changed (but it is still suspended). + * + * Generated from protobuf enum SUSPENSION_DETAILS_CHANGED = 13; + */ + const SUSPENSION_DETAILS_CHANGED = 13; + /** + * The trial end date was extended. + * + * Generated from protobuf enum TRIAL_END_DATE_EXTENDED = 14; + */ + const TRIAL_END_DATE_EXTENDED = 14; + /** + * Entitlement started trial. + * + * Generated from protobuf enum TRIAL_STARTED = 15; + */ + const TRIAL_STARTED = 15; + + private static $valueToName = [ + self::CHANGE_TYPE_UNSPECIFIED => 'CHANGE_TYPE_UNSPECIFIED', + self::CREATED => 'CREATED', + self::PRICE_PLAN_SWITCHED => 'PRICE_PLAN_SWITCHED', + self::COMMITMENT_CHANGED => 'COMMITMENT_CHANGED', + self::RENEWED => 'RENEWED', + self::SUSPENDED => 'SUSPENDED', + self::ACTIVATED => 'ACTIVATED', + self::CANCELLED => 'CANCELLED', + self::SKU_CHANGED => 'SKU_CHANGED', + self::RENEWAL_SETTING_CHANGED => 'RENEWAL_SETTING_CHANGED', + self::PAID_SUBSCRIPTION_STARTED => 'PAID_SUBSCRIPTION_STARTED', + self::LICENSE_CAP_CHANGED => 'LICENSE_CAP_CHANGED', + self::SUSPENSION_DETAILS_CHANGED => 'SUSPENSION_DETAILS_CHANGED', + self::TRIAL_END_DATE_EXTENDED => 'TRIAL_END_DATE_EXTENDED', + self::TRIAL_STARTED => 'TRIAL_STARTED', + ]; + + 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/Channel/src/V1/EntitlementChange/OperatorType.php b/Channel/src/V1/EntitlementChange/OperatorType.php new file mode 100644 index 00000000000..e19001867e5 --- /dev/null +++ b/Channel/src/V1/EntitlementChange/OperatorType.php @@ -0,0 +1,76 @@ +google.cloud.channel.v1.EntitlementChange.OperatorType + */ +class OperatorType +{ + /** + * Not used. + * + * Generated from protobuf enum OPERATOR_TYPE_UNSPECIFIED = 0; + */ + const OPERATOR_TYPE_UNSPECIFIED = 0; + /** + * Customer service representative. + * + * Generated from protobuf enum CUSTOMER_SERVICE_REPRESENTATIVE = 1; + */ + const CUSTOMER_SERVICE_REPRESENTATIVE = 1; + /** + * System auto job. + * + * Generated from protobuf enum SYSTEM = 2; + */ + const SYSTEM = 2; + /** + * Customer user. + * + * Generated from protobuf enum CUSTOMER = 3; + */ + const CUSTOMER = 3; + /** + * Reseller user. + * + * Generated from protobuf enum RESELLER = 4; + */ + const RESELLER = 4; + + private static $valueToName = [ + self::OPERATOR_TYPE_UNSPECIFIED => 'OPERATOR_TYPE_UNSPECIFIED', + self::CUSTOMER_SERVICE_REPRESENTATIVE => 'CUSTOMER_SERVICE_REPRESENTATIVE', + self::SYSTEM => 'SYSTEM', + self::CUSTOMER => 'CUSTOMER', + self::RESELLER => 'RESELLER', + ]; + + 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/Channel/src/V1/Gapic/CloudChannelServiceGapicClient.php b/Channel/src/V1/Gapic/CloudChannelServiceGapicClient.php index f3d121a7270..7a9937f0466 100644 --- a/Channel/src/V1/Gapic/CloudChannelServiceGapicClient.php +++ b/Channel/src/V1/Gapic/CloudChannelServiceGapicClient.php @@ -72,6 +72,8 @@ use Google\Cloud\Channel\V1\ListCustomerRepricingConfigsResponse; use Google\Cloud\Channel\V1\ListCustomersRequest; use Google\Cloud\Channel\V1\ListCustomersResponse; +use Google\Cloud\Channel\V1\ListEntitlementChangesRequest; +use Google\Cloud\Channel\V1\ListEntitlementChangesResponse; use Google\Cloud\Channel\V1\ListEntitlementsRequest; use Google\Cloud\Channel\V1\ListEntitlementsResponse; use Google\Cloud\Channel\V1\ListOffersRequest; @@ -2538,6 +2540,100 @@ public function listCustomers($parent, array $optionalArgs = []) return $this->getPagedListResponse('ListCustomers', $optionalArgs, ListCustomersResponse::class, $request); } + /** + * List entitlement history. + * + * Possible error codes: + * + * * PERMISSION_DENIED: The reseller account making the request and the + * provided reseller account are different. + * * INVALID_ARGUMENT: Missing or invalid required fields in the request. + * * NOT_FOUND: The parent resource doesn't exist. Usually the result of an + * invalid name parameter. + * * INTERNAL: Any non-user error related to a technical issue in the backend. + * In this case, contact CloudChannel support. + * * UNKNOWN: Any non-user error related to a technical issue in the backend. + * In this case, contact Cloud Channel support. + * + * Return value: + * List of [EntitlementChange][google.cloud.channel.v1.EntitlementChange]s. + * + * Sample code: + * ``` + * $cloudChannelServiceClient = new CloudChannelServiceClient(); + * try { + * $formattedParent = $cloudChannelServiceClient->entitlementName('[ACCOUNT]', '[CUSTOMER]', '[ENTITLEMENT]'); + * // Iterate over pages of elements + * $pagedResponse = $cloudChannelServiceClient->listEntitlementChanges($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $cloudChannelServiceClient->listEntitlementChanges($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $cloudChannelServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the entitlement for which to list + * entitlement changes. The `-` wildcard may be used to match entitlements + * across a customer. Formats: + * + * * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * * accounts/{account_id}/customers/{customer_id}/entitlements/- + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * Optional. Filters applied to the list results. + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listEntitlementChanges($parent, array $optionalArgs = []) + { + $request = new ListEntitlementChangesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListEntitlementChanges', $optionalArgs, ListEntitlementChangesResponse::class, $request); + } + /** * Lists [Entitlement][google.cloud.channel.v1.Entitlement]s belonging to a * customer. @@ -2672,6 +2768,11 @@ public function listEntitlements($parent, array $optionalArgs = []) * Optional. The BCP-47 language code. For example, "en-US". The * response will localize in the corresponding language code, if specified. * The default value is "en-US". + * @type bool $showFutureOffers + * Optional. A boolean flag that determines if a response returns future + * offers 30 days from now. If the show_future_offers is true, the response + * will only contain offers that are scheduled to be available 30 days from + * now. * @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 @@ -2704,6 +2805,10 @@ public function listOffers($parent, array $optionalArgs = []) $request->setLanguageCode($optionalArgs['languageCode']); } + if (isset($optionalArgs['showFutureOffers'])) { + $request->setShowFutureOffers($optionalArgs['showFutureOffers']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->getPagedListResponse('ListOffers', $optionalArgs, ListOffersResponse::class, $request); diff --git a/Channel/src/V1/ListEntitlementChangesRequest.php b/Channel/src/V1/ListEntitlementChangesRequest.php new file mode 100644 index 00000000000..fa367100401 --- /dev/null +++ b/Channel/src/V1/ListEntitlementChangesRequest.php @@ -0,0 +1,218 @@ +google.cloud.channel.v1.ListEntitlementChangesRequest + */ +class ListEntitlementChangesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the entitlement for which to list + * entitlement changes. The `-` wildcard may be used to match entitlements + * across a customer. Formats: + * * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * * accounts/{account_id}/customers/{customer_id}/entitlements/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Optional. The maximum number of entitlement changes to return. The service + * may return fewer than this value. If unspecified, returns at most 10 + * entitlement changes. The maximum value is 50; the server will coerce values + * above 50. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $page_size = 0; + /** + * Optional. A page token, received from a previous + * [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $page_token = ''; + /** + * Optional. Filters applied to the list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the entitlement for which to list + * entitlement changes. The `-` wildcard may be used to match entitlements + * across a customer. Formats: + * * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * * accounts/{account_id}/customers/{customer_id}/entitlements/- + * @type int $page_size + * Optional. The maximum number of entitlement changes to return. The service + * may return fewer than this value. If unspecified, returns at most 10 + * entitlement changes. The maximum value is 50; the server will coerce values + * above 50. + * @type string $page_token + * Optional. A page token, received from a previous + * [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + * must match the call that provided the page token. + * @type string $filter + * Optional. Filters applied to the list results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Channel\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the entitlement for which to list + * entitlement changes. The `-` wildcard may be used to match entitlements + * across a customer. Formats: + * * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * * accounts/{account_id}/customers/{customer_id}/entitlements/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the entitlement for which to list + * entitlement changes. The `-` wildcard may be used to match entitlements + * across a customer. Formats: + * * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} + * * accounts/{account_id}/customers/{customer_id}/entitlements/- + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of entitlement changes to return. The service + * may return fewer than this value. If unspecified, returns at most 10 + * entitlement changes. The maximum value is 50; the server will coerce values + * above 50. + * + * 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 entitlement changes to return. The service + * may return fewer than this value. If unspecified, returns at most 10 + * entitlement changes. The maximum value is 50; the server will coerce values + * above 50. + * + * 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 + * [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous + * [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + * call. Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * [CloudChannelService.ListEntitlementChanges][google.cloud.channel.v1.CloudChannelService.ListEntitlementChanges] + * must match the call that provided the page token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Filters applied to the list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filters applied to the list results. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/Channel/src/V1/ListEntitlementChangesResponse.php b/Channel/src/V1/ListEntitlementChangesResponse.php new file mode 100644 index 00000000000..cec453781bf --- /dev/null +++ b/Channel/src/V1/ListEntitlementChangesResponse.php @@ -0,0 +1,102 @@ +google.cloud.channel.v1.ListEntitlementChangesResponse + */ +class ListEntitlementChangesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of entitlement changes. + * + * Generated from protobuf field repeated .google.cloud.channel.v1.EntitlementChange entitlement_changes = 1; + */ + private $entitlement_changes; + /** + * A token to list the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Channel\V1\EntitlementChange>|\Google\Protobuf\Internal\RepeatedField $entitlement_changes + * The list of entitlement changes. + * @type string $next_page_token + * A token to list the next page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Channel\V1\Service::initOnce(); + parent::__construct($data); + } + + /** + * The list of entitlement changes. + * + * Generated from protobuf field repeated .google.cloud.channel.v1.EntitlementChange entitlement_changes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntitlementChanges() + { + return $this->entitlement_changes; + } + + /** + * The list of entitlement changes. + * + * Generated from protobuf field repeated .google.cloud.channel.v1.EntitlementChange entitlement_changes = 1; + * @param array<\Google\Cloud\Channel\V1\EntitlementChange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntitlementChanges($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Channel\V1\EntitlementChange::class); + $this->entitlement_changes = $arr; + + return $this; + } + + /** + * A token to list the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token to list the next page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/Channel/src/V1/ListOffersRequest.php b/Channel/src/V1/ListOffersRequest.php index c25a77e1a13..814f184b7dc 100644 --- a/Channel/src/V1/ListOffersRequest.php +++ b/Channel/src/V1/ListOffersRequest.php @@ -54,6 +54,15 @@ class ListOffersRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string language_code = 5 [(.google.api.field_behavior) = OPTIONAL]; */ private $language_code = ''; + /** + * Optional. A boolean flag that determines if a response returns future + * offers 30 days from now. If the show_future_offers is true, the response + * will only contain offers that are scheduled to be available 30 days from + * now. + * + * Generated from protobuf field bool show_future_offers = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $show_future_offers = false; /** * Constructor. @@ -80,6 +89,11 @@ class ListOffersRequest extends \Google\Protobuf\Internal\Message * Optional. The BCP-47 language code. For example, "en-US". The * response will localize in the corresponding language code, if specified. * The default value is "en-US". + * @type bool $show_future_offers + * Optional. A boolean flag that determines if a response returns future + * offers 30 days from now. If the show_future_offers is true, the response + * will only contain offers that are scheduled to be available 30 days from + * now. * } */ public function __construct($data = NULL) { @@ -235,5 +249,37 @@ public function setLanguageCode($var) return $this; } + /** + * Optional. A boolean flag that determines if a response returns future + * offers 30 days from now. If the show_future_offers is true, the response + * will only contain offers that are scheduled to be available 30 days from + * now. + * + * Generated from protobuf field bool show_future_offers = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getShowFutureOffers() + { + return $this->show_future_offers; + } + + /** + * Optional. A boolean flag that determines if a response returns future + * offers 30 days from now. If the show_future_offers is true, the response + * will only contain offers that are scheduled to be available 30 days from + * now. + * + * Generated from protobuf field bool show_future_offers = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setShowFutureOffers($var) + { + GPBUtil::checkBool($var); + $this->show_future_offers = $var; + + return $this; + } + } diff --git a/Channel/src/V1/gapic_metadata.json b/Channel/src/V1/gapic_metadata.json index 202b0d00018..7946f0fd5f5 100644 --- a/Channel/src/V1/gapic_metadata.json +++ b/Channel/src/V1/gapic_metadata.json @@ -154,6 +154,11 @@ "listCustomers" ] }, + "ListEntitlementChanges": { + "methods": [ + "listEntitlementChanges" + ] + }, "ListEntitlements": { "methods": [ "listEntitlements" diff --git a/Channel/src/V1/resources/cloud_channel_service_client_config.json b/Channel/src/V1/resources/cloud_channel_service_client_config.json index a84c698599e..8c1b8868cdf 100644 --- a/Channel/src/V1/resources/cloud_channel_service_client_config.json +++ b/Channel/src/V1/resources/cloud_channel_service_client_config.json @@ -158,6 +158,11 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "ListEntitlementChanges": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "ListEntitlements": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", diff --git a/Channel/src/V1/resources/cloud_channel_service_descriptor_config.php b/Channel/src/V1/resources/cloud_channel_service_descriptor_config.php index 323e54b58f7..04774451fbd 100644 --- a/Channel/src/V1/resources/cloud_channel_service_descriptor_config.php +++ b/Channel/src/V1/resources/cloud_channel_service_descriptor_config.php @@ -153,6 +153,16 @@ 'resourcesGetMethod' => 'getCustomers', ], ], + 'ListEntitlementChanges' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getEntitlementChanges', + ], + ], 'ListEntitlements' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', diff --git a/Channel/src/V1/resources/cloud_channel_service_rest_client_config.php b/Channel/src/V1/resources/cloud_channel_service_rest_client_config.php index 69003f2bbe7..94b7b90bbd8 100644 --- a/Channel/src/V1/resources/cloud_channel_service_rest_client_config.php +++ b/Channel/src/V1/resources/cloud_channel_service_rest_client_config.php @@ -311,6 +311,17 @@ ], ], ], + 'ListEntitlementChanges' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=accounts/*/customers/*/entitlements/*}:listEntitlementChanges', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'ListEntitlements' => [ 'method' => 'get', 'uriTemplate' => '/v1/{parent=accounts/*/customers/*}/entitlements', diff --git a/Channel/tests/Unit/V1/CloudChannelServiceClientTest.php b/Channel/tests/Unit/V1/CloudChannelServiceClientTest.php index d9c2a258f11..16108cac7f8 100644 --- a/Channel/tests/Unit/V1/CloudChannelServiceClientTest.php +++ b/Channel/tests/Unit/V1/CloudChannelServiceClientTest.php @@ -35,11 +35,13 @@ use Google\Cloud\Channel\V1\Customer; use Google\Cloud\Channel\V1\CustomerRepricingConfig; use Google\Cloud\Channel\V1\Entitlement; +use Google\Cloud\Channel\V1\EntitlementChange; use Google\Cloud\Channel\V1\ImportCustomerRequest\CustomerIdentityOneof; use Google\Cloud\Channel\V1\ListChannelPartnerLinksResponse; use Google\Cloud\Channel\V1\ListChannelPartnerRepricingConfigsResponse; use Google\Cloud\Channel\V1\ListCustomerRepricingConfigsResponse; use Google\Cloud\Channel\V1\ListCustomersResponse; +use Google\Cloud\Channel\V1\ListEntitlementChangesResponse; use Google\Cloud\Channel\V1\ListEntitlementsResponse; use Google\Cloud\Channel\V1\ListOffersResponse; use Google\Cloud\Channel\V1\ListProductsResponse; @@ -958,6 +960,7 @@ public function createCustomerTest() $cloudIdentityId = 'cloudIdentityId-466684622'; $languageCode = 'languageCode-412800396'; $channelPartnerId = 'channelPartnerId-1897289554'; + $correlationId = 'correlationId2055329016'; $expectedResponse = new Customer(); $expectedResponse->setName($name); $expectedResponse->setOrgDisplayName($orgDisplayName); @@ -966,6 +969,7 @@ public function createCustomerTest() $expectedResponse->setCloudIdentityId($cloudIdentityId); $expectedResponse->setLanguageCode($languageCode); $expectedResponse->setChannelPartnerId($channelPartnerId); + $expectedResponse->setCorrelationId($correlationId); $transport->addResponse($expectedResponse); // Mock request $parent = 'parent-995424086'; @@ -1554,6 +1558,7 @@ public function getCustomerTest() $cloudIdentityId = 'cloudIdentityId-466684622'; $languageCode = 'languageCode-412800396'; $channelPartnerId = 'channelPartnerId-1897289554'; + $correlationId = 'correlationId2055329016'; $expectedResponse = new Customer(); $expectedResponse->setName($name2); $expectedResponse->setOrgDisplayName($orgDisplayName); @@ -1562,6 +1567,7 @@ public function getCustomerTest() $expectedResponse->setCloudIdentityId($cloudIdentityId); $expectedResponse->setLanguageCode($languageCode); $expectedResponse->setChannelPartnerId($channelPartnerId); + $expectedResponse->setCorrelationId($correlationId); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->customerName('[ACCOUNT]', '[CUSTOMER]'); @@ -1750,6 +1756,7 @@ public function importCustomerTest() $cloudIdentityId = 'cloudIdentityId-466684622'; $languageCode = 'languageCode-412800396'; $channelPartnerId2 = 'channelPartnerId22065842401'; + $correlationId = 'correlationId2055329016'; $expectedResponse = new Customer(); $expectedResponse->setName($name); $expectedResponse->setOrgDisplayName($orgDisplayName); @@ -1758,6 +1765,7 @@ public function importCustomerTest() $expectedResponse->setCloudIdentityId($cloudIdentityId); $expectedResponse->setLanguageCode($languageCode); $expectedResponse->setChannelPartnerId($channelPartnerId2); + $expectedResponse->setCorrelationId($correlationId); $transport->addResponse($expectedResponse); // Mock request $customerIdentity = new CustomerIdentityOneof(); @@ -2088,6 +2096,74 @@ public function listCustomersExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function listEntitlementChangesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $entitlementChangesElement = new EntitlementChange(); + $entitlementChanges = [ + $entitlementChangesElement, + ]; + $expectedResponse = new ListEntitlementChangesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setEntitlementChanges($entitlementChanges); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->entitlementName('[ACCOUNT]', '[CUSTOMER]', '[ENTITLEMENT]'); + $response = $gapicClient->listEntitlementChanges($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getEntitlementChanges()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.channel.v1.CloudChannelService/ListEntitlementChanges', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEntitlementChangesExceptionTest() + { + $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 + $formattedParent = $gapicClient->entitlementName('[ACCOUNT]', '[CUSTOMER]', '[ENTITLEMENT]'); + try { + $gapicClient->listEntitlementChanges($formattedParent); + // 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 listEntitlementsTest() { @@ -2800,6 +2876,7 @@ public function provisionCloudIdentityTest() $cloudIdentityId = 'cloudIdentityId-466684622'; $languageCode = 'languageCode-412800396'; $channelPartnerId = 'channelPartnerId-1897289554'; + $correlationId = 'correlationId2055329016'; $expectedResponse = new Customer(); $expectedResponse->setName($name); $expectedResponse->setOrgDisplayName($orgDisplayName); @@ -2808,6 +2885,7 @@ public function provisionCloudIdentityTest() $expectedResponse->setCloudIdentityId($cloudIdentityId); $expectedResponse->setLanguageCode($languageCode); $expectedResponse->setChannelPartnerId($channelPartnerId); + $expectedResponse->setCorrelationId($correlationId); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -3693,6 +3771,7 @@ public function updateCustomerTest() $cloudIdentityId = 'cloudIdentityId-466684622'; $languageCode = 'languageCode-412800396'; $channelPartnerId = 'channelPartnerId-1897289554'; + $correlationId = 'correlationId2055329016'; $expectedResponse = new Customer(); $expectedResponse->setName($name); $expectedResponse->setOrgDisplayName($orgDisplayName); @@ -3701,6 +3780,7 @@ public function updateCustomerTest() $expectedResponse->setCloudIdentityId($cloudIdentityId); $expectedResponse->setLanguageCode($languageCode); $expectedResponse->setChannelPartnerId($channelPartnerId); + $expectedResponse->setCorrelationId($correlationId); $transport->addResponse($expectedResponse); // Mock request $customer = new Customer();