1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service\Cloudchannel\Resource; 19 20use Google\Service\Cloudchannel\GoogleCloudChannelV1ActivateEntitlementRequest; 21use Google\Service\Cloudchannel\GoogleCloudChannelV1CancelEntitlementRequest; 22use Google\Service\Cloudchannel\GoogleCloudChannelV1ChangeOfferRequest; 23use Google\Service\Cloudchannel\GoogleCloudChannelV1ChangeParametersRequest; 24use Google\Service\Cloudchannel\GoogleCloudChannelV1ChangeRenewalSettingsRequest; 25use Google\Service\Cloudchannel\GoogleCloudChannelV1CreateEntitlementRequest; 26use Google\Service\Cloudchannel\GoogleCloudChannelV1Entitlement; 27use Google\Service\Cloudchannel\GoogleCloudChannelV1ListEntitlementsResponse; 28use Google\Service\Cloudchannel\GoogleCloudChannelV1Offer; 29use Google\Service\Cloudchannel\GoogleCloudChannelV1StartPaidServiceRequest; 30use Google\Service\Cloudchannel\GoogleCloudChannelV1SuspendEntitlementRequest; 31use Google\Service\Cloudchannel\GoogleLongrunningOperation; 32 33/** 34 * The "entitlements" collection of methods. 35 * Typical usage is: 36 * <code> 37 * $cloudchannelService = new Google\Service\Cloudchannel(...); 38 * $entitlements = $cloudchannelService->entitlements; 39 * </code> 40 */ 41class AccountsCustomersEntitlements extends \Google\Service\Resource 42{ 43 /** 44 * Activates a previously suspended entitlement. Entitlements suspended for 45 * pending ToS acceptance can't be activated using this method. An entitlement 46 * activation is a long-running operation and it updates the state of the 47 * customer entitlement. Possible error codes: * PERMISSION_DENIED: The reseller 48 * account making the request is different from the reseller account in the API 49 * request. * INVALID_ARGUMENT: Required request parameters are missing or 50 * invalid. * NOT_FOUND: Entitlement resource not found. * 51 * SUSPENSION_NOT_RESELLER_INITIATED: Can only activate reseller-initiated 52 * suspensions and entitlements that have accepted the TOS. * NOT_SUSPENDED: Can 53 * only activate suspended entitlements not in an ACTIVE state. * INTERNAL: Any 54 * non-user error related to a technical issue in the backend. Contact Cloud 55 * Channel support. * UNKNOWN: Any non-user error related to a technical issue 56 * in the backend. Contact Cloud Channel support. Return value: The ID of a 57 * long-running operation. To get the results of the operation, call the 58 * GetOperation method of CloudChannelOperationsService. The Operation metadata 59 * will contain an instance of OperationMetadata. (entitlements.activate) 60 * 61 * @param string $name Required. The resource name of the entitlement to 62 * activate. Name uses the format: 63 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 64 * @param GoogleCloudChannelV1ActivateEntitlementRequest $postBody 65 * @param array $optParams Optional parameters. 66 * @return GoogleLongrunningOperation 67 */ 68 public function activate($name, GoogleCloudChannelV1ActivateEntitlementRequest $postBody, $optParams = []) 69 { 70 $params = ['name' => $name, 'postBody' => $postBody]; 71 $params = array_merge($params, $optParams); 72 return $this->call('activate', [$params], GoogleLongrunningOperation::class); 73 } 74 /** 75 * Cancels a previously fulfilled entitlement. An entitlement cancellation is a 76 * long-running operation. Possible error codes: * PERMISSION_DENIED: The 77 * reseller account making the request is different from the reseller account in 78 * the API request. * FAILED_PRECONDITION: There are Google Cloud projects 79 * linked to the Google Cloud entitlement's Cloud Billing subaccount. * 80 * INVALID_ARGUMENT: Required request parameters are missing or invalid. * 81 * NOT_FOUND: Entitlement resource not found. * DELETION_TYPE_NOT_ALLOWED: 82 * Cancel is only allowed for Google Workspace add-ons, or entitlements for 83 * Google Cloud's development platform. * INTERNAL: Any non-user error related 84 * to a technical issue in the backend. Contact Cloud Channel support. * 85 * UNKNOWN: Any non-user error related to a technical issue in the backend. 86 * Contact Cloud Channel support. Return value: The ID of a long-running 87 * operation. To get the results of the operation, call the GetOperation method 88 * of CloudChannelOperationsService. The response will contain 89 * google.protobuf.Empty on success. The Operation metadata will contain an 90 * instance of OperationMetadata. (entitlements.cancel) 91 * 92 * @param string $name Required. The resource name of the entitlement to cancel. 93 * Name uses the format: 94 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 95 * @param GoogleCloudChannelV1CancelEntitlementRequest $postBody 96 * @param array $optParams Optional parameters. 97 * @return GoogleLongrunningOperation 98 */ 99 public function cancel($name, GoogleCloudChannelV1CancelEntitlementRequest $postBody, $optParams = []) 100 { 101 $params = ['name' => $name, 'postBody' => $postBody]; 102 $params = array_merge($params, $optParams); 103 return $this->call('cancel', [$params], GoogleLongrunningOperation::class); 104 } 105 /** 106 * Updates the Offer for an existing customer entitlement. An entitlement update 107 * is a long-running operation and it updates the entitlement as a result of 108 * fulfillment. Possible error codes: * PERMISSION_DENIED: The customer doesn't 109 * belong to the reseller. * INVALID_ARGUMENT: Required request parameters are 110 * missing or invalid. * NOT_FOUND: Offer or Entitlement resource not found. * 111 * INTERNAL: Any non-user error related to a technical issue in the backend. 112 * Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a 113 * technical issue in the backend. Contact Cloud Channel support. Return value: 114 * The ID of a long-running operation. To get the results of the operation, call 115 * the GetOperation method of CloudChannelOperationsService. The Operation 116 * metadata will contain an instance of OperationMetadata. 117 * (entitlements.changeOffer) 118 * 119 * @param string $name Required. The resource name of the entitlement to update. 120 * Name uses the format: 121 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 122 * @param GoogleCloudChannelV1ChangeOfferRequest $postBody 123 * @param array $optParams Optional parameters. 124 * @return GoogleLongrunningOperation 125 */ 126 public function changeOffer($name, GoogleCloudChannelV1ChangeOfferRequest $postBody, $optParams = []) 127 { 128 $params = ['name' => $name, 'postBody' => $postBody]; 129 $params = array_merge($params, $optParams); 130 return $this->call('changeOffer', [$params], GoogleLongrunningOperation::class); 131 } 132 /** 133 * Change parameters of the entitlement. An entitlement update is a long-running 134 * operation and it updates the entitlement as a result of fulfillment. Possible 135 * error codes: * PERMISSION_DENIED: The customer doesn't belong to the 136 * reseller. * INVALID_ARGUMENT: Required request parameters are missing or 137 * invalid. For example, the number of seats being changed is greater than the 138 * allowed number of max seats, or decreasing seats for a commitment based plan. 139 * * NOT_FOUND: Entitlement resource not found. * INTERNAL: Any non-user error 140 * related to a technical issue in the backend. Contact Cloud Channel support. * 141 * UNKNOWN: Any non-user error related to a technical issue in the backend. 142 * Contact Cloud Channel support. Return value: The ID of a long-running 143 * operation. To get the results of the operation, call the GetOperation method 144 * of CloudChannelOperationsService. The Operation metadata will contain an 145 * instance of OperationMetadata. (entitlements.changeParameters) 146 * 147 * @param string $name Required. The name of the entitlement to update. Name 148 * uses the format: 149 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 150 * @param GoogleCloudChannelV1ChangeParametersRequest $postBody 151 * @param array $optParams Optional parameters. 152 * @return GoogleLongrunningOperation 153 */ 154 public function changeParameters($name, GoogleCloudChannelV1ChangeParametersRequest $postBody, $optParams = []) 155 { 156 $params = ['name' => $name, 'postBody' => $postBody]; 157 $params = array_merge($params, $optParams); 158 return $this->call('changeParameters', [$params], GoogleLongrunningOperation::class); 159 } 160 /** 161 * Updates the renewal settings for an existing customer entitlement. An 162 * entitlement update is a long-running operation and it updates the entitlement 163 * as a result of fulfillment. Possible error codes: * PERMISSION_DENIED: The 164 * customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request 165 * parameters are missing or invalid. * NOT_FOUND: Entitlement resource not 166 * found. * NOT_COMMITMENT_PLAN: Renewal Settings are only applicable for a 167 * commitment plan. Can't enable or disable renewals for non-commitment plans. * 168 * INTERNAL: Any non-user error related to a technical issue in the backend. 169 * Contact Cloud Channel support. * UNKNOWN: Any non-user error related to a 170 * technical issue in the backend. Contact Cloud Channel support. Return value: 171 * The ID of a long-running operation. To get the results of the operation, call 172 * the GetOperation method of CloudChannelOperationsService. The Operation 173 * metadata will contain an instance of OperationMetadata. 174 * (entitlements.changeRenewalSettings) 175 * 176 * @param string $name Required. The name of the entitlement to update. Name 177 * uses the format: 178 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 179 * @param GoogleCloudChannelV1ChangeRenewalSettingsRequest $postBody 180 * @param array $optParams Optional parameters. 181 * @return GoogleLongrunningOperation 182 */ 183 public function changeRenewalSettings($name, GoogleCloudChannelV1ChangeRenewalSettingsRequest $postBody, $optParams = []) 184 { 185 $params = ['name' => $name, 'postBody' => $postBody]; 186 $params = array_merge($params, $optParams); 187 return $this->call('changeRenewalSettings', [$params], GoogleLongrunningOperation::class); 188 } 189 /** 190 * Creates an entitlement for a customer. Possible error codes: * 191 * PERMISSION_DENIED: The customer doesn't belong to the reseller. * 192 * INVALID_ARGUMENT: * Required request parameters are missing or invalid. * 193 * There is already a customer entitlement for a SKU from the same product 194 * family. * INVALID_VALUE: Make sure the OfferId is valid. If it is, contact 195 * Google Channel support for further troubleshooting. * NOT_FOUND: The customer 196 * or offer resource was not found. * ALREADY_EXISTS: * The SKU was already 197 * purchased for the customer. * The customer's primary email already exists. 198 * Retry after changing the customer's primary contact email. * 199 * CONDITION_NOT_MET or FAILED_PRECONDITION: * The domain required for 200 * purchasing a SKU has not been verified. * A pre-requisite SKU required to 201 * purchase an Add-On SKU is missing. For example, Google Workspace Business 202 * Starter is required to purchase Vault or Drive. * (Developer accounts only) 203 * Reseller and resold domain must meet the following naming requirements: * 204 * Domain names must start with goog-test. * Domain names must include the 205 * reseller domain. * INTERNAL: Any non-user error related to a technical issue 206 * in the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error 207 * related to a technical issue in the backend. Contact Cloud Channel support. 208 * Return value: The ID of a long-running operation. To get the results of the 209 * operation, call the GetOperation method of CloudChannelOperationsService. The 210 * Operation metadata will contain an instance of OperationMetadata. 211 * (entitlements.create) 212 * 213 * @param string $parent Required. The resource name of the reseller's customer 214 * account in which to create the entitlement. Parent uses the format: 215 * accounts/{account_id}/customers/{customer_id} 216 * @param GoogleCloudChannelV1CreateEntitlementRequest $postBody 217 * @param array $optParams Optional parameters. 218 * @return GoogleLongrunningOperation 219 */ 220 public function create($parent, GoogleCloudChannelV1CreateEntitlementRequest $postBody, $optParams = []) 221 { 222 $params = ['parent' => $parent, 'postBody' => $postBody]; 223 $params = array_merge($params, $optParams); 224 return $this->call('create', [$params], GoogleLongrunningOperation::class); 225 } 226 /** 227 * Returns the requested Entitlement resource. Possible error codes: * 228 * PERMISSION_DENIED: The customer doesn't belong to the reseller. * 229 * INVALID_ARGUMENT: Required request parameters are missing or invalid. * 230 * NOT_FOUND: The customer entitlement was not found. Return value: The 231 * requested Entitlement resource. (entitlements.get) 232 * 233 * @param string $name Required. The resource name of the entitlement to 234 * retrieve. Name uses the format: 235 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 236 * @param array $optParams Optional parameters. 237 * @return GoogleCloudChannelV1Entitlement 238 */ 239 public function get($name, $optParams = []) 240 { 241 $params = ['name' => $name]; 242 $params = array_merge($params, $optParams); 243 return $this->call('get', [$params], GoogleCloudChannelV1Entitlement::class); 244 } 245 /** 246 * Lists Entitlements belonging to a customer. Possible error codes: * 247 * PERMISSION_DENIED: The customer doesn't belong to the reseller. * 248 * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return 249 * value: A list of the customer's Entitlements. 250 * (entitlements.listAccountsCustomersEntitlements) 251 * 252 * @param string $parent Required. The resource name of the reseller's customer 253 * account to list entitlements for. Parent uses the format: 254 * accounts/{account_id}/customers/{customer_id} 255 * @param array $optParams Optional parameters. 256 * 257 * @opt_param int pageSize Optional. Requested page size. Server might return 258 * fewer results than requested. If unspecified, return at most 50 entitlements. 259 * The maximum value is 100; the server will coerce values above 100. 260 * @opt_param string pageToken Optional. A token for a page of results other 261 * than the first page. Obtained using ListEntitlementsResponse.next_page_token 262 * of the previous CloudChannelService.ListEntitlements call. 263 * @return GoogleCloudChannelV1ListEntitlementsResponse 264 */ 265 public function listAccountsCustomersEntitlements($parent, $optParams = []) 266 { 267 $params = ['parent' => $parent]; 268 $params = array_merge($params, $optParams); 269 return $this->call('list', [$params], GoogleCloudChannelV1ListEntitlementsResponse::class); 270 } 271 /** 272 * Returns the requested Offer resource. Possible error codes: * 273 * PERMISSION_DENIED: The entitlement doesn't belong to the reseller. * 274 * INVALID_ARGUMENT: Required request parameters are missing or invalid. * 275 * NOT_FOUND: Entitlement or offer was not found. Return value: The Offer 276 * resource. (entitlements.lookupOffer) 277 * 278 * @param string $entitlement Required. The resource name of the entitlement to 279 * retrieve the Offer. Entitlement uses the format: 280 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 281 * @param array $optParams Optional parameters. 282 * @return GoogleCloudChannelV1Offer 283 */ 284 public function lookupOffer($entitlement, $optParams = []) 285 { 286 $params = ['entitlement' => $entitlement]; 287 $params = array_merge($params, $optParams); 288 return $this->call('lookupOffer', [$params], GoogleCloudChannelV1Offer::class); 289 } 290 /** 291 * Starts paid service for a trial entitlement. Starts paid service for a trial 292 * entitlement immediately. This method is only applicable if a plan is set up 293 * for a trial entitlement but has some trial days remaining. Possible error 294 * codes: * PERMISSION_DENIED: The customer doesn't belong to the reseller. * 295 * INVALID_ARGUMENT: Required request parameters are missing or invalid. * 296 * NOT_FOUND: Entitlement resource not found. * 297 * FAILED_PRECONDITION/NOT_IN_TRIAL: This method only works for entitlement on 298 * trial plans. * INTERNAL: Any non-user error related to a technical issue in 299 * the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error 300 * related to a technical issue in the backend. Contact Cloud Channel support. 301 * Return value: The ID of a long-running operation. To get the results of the 302 * operation, call the GetOperation method of CloudChannelOperationsService. The 303 * Operation metadata will contain an instance of OperationMetadata. 304 * (entitlements.startPaidService) 305 * 306 * @param string $name Required. The name of the entitlement to start a paid 307 * service for. Name uses the format: 308 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 309 * @param GoogleCloudChannelV1StartPaidServiceRequest $postBody 310 * @param array $optParams Optional parameters. 311 * @return GoogleLongrunningOperation 312 */ 313 public function startPaidService($name, GoogleCloudChannelV1StartPaidServiceRequest $postBody, $optParams = []) 314 { 315 $params = ['name' => $name, 'postBody' => $postBody]; 316 $params = array_merge($params, $optParams); 317 return $this->call('startPaidService', [$params], GoogleLongrunningOperation::class); 318 } 319 /** 320 * Suspends a previously fulfilled entitlement. An entitlement suspension is a 321 * long-running operation. Possible error codes: * PERMISSION_DENIED: The 322 * customer doesn't belong to the reseller. * INVALID_ARGUMENT: Required request 323 * parameters are missing or invalid. * NOT_FOUND: Entitlement resource not 324 * found. * NOT_ACTIVE: Entitlement is not active. * INTERNAL: Any non-user 325 * error related to a technical issue in the backend. Contact Cloud Channel 326 * support. * UNKNOWN: Any non-user error related to a technical issue in the 327 * backend. Contact Cloud Channel support. Return value: The ID of a long- 328 * running operation. To get the results of the operation, call the GetOperation 329 * method of CloudChannelOperationsService. The Operation metadata will contain 330 * an instance of OperationMetadata. (entitlements.suspend) 331 * 332 * @param string $name Required. The resource name of the entitlement to 333 * suspend. Name uses the format: 334 * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id} 335 * @param GoogleCloudChannelV1SuspendEntitlementRequest $postBody 336 * @param array $optParams Optional parameters. 337 * @return GoogleLongrunningOperation 338 */ 339 public function suspend($name, GoogleCloudChannelV1SuspendEntitlementRequest $postBody, $optParams = []) 340 { 341 $params = ['name' => $name, 'postBody' => $postBody]; 342 $params = array_merge($params, $optParams); 343 return $this->call('suspend', [$params], GoogleLongrunningOperation::class); 344 } 345} 346 347// Adding a class alias for backwards compatibility with the previous class name. 348class_alias(AccountsCustomersEntitlements::class, 'Google_Service_Cloudchannel_Resource_AccountsCustomersEntitlements'); 349