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\GoogleProtobufEmpty;
24
25/**
26 * The "customers" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $cloudchannelService = new Google\Service\Cloudchannel(...);
30 *   $customers = $cloudchannelService->customers;
31 *  </code>
32 */
33class AccountsChannelPartnerLinksCustomers extends \Google\Service\Resource
34{
35  /**
36   * Creates a new Customer resource under the reseller or distributor account.
37   * Possible error codes: * PERMISSION_DENIED: The reseller account making the
38   * request is different from the reseller account in the API request. *
39   * INVALID_ARGUMENT: * Required request parameters are missing or invalid. *
40   * Domain field value doesn't match the primary email domain. Return value: The
41   * newly created Customer resource. (customers.create)
42   *
43   * @param string $parent Required. The resource name of reseller account in
44   * which to create the customer. Parent uses the format: accounts/{account_id}
45   * @param GoogleCloudChannelV1Customer $postBody
46   * @param array $optParams Optional parameters.
47   * @return GoogleCloudChannelV1Customer
48   */
49  public function create($parent, GoogleCloudChannelV1Customer $postBody, $optParams = [])
50  {
51    $params = ['parent' => $parent, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], GoogleCloudChannelV1Customer::class);
54  }
55  /**
56   * Deletes the given Customer permanently. Possible error codes: *
57   * PERMISSION_DENIED: The account making the request does not own this customer.
58   * * INVALID_ARGUMENT: Required request parameters are missing or invalid. *
59   * FAILED_PRECONDITION: The customer has existing entitlements. * NOT_FOUND: No
60   * Customer resource found for the name in the request. (customers.delete)
61   *
62   * @param string $name Required. The resource name of the customer to delete.
63   * @param array $optParams Optional parameters.
64   * @return GoogleProtobufEmpty
65   */
66  public function delete($name, $optParams = [])
67  {
68    $params = ['name' => $name];
69    $params = array_merge($params, $optParams);
70    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
71  }
72  /**
73   * Returns the requested Customer resource. Possible error codes: *
74   * PERMISSION_DENIED: The reseller account making the request is different from
75   * the reseller account in the API request. * INVALID_ARGUMENT: Required request
76   * parameters are missing or invalid. * NOT_FOUND: The customer resource doesn't
77   * exist. Usually the result of an invalid name parameter. Return value: The
78   * Customer resource. (customers.get)
79   *
80   * @param string $name Required. The resource name of the customer to retrieve.
81   * Name uses the format: accounts/{account_id}/customers/{customer_id}
82   * @param array $optParams Optional parameters.
83   * @return GoogleCloudChannelV1Customer
84   */
85  public function get($name, $optParams = [])
86  {
87    $params = ['name' => $name];
88    $params = array_merge($params, $optParams);
89    return $this->call('get', [$params], GoogleCloudChannelV1Customer::class);
90  }
91  /**
92   * Imports a Customer from the Cloud Identity associated with the provided Cloud
93   * Identity ID or domain before a TransferEntitlements call. If a linked
94   * Customer already exists and overwrite_if_exists is true, it will update that
95   * Customer's data. Possible error codes: * PERMISSION_DENIED: The reseller
96   * account making the request is different from the reseller account in the API
97   * request. * NOT_FOUND: Cloud Identity doesn't exist or was deleted. *
98   * INVALID_ARGUMENT: Required parameters are missing, or the auth_token is
99   * expired or invalid. * ALREADY_EXISTS: A customer already exists and has
100   * conflicting critical fields. Requires an overwrite. Return value: The
101   * Customer. (customers.import)
102   *
103   * @param string $parent Required. The resource name of the reseller's account.
104   * Parent takes the format: accounts/{account_id} or
105   * accounts/{account_id}/channelPartnerLinks/{channel_partner_id}
106   * @param GoogleCloudChannelV1ImportCustomerRequest $postBody
107   * @param array $optParams Optional parameters.
108   * @return GoogleCloudChannelV1Customer
109   */
110  public function import($parent, GoogleCloudChannelV1ImportCustomerRequest $postBody, $optParams = [])
111  {
112    $params = ['parent' => $parent, 'postBody' => $postBody];
113    $params = array_merge($params, $optParams);
114    return $this->call('import', [$params], GoogleCloudChannelV1Customer::class);
115  }
116  /**
117   * List Customers. Possible error codes: * PERMISSION_DENIED: The reseller
118   * account making the request is different from the reseller account in the API
119   * request. * INVALID_ARGUMENT: Required request parameters are missing or
120   * invalid. Return value: List of Customers, or an empty list if there are no
121   * customers. (customers.listAccountsChannelPartnerLinksCustomers)
122   *
123   * @param string $parent Required. The resource name of the reseller account to
124   * list customers from. Parent uses the format: accounts/{account_id}.
125   * @param array $optParams Optional parameters.
126   *
127   * @opt_param string filter Optional. Filters applied to the
128   * [CloudChannelService.ListCustomers] results. See
129   * https://cloud.google.com/channel/docs/concepts/google-cloud/filter-customers
130   * for more information.
131   * @opt_param int pageSize Optional. The maximum number of customers to return.
132   * The service may return fewer than this value. If unspecified, returns at most
133   * 10 customers. The maximum value is 50.
134   * @opt_param string pageToken Optional. A token identifying a page of results
135   * other than the first page. Obtained through
136   * ListCustomersResponse.next_page_token of the previous
137   * CloudChannelService.ListCustomers call.
138   * @return GoogleCloudChannelV1ListCustomersResponse
139   */
140  public function listAccountsChannelPartnerLinksCustomers($parent, $optParams = [])
141  {
142    $params = ['parent' => $parent];
143    $params = array_merge($params, $optParams);
144    return $this->call('list', [$params], GoogleCloudChannelV1ListCustomersResponse::class);
145  }
146  /**
147   * Updates an existing Customer resource for the reseller or distributor.
148   * Possible error codes: * PERMISSION_DENIED: The reseller account making the
149   * request is different from the reseller account in the API request. *
150   * INVALID_ARGUMENT: Required request parameters are missing or invalid. *
151   * NOT_FOUND: No Customer resource found for the name in the request. Return
152   * value: The updated Customer resource. (customers.patch)
153   *
154   * @param string $name Output only. Resource name of the customer. Format:
155   * accounts/{account_id}/customers/{customer_id}
156   * @param GoogleCloudChannelV1Customer $postBody
157   * @param array $optParams Optional parameters.
158   *
159   * @opt_param string updateMask The update mask that applies to the resource.
160   * Optional.
161   * @return GoogleCloudChannelV1Customer
162   */
163  public function patch($name, GoogleCloudChannelV1Customer $postBody, $optParams = [])
164  {
165    $params = ['name' => $name, 'postBody' => $postBody];
166    $params = array_merge($params, $optParams);
167    return $this->call('patch', [$params], GoogleCloudChannelV1Customer::class);
168  }
169}
170
171// Adding a class alias for backwards compatibility with the previous class name.
172class_alias(AccountsChannelPartnerLinksCustomers::class, 'Google_Service_Cloudchannel_Resource_AccountsChannelPartnerLinksCustomers');
173