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\Connectors\Resource;
19
20use Google\Service\Connectors\Connection;
21use Google\Service\Connectors\ConnectionSchemaMetadata;
22use Google\Service\Connectors\ListConnectionsResponse;
23use Google\Service\Connectors\Operation;
24use Google\Service\Connectors\Policy;
25use Google\Service\Connectors\SetIamPolicyRequest;
26use Google\Service\Connectors\TestIamPermissionsRequest;
27use Google\Service\Connectors\TestIamPermissionsResponse;
28
29/**
30 * The "connections" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $connectorsService = new Google\Service\Connectors(...);
34 *   $connections = $connectorsService->connections;
35 *  </code>
36 */
37class ProjectsLocationsConnections extends \Google\Service\Resource
38{
39  /**
40   * Creates a new Connection in a given project and location.
41   * (connections.create)
42   *
43   * @param string $parent Required. Parent resource of the Connection, of the
44   * form: `projects/locations`
45   * @param Connection $postBody
46   * @param array $optParams Optional parameters.
47   *
48   * @opt_param string connectionId Required. Identifier to assign to the
49   * Connection. Must be unique within scope of the parent resource.
50   * @return Operation
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], Operation::class);
57  }
58  /**
59   * Deletes a single Connection. (connections.delete)
60   *
61   * @param string $name Required. Resource name of the form:
62   * `projects/locations/connections`
63   * @param array $optParams Optional parameters.
64   * @return Operation
65   */
66  public function delete($name, $optParams = [])
67  {
68    $params = ['name' => $name];
69    $params = array_merge($params, $optParams);
70    return $this->call('delete', [$params], Operation::class);
71  }
72  /**
73   * Gets details of a single Connection. (connections.get)
74   *
75   * @param string $name Required. Resource name of the form:
76   * `projects/locations/connections`
77   * @param array $optParams Optional parameters.
78   *
79   * @opt_param string view Specifies which fields of the Connection are returned
80   * in the response. Defaults to `BASIC` view.
81   * @return Connection
82   */
83  public function get($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('get', [$params], Connection::class);
88  }
89  /**
90   * Gets schema metadata of a connection. SchemaMetadata is a singleton resource
91   * for each connection. (connections.getConnectionSchemaMetadata)
92   *
93   * @param string $name Required. Connection name Format: projects/{project}/loca
94   * tions/{location}/connections/{connection}/connectionSchemaMetadata
95   * @param array $optParams Optional parameters.
96   * @return ConnectionSchemaMetadata
97   */
98  public function getConnectionSchemaMetadata($name, $optParams = [])
99  {
100    $params = ['name' => $name];
101    $params = array_merge($params, $optParams);
102    return $this->call('getConnectionSchemaMetadata', [$params], ConnectionSchemaMetadata::class);
103  }
104  /**
105   * Gets the access control policy for a resource. Returns an empty policy if the
106   * resource exists and does not have a policy set. (connections.getIamPolicy)
107   *
108   * @param string $resource REQUIRED: The resource for which the policy is being
109   * requested. See the operation documentation for the appropriate value for this
110   * field.
111   * @param array $optParams Optional parameters.
112   *
113   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
114   * version that will be used to format the policy. Valid values are 0, 1, and 3.
115   * Requests specifying an invalid value will be rejected. Requests for policies
116   * with any conditional role bindings must specify version 3. Policies with no
117   * conditional role bindings may specify any valid value or leave the field
118   * unset. The policy in the response might use the policy version that you
119   * specified, or it might use a lower policy version. For example, if you
120   * specify version 3, but the policy has no conditional role bindings, the
121   * response uses version 1. To learn which resources support conditions in their
122   * IAM policies, see the [IAM
123   * documentation](https://cloud.google.com/iam/help/conditions/resource-
124   * policies).
125   * @return Policy
126   */
127  public function getIamPolicy($resource, $optParams = [])
128  {
129    $params = ['resource' => $resource];
130    $params = array_merge($params, $optParams);
131    return $this->call('getIamPolicy', [$params], Policy::class);
132  }
133  /**
134   * Lists Connections in a given project and location.
135   * (connections.listProjectsLocationsConnections)
136   *
137   * @param string $parent Required. Parent resource of the Connection, of the
138   * form: `projects/locations`
139   * @param array $optParams Optional parameters.
140   *
141   * @opt_param string filter Filter.
142   * @opt_param string orderBy Order by parameters.
143   * @opt_param int pageSize Page size.
144   * @opt_param string pageToken Page token.
145   * @opt_param string view Specifies which fields of the Connection are returned
146   * in the response. Defaults to `BASIC` view.
147   * @return ListConnectionsResponse
148   */
149  public function listProjectsLocationsConnections($parent, $optParams = [])
150  {
151    $params = ['parent' => $parent];
152    $params = array_merge($params, $optParams);
153    return $this->call('list', [$params], ListConnectionsResponse::class);
154  }
155  /**
156   * Updates the parameters of a single Connection. (connections.patch)
157   *
158   * @param string $name Output only. Resource name of the Connection. Format:
159   * projects/{project}/locations/{location}/connections/{connection}
160   * @param Connection $postBody
161   * @param array $optParams Optional parameters.
162   *
163   * @opt_param string updateMask Field mask is used to specify the fields to be
164   * overwritten in the Connection resource by the update. The fields specified in
165   * the update_mask are relative to the resource, not the full request. A field
166   * will be overwritten if it is in the mask. If the user does not provide a mask
167   * then all fields will be overwritten.
168   * @return Operation
169   */
170  public function patch($name, Connection $postBody, $optParams = [])
171  {
172    $params = ['name' => $name, 'postBody' => $postBody];
173    $params = array_merge($params, $optParams);
174    return $this->call('patch', [$params], Operation::class);
175  }
176  /**
177   * Sets the access control policy on the specified resource. Replaces any
178   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
179   * `PERMISSION_DENIED` errors. (connections.setIamPolicy)
180   *
181   * @param string $resource REQUIRED: The resource for which the policy is being
182   * specified. See the operation documentation for the appropriate value for this
183   * field.
184   * @param SetIamPolicyRequest $postBody
185   * @param array $optParams Optional parameters.
186   * @return Policy
187   */
188  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
189  {
190    $params = ['resource' => $resource, 'postBody' => $postBody];
191    $params = array_merge($params, $optParams);
192    return $this->call('setIamPolicy', [$params], Policy::class);
193  }
194  /**
195   * Returns permissions that a caller has on the specified resource. If the
196   * resource does not exist, this will return an empty set of permissions, not a
197   * `NOT_FOUND` error. Note: This operation is designed to be used for building
198   * permission-aware UIs and command-line tools, not for authorization checking.
199   * This operation may "fail open" without warning.
200   * (connections.testIamPermissions)
201   *
202   * @param string $resource REQUIRED: The resource for which the policy detail is
203   * being requested. See the operation documentation for the appropriate value
204   * for this field.
205   * @param TestIamPermissionsRequest $postBody
206   * @param array $optParams Optional parameters.
207   * @return TestIamPermissionsResponse
208   */
209  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
210  {
211    $params = ['resource' => $resource, 'postBody' => $postBody];
212    $params = array_merge($params, $optParams);
213    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
214  }
215}
216
217// Adding a class alias for backwards compatibility with the previous class name.
218class_alias(ProjectsLocationsConnections::class, 'Google_Service_Connectors_Resource_ProjectsLocationsConnections');
219