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\BigQueryConnectionService\Resource;
19
20use Google\Service\BigQueryConnectionService\BigqueryconnectionEmpty;
21use Google\Service\BigQueryConnectionService\Connection;
22use Google\Service\BigQueryConnectionService\ConnectionCredential;
23use Google\Service\BigQueryConnectionService\GetIamPolicyRequest;
24use Google\Service\BigQueryConnectionService\ListConnectionsResponse;
25use Google\Service\BigQueryConnectionService\Policy;
26use Google\Service\BigQueryConnectionService\SetIamPolicyRequest;
27use Google\Service\BigQueryConnectionService\TestIamPermissionsRequest;
28use Google\Service\BigQueryConnectionService\TestIamPermissionsResponse;
29
30/**
31 * The "connections" collection of methods.
32 * Typical usage is:
33 *  <code>
34 *   $bigqueryconnectionService = new Google\Service\BigQueryConnectionService(...);
35 *   $connections = $bigqueryconnectionService->connections;
36 *  </code>
37 */
38class ProjectsLocationsConnections extends \Google\Service\Resource
39{
40  /**
41   * Creates a new connection. (connections.create)
42   *
43   * @param string $parent Required. Parent resource name. Must be in the format
44   * `projects/{project_id}/locations/{location_id}`
45   * @param Connection $postBody
46   * @param array $optParams Optional parameters.
47   *
48   * @opt_param string connectionId Optional. Connection id that should be
49   * assigned to the created connection.
50   * @return Connection
51   */
52  public function create($parent, Connection $postBody, $optParams = [])
53  {
54    $params = ['parent' => $parent, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('create', [$params], Connection::class);
57  }
58  /**
59   * Deletes connection and associated credential. (connections.delete)
60   *
61   * @param string $name Required. Name of the deleted connection, for example:
62   * `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
63   * @param array $optParams Optional parameters.
64   * @return BigqueryconnectionEmpty
65   */
66  public function delete($name, $optParams = [])
67  {
68    $params = ['name' => $name];
69    $params = array_merge($params, $optParams);
70    return $this->call('delete', [$params], BigqueryconnectionEmpty::class);
71  }
72  /**
73   * Returns specified connection. (connections.get)
74   *
75   * @param string $name Required. Name of the requested connection, for example:
76   * `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
77   * @param array $optParams Optional parameters.
78   * @return Connection
79   */
80  public function get($name, $optParams = [])
81  {
82    $params = ['name' => $name];
83    $params = array_merge($params, $optParams);
84    return $this->call('get', [$params], Connection::class);
85  }
86  /**
87   * Gets the access control policy for a resource. Returns an empty policy if the
88   * resource exists and does not have a policy set. (connections.getIamPolicy)
89   *
90   * @param string $resource REQUIRED: The resource for which the policy is being
91   * requested. See the operation documentation for the appropriate value for this
92   * field.
93   * @param GetIamPolicyRequest $postBody
94   * @param array $optParams Optional parameters.
95   * @return Policy
96   */
97  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
98  {
99    $params = ['resource' => $resource, 'postBody' => $postBody];
100    $params = array_merge($params, $optParams);
101    return $this->call('getIamPolicy', [$params], Policy::class);
102  }
103  /**
104   * Returns a list of connections in the given project.
105   * (connections.listProjectsLocationsConnections)
106   *
107   * @param string $parent Required. Parent resource name. Must be in the form:
108   * `projects/{project_id}/locations/{location_id}`
109   * @param array $optParams Optional parameters.
110   *
111   * @opt_param string maxResults Required. Maximum number of results per page.
112   * @opt_param string pageToken Page token.
113   * @return ListConnectionsResponse
114   */
115  public function listProjectsLocationsConnections($parent, $optParams = [])
116  {
117    $params = ['parent' => $parent];
118    $params = array_merge($params, $optParams);
119    return $this->call('list', [$params], ListConnectionsResponse::class);
120  }
121  /**
122   * Updates the specified connection. For security reasons, also resets
123   * credential if connection properties are in the update field mask.
124   * (connections.patch)
125   *
126   * @param string $name Required. Name of the connection to update, for example:
127   * `projects/{project_id}/locations/{location_id}/connections/{connection_id}`
128   * @param Connection $postBody
129   * @param array $optParams Optional parameters.
130   *
131   * @opt_param string updateMask Required. Update mask for the connection fields
132   * to be updated.
133   * @return Connection
134   */
135  public function patch($name, Connection $postBody, $optParams = [])
136  {
137    $params = ['name' => $name, 'postBody' => $postBody];
138    $params = array_merge($params, $optParams);
139    return $this->call('patch', [$params], Connection::class);
140  }
141  /**
142   * Sets the access control policy on the specified resource. Replaces any
143   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
144   * `PERMISSION_DENIED` errors. (connections.setIamPolicy)
145   *
146   * @param string $resource REQUIRED: The resource for which the policy is being
147   * specified. See the operation documentation for the appropriate value for this
148   * field.
149   * @param SetIamPolicyRequest $postBody
150   * @param array $optParams Optional parameters.
151   * @return Policy
152   */
153  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
154  {
155    $params = ['resource' => $resource, 'postBody' => $postBody];
156    $params = array_merge($params, $optParams);
157    return $this->call('setIamPolicy', [$params], Policy::class);
158  }
159  /**
160   * Returns permissions that a caller has on the specified resource. If the
161   * resource does not exist, this will return an empty set of permissions, not a
162   * `NOT_FOUND` error. Note: This operation is designed to be used for building
163   * permission-aware UIs and command-line tools, not for authorization checking.
164   * This operation may "fail open" without warning.
165   * (connections.testIamPermissions)
166   *
167   * @param string $resource REQUIRED: The resource for which the policy detail is
168   * being requested. See the operation documentation for the appropriate value
169   * for this field.
170   * @param TestIamPermissionsRequest $postBody
171   * @param array $optParams Optional parameters.
172   * @return TestIamPermissionsResponse
173   */
174  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
175  {
176    $params = ['resource' => $resource, 'postBody' => $postBody];
177    $params = array_merge($params, $optParams);
178    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
179  }
180  /**
181   * Sets the credential for the specified connection.
182   * (connections.updateCredential)
183   *
184   * @param string $name Required. Name of the connection, for example: `projects/
185   * {project_id}/locations/{location_id}/connections/{connection_id}/credential`
186   * @param ConnectionCredential $postBody
187   * @param array $optParams Optional parameters.
188   * @return BigqueryconnectionEmpty
189   */
190  public function updateCredential($name, ConnectionCredential $postBody, $optParams = [])
191  {
192    $params = ['name' => $name, 'postBody' => $postBody];
193    $params = array_merge($params, $optParams);
194    return $this->call('updateCredential', [$params], BigqueryconnectionEmpty::class);
195  }
196}
197
198// Adding a class alias for backwards compatibility with the previous class name.
199class_alias(ProjectsLocationsConnections::class, 'Google_Service_BigQueryConnectionService_Resource_ProjectsLocationsConnections');
200