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\GoogleCloudChannelV1Customer;
21use Google\Service\Cloudchannel\GoogleCloudChannelV1ImportCustomerRequest;
22use Google\Service\Cloudchannel\GoogleCloudChannelV1ListCustomersResponse;
23use Google\Service\Cloudchannel\GoogleCloudChannelV1ListPurchasableOffersResponse;
24use Google\Service\Cloudchannel\GoogleCloudChannelV1ListPurchasableSkusResponse;
25use Google\Service\Cloudchannel\GoogleCloudChannelV1ProvisionCloudIdentityRequest;
26use Google\Service\Cloudchannel\GoogleCloudChannelV1TransferEntitlementsRequest;
27use Google\Service\Cloudchannel\GoogleCloudChannelV1TransferEntitlementsToGoogleRequest;
28use Google\Service\Cloudchannel\GoogleLongrunningOperation;
29use Google\Service\Cloudchannel\GoogleProtobufEmpty;
30
31/**
32 * The "customers" collection of methods.
33 * Typical usage is:
34 *  <code>
35 *   $cloudchannelService = new Google\Service\Cloudchannel(...);
36 *   $customers = $cloudchannelService->customers;
37 *  </code>
38 */
39class AccountsCustomers extends \Google\Service\Resource
40{
41  /**
42   * Creates a new Customer resource under the reseller or distributor account.
43   * Possible error codes: * PERMISSION_DENIED: The reseller account making the
44   * request is different from the reseller account in the API request. *
45   * INVALID_ARGUMENT: * Required request parameters are missing or invalid. *
46   * Domain field value doesn't match the primary email domain. Return value: The
47   * newly created Customer resource. (customers.create)
48   *
49   * @param string $parent Required. The resource name of reseller account in
50   * which to create the customer. Parent uses the format: accounts/{account_id}
51   * @param GoogleCloudChannelV1Customer $postBody
52   * @param array $optParams Optional parameters.
53   * @return GoogleCloudChannelV1Customer
54   */
55  public function create($parent, GoogleCloudChannelV1Customer $postBody, $optParams = [])
56  {
57    $params = ['parent' => $parent, 'postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('create', [$params], GoogleCloudChannelV1Customer::class);
60  }
61  /**
62   * Deletes the given Customer permanently. Possible error codes: *
63   * PERMISSION_DENIED: The account making the request does not own this customer.
64   * * INVALID_ARGUMENT: Required request parameters are missing or invalid. *
65   * FAILED_PRECONDITION: The customer has existing entitlements. * NOT_FOUND: No
66   * Customer resource found for the name in the request. (customers.delete)
67   *
68   * @param string $name Required. The resource name of the customer to delete.
69   * @param array $optParams Optional parameters.
70   * @return GoogleProtobufEmpty
71   */
72  public function delete($name, $optParams = [])
73  {
74    $params = ['name' => $name];
75    $params = array_merge($params, $optParams);
76    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
77  }
78  /**
79   * Returns the requested Customer resource. Possible error codes: *
80   * PERMISSION_DENIED: The reseller account making the request is different from
81   * the reseller account in the API request. * INVALID_ARGUMENT: Required request
82   * parameters are missing or invalid. * NOT_FOUND: The customer resource doesn't
83   * exist. Usually the result of an invalid name parameter. Return value: The
84   * Customer resource. (customers.get)
85   *
86   * @param string $name Required. The resource name of the customer to retrieve.
87   * Name uses the format: accounts/{account_id}/customers/{customer_id}
88   * @param array $optParams Optional parameters.
89   * @return GoogleCloudChannelV1Customer
90   */
91  public function get($name, $optParams = [])
92  {
93    $params = ['name' => $name];
94    $params = array_merge($params, $optParams);
95    return $this->call('get', [$params], GoogleCloudChannelV1Customer::class);
96  }
97  /**
98   * Imports a Customer from the Cloud Identity associated with the provided Cloud
99   * Identity ID or domain before a TransferEntitlements call. If a linked
100   * Customer already exists and overwrite_if_exists is true, it will update that
101   * Customer's data. Possible error codes: * PERMISSION_DENIED: The reseller
102   * account making the request is different from the reseller account in the API
103   * request. * NOT_FOUND: Cloud Identity doesn't exist or was deleted. *
104   * INVALID_ARGUMENT: Required parameters are missing, or the auth_token is
105   * expired or invalid. * ALREADY_EXISTS: A customer already exists and has
106   * conflicting critical fields. Requires an overwrite. Return value: The
107   * Customer. (customers.import)
108   *
109   * @param string $parent Required. The resource name of the reseller's account.
110   * Parent takes the format: accounts/{account_id} or
111   * accounts/{account_id}/channelPartnerLinks/{channel_partner_id}
112   * @param GoogleCloudChannelV1ImportCustomerRequest $postBody
113   * @param array $optParams Optional parameters.
114   * @return GoogleCloudChannelV1Customer
115   */
116  public function import($parent, GoogleCloudChannelV1ImportCustomerRequest $postBody, $optParams = [])
117  {
118    $params = ['parent' => $parent, 'postBody' => $postBody];
119    $params = array_merge($params, $optParams);
120    return $this->call('import', [$params], GoogleCloudChannelV1Customer::class);
121  }
122  /**
123   * List Customers. Possible error codes: * PERMISSION_DENIED: The reseller
124   * account making the request is different from the reseller account in the API
125   * request. * INVALID_ARGUMENT: Required request parameters are missing or
126   * invalid. Return value: List of Customers, or an empty list if there are no
127   * customers. (customers.listAccountsCustomers)
128   *
129   * @param string $parent Required. The resource name of the reseller account to
130   * list customers from. Parent uses the format: accounts/{account_id}.
131   * @param array $optParams Optional parameters.
132   *
133   * @opt_param string filter Optional. Filters applied to the
134   * [CloudChannelService.ListCustomers] results. See
135   * https://cloud.google.com/channel/docs/concepts/google-cloud/filter-customers
136   * for more information.
137   * @opt_param int pageSize Optional. The maximum number of customers to return.
138   * The service may return fewer than this value. If unspecified, returns at most
139   * 10 customers. The maximum value is 50.
140   * @opt_param string pageToken Optional. A token identifying a page of results
141   * other than the first page. Obtained through
142   * ListCustomersResponse.next_page_token of the previous
143   * CloudChannelService.ListCustomers call.
144   * @return GoogleCloudChannelV1ListCustomersResponse
145   */
146  public function listAccountsCustomers($parent, $optParams = [])
147  {
148    $params = ['parent' => $parent];
149    $params = array_merge($params, $optParams);
150    return $this->call('list', [$params], GoogleCloudChannelV1ListCustomersResponse::class);
151  }
152  /**
153   * Lists the following: * Offers that you can purchase for a customer. * Offers
154   * that you can change for an entitlement. Possible error codes: *
155   * PERMISSION_DENIED: The customer doesn't belong to the reseller *
156   * INVALID_ARGUMENT: Required request parameters are missing or invalid.
157   * (customers.listPurchasableOffers)
158   *
159   * @param string $customer Required. The resource name of the customer to list
160   * Offers for. Format: accounts/{account_id}/customers/{customer_id}.
161   * @param array $optParams Optional parameters.
162   *
163   * @opt_param string changeOfferPurchase.entitlement Required. Resource name of
164   * the entitlement. Format:
165   * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
166   * @opt_param string changeOfferPurchase.newSku Optional. Resource name of the
167   * new target SKU. Provide this SKU when upgrading or downgrading an
168   * entitlement. Format: products/{product_id}/skus/{sku_id}
169   * @opt_param string createEntitlementPurchase.sku Required. SKU that the result
170   * should be restricted to. Format: products/{product_id}/skus/{sku_id}.
171   * @opt_param string languageCode Optional. The BCP-47 language code. For
172   * example, "en-US". The response will localize in the corresponding language
173   * code, if specified. The default value is "en-US".
174   * @opt_param int pageSize Optional. Requested page size. Server might return
175   * fewer results than requested. If unspecified, returns at most 100 Offers. The
176   * maximum value is 1000; the server will coerce values above 1000.
177   * @opt_param string pageToken Optional. A token for a page of results other
178   * than the first page.
179   * @return GoogleCloudChannelV1ListPurchasableOffersResponse
180   */
181  public function listPurchasableOffers($customer, $optParams = [])
182  {
183    $params = ['customer' => $customer];
184    $params = array_merge($params, $optParams);
185    return $this->call('listPurchasableOffers', [$params], GoogleCloudChannelV1ListPurchasableOffersResponse::class);
186  }
187  /**
188   * Lists the following: * SKUs that you can purchase for a customer * SKUs that
189   * you can upgrade or downgrade for an entitlement. Possible error codes: *
190   * PERMISSION_DENIED: The customer doesn't belong to the reseller. *
191   * INVALID_ARGUMENT: Required request parameters are missing or invalid.
192   * (customers.listPurchasableSkus)
193   *
194   * @param string $customer Required. The resource name of the customer to list
195   * SKUs for. Format: accounts/{account_id}/customers/{customer_id}.
196   * @param array $optParams Optional parameters.
197   *
198   * @opt_param string changeOfferPurchase.changeType Required. Change Type for
199   * the entitlement.
200   * @opt_param string changeOfferPurchase.entitlement Required. Resource name of
201   * the entitlement. Format:
202   * accounts/{account_id}/customers/{customer_id}/entitlements/{entitlement_id}
203   * @opt_param string createEntitlementPurchase.product Required. List SKUs
204   * belonging to this Product. Format: products/{product_id}. Supports products/-
205   * to retrieve SKUs for all products.
206   * @opt_param string languageCode Optional. The BCP-47 language code. For
207   * example, "en-US". The response will localize in the corresponding language
208   * code, if specified. The default value is "en-US".
209   * @opt_param int pageSize Optional. Requested page size. Server might return
210   * fewer results than requested. If unspecified, returns at most 100 SKUs. The
211   * maximum value is 1000; the server will coerce values above 1000.
212   * @opt_param string pageToken Optional. A token for a page of results other
213   * than the first page.
214   * @return GoogleCloudChannelV1ListPurchasableSkusResponse
215   */
216  public function listPurchasableSkus($customer, $optParams = [])
217  {
218    $params = ['customer' => $customer];
219    $params = array_merge($params, $optParams);
220    return $this->call('listPurchasableSkus', [$params], GoogleCloudChannelV1ListPurchasableSkusResponse::class);
221  }
222  /**
223   * Updates an existing Customer resource for the reseller or distributor.
224   * Possible error codes: * PERMISSION_DENIED: The reseller account making the
225   * request is different from the reseller account in the API request. *
226   * INVALID_ARGUMENT: Required request parameters are missing or invalid. *
227   * NOT_FOUND: No Customer resource found for the name in the request. Return
228   * value: The updated Customer resource. (customers.patch)
229   *
230   * @param string $name Output only. Resource name of the customer. Format:
231   * accounts/{account_id}/customers/{customer_id}
232   * @param GoogleCloudChannelV1Customer $postBody
233   * @param array $optParams Optional parameters.
234   *
235   * @opt_param string updateMask The update mask that applies to the resource.
236   * Optional.
237   * @return GoogleCloudChannelV1Customer
238   */
239  public function patch($name, GoogleCloudChannelV1Customer $postBody, $optParams = [])
240  {
241    $params = ['name' => $name, 'postBody' => $postBody];
242    $params = array_merge($params, $optParams);
243    return $this->call('patch', [$params], GoogleCloudChannelV1Customer::class);
244  }
245  /**
246   * Creates a Cloud Identity for the given customer using the customer's
247   * information, or the information provided here. Possible error codes: *
248   * PERMISSION_DENIED: The customer doesn't belong to the reseller. *
249   * INVALID_ARGUMENT: Required request parameters are missing or invalid. *
250   * NOT_FOUND: The customer was not found. * ALREADY_EXISTS: The customer's
251   * primary email already exists. Retry after changing the customer's primary
252   * contact email. * INTERNAL: Any non-user error related to a technical issue in
253   * the backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error
254   * related to a technical issue in the backend. Contact Cloud Channel support.
255   * Return value: The ID of a long-running operation. To get the results of the
256   * operation, call the GetOperation method of CloudChannelOperationsService. The
257   * Operation metadata contains an instance of OperationMetadata.
258   * (customers.provisionCloudIdentity)
259   *
260   * @param string $customer Required. Resource name of the customer. Format:
261   * accounts/{account_id}/customers/{customer_id}
262   * @param GoogleCloudChannelV1ProvisionCloudIdentityRequest $postBody
263   * @param array $optParams Optional parameters.
264   * @return GoogleLongrunningOperation
265   */
266  public function provisionCloudIdentity($customer, GoogleCloudChannelV1ProvisionCloudIdentityRequest $postBody, $optParams = [])
267  {
268    $params = ['customer' => $customer, 'postBody' => $postBody];
269    $params = array_merge($params, $optParams);
270    return $this->call('provisionCloudIdentity', [$params], GoogleLongrunningOperation::class);
271  }
272  /**
273   * Transfers customer entitlements to new reseller. Possible error codes: *
274   * PERMISSION_DENIED: The customer doesn't belong to the reseller. *
275   * INVALID_ARGUMENT: Required request parameters are missing or invalid. *
276   * NOT_FOUND: The customer or offer resource was not found. * ALREADY_EXISTS:
277   * The SKU was already transferred for the customer. * CONDITION_NOT_MET or
278   * FAILED_PRECONDITION: * The SKU requires domain verification to transfer, but
279   * the domain is not verified. * An Add-On SKU (example, Vault or Drive) is
280   * missing the pre-requisite SKU (example, G Suite Basic). * (Developer accounts
281   * only) Reseller and resold domain must meet the following naming requirements:
282   * * Domain names must start with goog-test. * Domain names must include the
283   * reseller domain. * Specify all transferring entitlements. * INTERNAL: Any
284   * non-user error related to a technical issue in the backend. Contact Cloud
285   * Channel support. * UNKNOWN: Any non-user error related to a technical issue
286   * in the backend. Contact Cloud Channel support. Return value: The ID of a
287   * long-running operation. To get the results of the operation, call the
288   * GetOperation method of CloudChannelOperationsService. The Operation metadata
289   * will contain an instance of OperationMetadata.
290   * (customers.transferEntitlements)
291   *
292   * @param string $parent Required. The resource name of the reseller's customer
293   * account that will receive transferred entitlements. Parent uses the format:
294   * accounts/{account_id}/customers/{customer_id}
295   * @param GoogleCloudChannelV1TransferEntitlementsRequest $postBody
296   * @param array $optParams Optional parameters.
297   * @return GoogleLongrunningOperation
298   */
299  public function transferEntitlements($parent, GoogleCloudChannelV1TransferEntitlementsRequest $postBody, $optParams = [])
300  {
301    $params = ['parent' => $parent, 'postBody' => $postBody];
302    $params = array_merge($params, $optParams);
303    return $this->call('transferEntitlements', [$params], GoogleLongrunningOperation::class);
304  }
305  /**
306   * Transfers customer entitlements from their current reseller to Google.
307   * Possible error codes: * PERMISSION_DENIED: The customer doesn't belong to the
308   * reseller. * INVALID_ARGUMENT: Required request parameters are missing or
309   * invalid. * NOT_FOUND: The customer or offer resource was not found. *
310   * ALREADY_EXISTS: The SKU was already transferred for the customer. *
311   * CONDITION_NOT_MET or FAILED_PRECONDITION: * The SKU requires domain
312   * verification to transfer, but the domain is not verified. * An Add-On SKU
313   * (example, Vault or Drive) is missing the pre-requisite SKU (example, G Suite
314   * Basic). * (Developer accounts only) Reseller and resold domain must meet the
315   * following naming requirements: * Domain names must start with goog-test. *
316   * Domain names must include the reseller domain. * INTERNAL: Any non-user error
317   * related to a technical issue in the backend. Contact Cloud Channel support. *
318   * UNKNOWN: Any non-user error related to a technical issue in the backend.
319   * Contact Cloud Channel support. Return value: The ID of a long-running
320   * operation. To get the results of the operation, call the GetOperation method
321   * of CloudChannelOperationsService. The response will contain
322   * google.protobuf.Empty on success. The Operation metadata will contain an
323   * instance of OperationMetadata. (customers.transferEntitlementsToGoogle)
324   *
325   * @param string $parent Required. The resource name of the reseller's customer
326   * account where the entitlements transfer from. Parent uses the format:
327   * accounts/{account_id}/customers/{customer_id}
328   * @param GoogleCloudChannelV1TransferEntitlementsToGoogleRequest $postBody
329   * @param array $optParams Optional parameters.
330   * @return GoogleLongrunningOperation
331   */
332  public function transferEntitlementsToGoogle($parent, GoogleCloudChannelV1TransferEntitlementsToGoogleRequest $postBody, $optParams = [])
333  {
334    $params = ['parent' => $parent, 'postBody' => $postBody];
335    $params = array_merge($params, $optParams);
336    return $this->call('transferEntitlementsToGoogle', [$params], GoogleLongrunningOperation::class);
337  }
338}
339
340// Adding a class alias for backwards compatibility with the previous class name.
341class_alias(AccountsCustomers::class, 'Google_Service_Cloudchannel_Resource_AccountsCustomers');
342