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\CloudIot\Resource;
19
20use Google\Service\CloudIot\BindDeviceToGatewayRequest;
21use Google\Service\CloudIot\BindDeviceToGatewayResponse;
22use Google\Service\CloudIot\CloudiotEmpty;
23use Google\Service\CloudIot\DeviceRegistry;
24use Google\Service\CloudIot\GetIamPolicyRequest;
25use Google\Service\CloudIot\ListDeviceRegistriesResponse;
26use Google\Service\CloudIot\Policy;
27use Google\Service\CloudIot\SetIamPolicyRequest;
28use Google\Service\CloudIot\TestIamPermissionsRequest;
29use Google\Service\CloudIot\TestIamPermissionsResponse;
30use Google\Service\CloudIot\UnbindDeviceFromGatewayRequest;
31use Google\Service\CloudIot\UnbindDeviceFromGatewayResponse;
32
33/**
34 * The "registries" collection of methods.
35 * Typical usage is:
36 *  <code>
37 *   $cloudiotService = new Google\Service\CloudIot(...);
38 *   $registries = $cloudiotService->registries;
39 *  </code>
40 */
41class ProjectsLocationsRegistries extends \Google\Service\Resource
42{
43  /**
44   * Associates the device with the gateway. (registries.bindDeviceToGateway)
45   *
46   * @param string $parent Required. The name of the registry. For example,
47   * `projects/example-project/locations/us-central1/registries/my-registry`.
48   * @param BindDeviceToGatewayRequest $postBody
49   * @param array $optParams Optional parameters.
50   * @return BindDeviceToGatewayResponse
51   */
52  public function bindDeviceToGateway($parent, BindDeviceToGatewayRequest $postBody, $optParams = [])
53  {
54    $params = ['parent' => $parent, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('bindDeviceToGateway', [$params], BindDeviceToGatewayResponse::class);
57  }
58  /**
59   * Creates a device registry that contains devices. (registries.create)
60   *
61   * @param string $parent Required. The project and cloud region where this
62   * device registry must be created. For example, `projects/example-
63   * project/locations/us-central1`.
64   * @param DeviceRegistry $postBody
65   * @param array $optParams Optional parameters.
66   * @return DeviceRegistry
67   */
68  public function create($parent, DeviceRegistry $postBody, $optParams = [])
69  {
70    $params = ['parent' => $parent, 'postBody' => $postBody];
71    $params = array_merge($params, $optParams);
72    return $this->call('create', [$params], DeviceRegistry::class);
73  }
74  /**
75   * Deletes a device registry configuration. (registries.delete)
76   *
77   * @param string $name Required. The name of the device registry. For example,
78   * `projects/example-project/locations/us-central1/registries/my-registry`.
79   * @param array $optParams Optional parameters.
80   * @return CloudiotEmpty
81   */
82  public function delete($name, $optParams = [])
83  {
84    $params = ['name' => $name];
85    $params = array_merge($params, $optParams);
86    return $this->call('delete', [$params], CloudiotEmpty::class);
87  }
88  /**
89   * Gets a device registry configuration. (registries.get)
90   *
91   * @param string $name Required. The name of the device registry. For example,
92   * `projects/example-project/locations/us-central1/registries/my-registry`.
93   * @param array $optParams Optional parameters.
94   * @return DeviceRegistry
95   */
96  public function get($name, $optParams = [])
97  {
98    $params = ['name' => $name];
99    $params = array_merge($params, $optParams);
100    return $this->call('get', [$params], DeviceRegistry::class);
101  }
102  /**
103   * Gets the access control policy for a resource. Returns an empty policy if the
104   * resource exists and does not have a policy set. (registries.getIamPolicy)
105   *
106   * @param string $resource REQUIRED: The resource for which the policy is being
107   * requested. See the operation documentation for the appropriate value for this
108   * field.
109   * @param GetIamPolicyRequest $postBody
110   * @param array $optParams Optional parameters.
111   * @return Policy
112   */
113  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
114  {
115    $params = ['resource' => $resource, 'postBody' => $postBody];
116    $params = array_merge($params, $optParams);
117    return $this->call('getIamPolicy', [$params], Policy::class);
118  }
119  /**
120   * Lists device registries. (registries.listProjectsLocationsRegistries)
121   *
122   * @param string $parent Required. The project and cloud region path. For
123   * example, `projects/example-project/locations/us-central1`.
124   * @param array $optParams Optional parameters.
125   *
126   * @opt_param int pageSize The maximum number of registries to return in the
127   * response. If this value is zero, the service will select a default size. A
128   * call may return fewer objects than requested. A non-empty `next_page_token`
129   * in the response indicates that more data is available.
130   * @opt_param string pageToken The value returned by the last
131   * `ListDeviceRegistriesResponse`; indicates that this is a continuation of a
132   * prior `ListDeviceRegistries` call and the system should return the next page
133   * of data.
134   * @return ListDeviceRegistriesResponse
135   */
136  public function listProjectsLocationsRegistries($parent, $optParams = [])
137  {
138    $params = ['parent' => $parent];
139    $params = array_merge($params, $optParams);
140    return $this->call('list', [$params], ListDeviceRegistriesResponse::class);
141  }
142  /**
143   * Updates a device registry configuration. (registries.patch)
144   *
145   * @param string $name The resource path name. For example, `projects/example-
146   * project/locations/us-central1/registries/my-registry`.
147   * @param DeviceRegistry $postBody
148   * @param array $optParams Optional parameters.
149   *
150   * @opt_param string updateMask Required. Only updates the `device_registry`
151   * fields indicated by this mask. The field mask must not be empty, and it must
152   * not contain fields that are immutable or only set by the server. Mutable top-
153   * level fields: `event_notification_config`, `http_config`, `mqtt_config`, and
154   * `state_notification_config`.
155   * @return DeviceRegistry
156   */
157  public function patch($name, DeviceRegistry $postBody, $optParams = [])
158  {
159    $params = ['name' => $name, 'postBody' => $postBody];
160    $params = array_merge($params, $optParams);
161    return $this->call('patch', [$params], DeviceRegistry::class);
162  }
163  /**
164   * Sets the access control policy on the specified resource. Replaces any
165   * existing policy. (registries.setIamPolicy)
166   *
167   * @param string $resource REQUIRED: The resource for which the policy is being
168   * specified. See the operation documentation for the appropriate value for this
169   * field.
170   * @param SetIamPolicyRequest $postBody
171   * @param array $optParams Optional parameters.
172   * @return Policy
173   */
174  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
175  {
176    $params = ['resource' => $resource, 'postBody' => $postBody];
177    $params = array_merge($params, $optParams);
178    return $this->call('setIamPolicy', [$params], Policy::class);
179  }
180  /**
181   * Returns permissions that a caller has on the specified resource. If the
182   * resource does not exist, this will return an empty set of permissions, not a
183   * NOT_FOUND error. (registries.testIamPermissions)
184   *
185   * @param string $resource REQUIRED: The resource for which the policy detail is
186   * being requested. See the operation documentation for the appropriate value
187   * for this field.
188   * @param TestIamPermissionsRequest $postBody
189   * @param array $optParams Optional parameters.
190   * @return TestIamPermissionsResponse
191   */
192  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
193  {
194    $params = ['resource' => $resource, 'postBody' => $postBody];
195    $params = array_merge($params, $optParams);
196    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
197  }
198  /**
199   * Deletes the association between the device and the gateway.
200   * (registries.unbindDeviceFromGateway)
201   *
202   * @param string $parent Required. The name of the registry. For example,
203   * `projects/example-project/locations/us-central1/registries/my-registry`.
204   * @param UnbindDeviceFromGatewayRequest $postBody
205   * @param array $optParams Optional parameters.
206   * @return UnbindDeviceFromGatewayResponse
207   */
208  public function unbindDeviceFromGateway($parent, UnbindDeviceFromGatewayRequest $postBody, $optParams = [])
209  {
210    $params = ['parent' => $parent, 'postBody' => $postBody];
211    $params = array_merge($params, $optParams);
212    return $this->call('unbindDeviceFromGateway', [$params], UnbindDeviceFromGatewayResponse::class);
213  }
214}
215
216// Adding a class alias for backwards compatibility with the previous class name.
217class_alias(ProjectsLocationsRegistries::class, 'Google_Service_CloudIot_Resource_ProjectsLocationsRegistries');
218