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\GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest;
21use Google\Service\Cloudchannel\GoogleCloudChannelV1CheckCloudIdentityAccountsExistResponse;
22use Google\Service\Cloudchannel\GoogleCloudChannelV1ListSubscribersResponse;
23use Google\Service\Cloudchannel\GoogleCloudChannelV1ListTransferableOffersRequest;
24use Google\Service\Cloudchannel\GoogleCloudChannelV1ListTransferableOffersResponse;
25use Google\Service\Cloudchannel\GoogleCloudChannelV1ListTransferableSkusRequest;
26use Google\Service\Cloudchannel\GoogleCloudChannelV1ListTransferableSkusResponse;
27use Google\Service\Cloudchannel\GoogleCloudChannelV1RegisterSubscriberRequest;
28use Google\Service\Cloudchannel\GoogleCloudChannelV1RegisterSubscriberResponse;
29use Google\Service\Cloudchannel\GoogleCloudChannelV1UnregisterSubscriberRequest;
30use Google\Service\Cloudchannel\GoogleCloudChannelV1UnregisterSubscriberResponse;
31
32/**
33 * The "accounts" collection of methods.
34 * Typical usage is:
35 *  <code>
36 *   $cloudchannelService = new Google\Service\Cloudchannel(...);
37 *   $accounts = $cloudchannelService->accounts;
38 *  </code>
39 */
40class Accounts extends \Google\Service\Resource
41{
42  /**
43   * Confirms the existence of Cloud Identity accounts based on the domain and if
44   * the Cloud Identity accounts are owned by the reseller. Possible error codes:
45   * * PERMISSION_DENIED: The reseller account making the request is different
46   * from the reseller account in the API request. * INVALID_ARGUMENT: Required
47   * request parameters are missing or invalid. * INVALID_VALUE: Invalid domain
48   * value in the request. Return value: A list of CloudIdentityCustomerAccount
49   * resources for the domain (may be empty) Note: in the v1alpha1 version of the
50   * API, a NOT_FOUND error returns if no CloudIdentityCustomerAccount resources
51   * match the domain. (accounts.checkCloudIdentityAccountsExist)
52   *
53   * @param string $parent Required. The reseller account's resource name. Parent
54   * uses the format: accounts/{account_id}
55   * @param GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest $postBody
56   * @param array $optParams Optional parameters.
57   * @return GoogleCloudChannelV1CheckCloudIdentityAccountsExistResponse
58   */
59  public function checkCloudIdentityAccountsExist($parent, GoogleCloudChannelV1CheckCloudIdentityAccountsExistRequest $postBody, $optParams = [])
60  {
61    $params = ['parent' => $parent, 'postBody' => $postBody];
62    $params = array_merge($params, $optParams);
63    return $this->call('checkCloudIdentityAccountsExist', [$params], GoogleCloudChannelV1CheckCloudIdentityAccountsExistResponse::class);
64  }
65  /**
66   * Lists service accounts with subscriber privileges on the Cloud Pub/Sub topic
67   * created for this Channel Services account. Possible error codes: *
68   * PERMISSION_DENIED: The reseller account making the request and the provided
69   * reseller account are different, or the impersonated user is not a super
70   * admin. * INVALID_ARGUMENT: Required request parameters are missing or
71   * invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-
72   * user error related to a technical issue in the backend. Contact Cloud Channel
73   * support. * UNKNOWN: Any non-user error related to a technical issue in the
74   * backend. Contact Cloud Channel support. Return value: A list of service email
75   * addresses. (accounts.listSubscribers)
76   *
77   * @param string $account Required. Resource name of the account.
78   * @param array $optParams Optional parameters.
79   *
80   * @opt_param int pageSize Optional. The maximum number of service accounts to
81   * return. The service may return fewer than this value. If unspecified, returns
82   * at most 100 service accounts. The maximum value is 1000; the server will
83   * coerce values above 1000.
84   * @opt_param string pageToken Optional. A page token, received from a previous
85   * `ListSubscribers` call. Provide this to retrieve the subsequent page. When
86   * paginating, all other parameters provided to `ListSubscribers` must match the
87   * call that provided the page token.
88   * @return GoogleCloudChannelV1ListSubscribersResponse
89   */
90  public function listSubscribers($account, $optParams = [])
91  {
92    $params = ['account' => $account];
93    $params = array_merge($params, $optParams);
94    return $this->call('listSubscribers', [$params], GoogleCloudChannelV1ListSubscribersResponse::class);
95  }
96  /**
97   * List TransferableOffers of a customer based on Cloud Identity ID or Customer
98   * Name in the request. Use this method when a reseller gets the entitlement
99   * information of an unowned customer. The reseller should provide the
100   * customer's Cloud Identity ID or Customer Name. Possible error codes: *
101   * PERMISSION_DENIED: * The customer doesn't belong to the reseller and has no
102   * auth token. * The supplied auth token is invalid. * The reseller account
103   * making the request is different from the reseller account in the query. *
104   * INVALID_ARGUMENT: Required request parameters are missing or invalid. Return
105   * value: List of TransferableOffer for the given customer and SKU.
106   * (accounts.listTransferableOffers)
107   *
108   * @param string $parent Required. The resource name of the reseller's account.
109   * @param GoogleCloudChannelV1ListTransferableOffersRequest $postBody
110   * @param array $optParams Optional parameters.
111   * @return GoogleCloudChannelV1ListTransferableOffersResponse
112   */
113  public function listTransferableOffers($parent, GoogleCloudChannelV1ListTransferableOffersRequest $postBody, $optParams = [])
114  {
115    $params = ['parent' => $parent, 'postBody' => $postBody];
116    $params = array_merge($params, $optParams);
117    return $this->call('listTransferableOffers', [$params], GoogleCloudChannelV1ListTransferableOffersResponse::class);
118  }
119  /**
120   * List TransferableSkus of a customer based on the Cloud Identity ID or
121   * Customer Name in the request. Use this method to list the entitlements
122   * information of an unowned customer. You should provide the customer's Cloud
123   * Identity ID or Customer Name. Possible error codes: * PERMISSION_DENIED: *
124   * The customer doesn't belong to the reseller and has no auth token. * The
125   * supplied auth token is invalid. * The reseller account making the request is
126   * different from the reseller account in the query. * INVALID_ARGUMENT:
127   * Required request parameters are missing or invalid. Return value: A list of
128   * the customer's TransferableSku. (accounts.listTransferableSkus)
129   *
130   * @param string $parent Required. The reseller account's resource name. Parent
131   * uses the format: accounts/{account_id}
132   * @param GoogleCloudChannelV1ListTransferableSkusRequest $postBody
133   * @param array $optParams Optional parameters.
134   * @return GoogleCloudChannelV1ListTransferableSkusResponse
135   */
136  public function listTransferableSkus($parent, GoogleCloudChannelV1ListTransferableSkusRequest $postBody, $optParams = [])
137  {
138    $params = ['parent' => $parent, 'postBody' => $postBody];
139    $params = array_merge($params, $optParams);
140    return $this->call('listTransferableSkus', [$params], GoogleCloudChannelV1ListTransferableSkusResponse::class);
141  }
142  /**
143   * Registers a service account with subscriber privileges on the Cloud Pub/Sub
144   * topic for this Channel Services account. After you create a subscriber, you
145   * get the events through SubscriberEvent Possible error codes: *
146   * PERMISSION_DENIED: The reseller account making the request and the provided
147   * reseller account are different, or the impersonated user is not a super
148   * admin. * INVALID_ARGUMENT: Required request parameters are missing or
149   * invalid. * INTERNAL: Any non-user error related to a technical issue in the
150   * backend. Contact Cloud Channel support. * UNKNOWN: Any non-user error related
151   * to a technical issue in the backend. Contact Cloud Channel support. Return
152   * value: The topic name with the registered service email address.
153   * (accounts.register)
154   *
155   * @param string $account Required. Resource name of the account.
156   * @param GoogleCloudChannelV1RegisterSubscriberRequest $postBody
157   * @param array $optParams Optional parameters.
158   * @return GoogleCloudChannelV1RegisterSubscriberResponse
159   */
160  public function register($account, GoogleCloudChannelV1RegisterSubscriberRequest $postBody, $optParams = [])
161  {
162    $params = ['account' => $account, 'postBody' => $postBody];
163    $params = array_merge($params, $optParams);
164    return $this->call('register', [$params], GoogleCloudChannelV1RegisterSubscriberResponse::class);
165  }
166  /**
167   * Unregisters a service account with subscriber privileges on the Cloud Pub/Sub
168   * topic created for this Channel Services account. If there are no service
169   * accounts left with subscriber privileges, this deletes the topic. You can
170   * call ListSubscribers to check for these accounts. Possible error codes: *
171   * PERMISSION_DENIED: The reseller account making the request and the provided
172   * reseller account are different, or the impersonated user is not a super
173   * admin. * INVALID_ARGUMENT: Required request parameters are missing or
174   * invalid. * NOT_FOUND: The topic resource doesn't exist. * INTERNAL: Any non-
175   * user error related to a technical issue in the backend. Contact Cloud Channel
176   * support. * UNKNOWN: Any non-user error related to a technical issue in the
177   * backend. Contact Cloud Channel support. Return value: The topic name that
178   * unregistered the service email address. Returns a success response if the
179   * service email address wasn't registered with the topic. (accounts.unregister)
180   *
181   * @param string $account Required. Resource name of the account.
182   * @param GoogleCloudChannelV1UnregisterSubscriberRequest $postBody
183   * @param array $optParams Optional parameters.
184   * @return GoogleCloudChannelV1UnregisterSubscriberResponse
185   */
186  public function unregister($account, GoogleCloudChannelV1UnregisterSubscriberRequest $postBody, $optParams = [])
187  {
188    $params = ['account' => $account, 'postBody' => $postBody];
189    $params = array_merge($params, $optParams);
190    return $this->call('unregister', [$params], GoogleCloudChannelV1UnregisterSubscriberResponse::class);
191  }
192}
193
194// Adding a class alias for backwards compatibility with the previous class name.
195class_alias(Accounts::class, 'Google_Service_Cloudchannel_Resource_Accounts');
196