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 |
|
---|
18 | namespace Google\Service\CloudBuild\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudBuild\CloudbuildEmpty;
|
---|
21 | use Google\Service\CloudBuild\Connection;
|
---|
22 | use Google\Service\CloudBuild\FetchLinkableRepositoriesResponse;
|
---|
23 | use Google\Service\CloudBuild\HttpBody;
|
---|
24 | use Google\Service\CloudBuild\ListConnectionsResponse;
|
---|
25 | use Google\Service\CloudBuild\Operation;
|
---|
26 | use Google\Service\CloudBuild\Policy;
|
---|
27 | use Google\Service\CloudBuild\SetIamPolicyRequest;
|
---|
28 | use Google\Service\CloudBuild\TestIamPermissionsRequest;
|
---|
29 | use Google\Service\CloudBuild\TestIamPermissionsResponse;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The "connections" collection of methods.
|
---|
33 | * Typical usage is:
|
---|
34 | * <code>
|
---|
35 | * $cloudbuildService = new Google\Service\CloudBuild(...);
|
---|
36 | * $connections = $cloudbuildService->projects_locations_connections;
|
---|
37 | * </code>
|
---|
38 | */
|
---|
39 | class ProjectsLocationsConnections extends \Google\Service\Resource
|
---|
40 | {
|
---|
41 | /**
|
---|
42 | * Creates a Connection. (connections.create)
|
---|
43 | *
|
---|
44 | * @param string $parent Required. Project and location where the connection
|
---|
45 | * will be created. Format: `projects/locations`.
|
---|
46 | * @param Connection $postBody
|
---|
47 | * @param array $optParams Optional parameters.
|
---|
48 | *
|
---|
49 | * @opt_param string connectionId Required. The ID to use for the Connection,
|
---|
50 | * which will become the final component of the Connection's resource name.
|
---|
51 | * Names must be unique per-project per-location. Allows alphanumeric characters
|
---|
52 | * and any of -._~%!$&'()*+,;=@.
|
---|
53 | * @return Operation
|
---|
54 | * @throws \Google\Service\Exception
|
---|
55 | */
|
---|
56 | public function create($parent, Connection $postBody, $optParams = [])
|
---|
57 | {
|
---|
58 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
59 | $params = array_merge($params, $optParams);
|
---|
60 | return $this->call('create', [$params], Operation::class);
|
---|
61 | }
|
---|
62 | /**
|
---|
63 | * Deletes a single connection. (connections.delete)
|
---|
64 | *
|
---|
65 | * @param string $name Required. The name of the Connection to delete. Format:
|
---|
66 | * `projects/locations/connections`.
|
---|
67 | * @param array $optParams Optional parameters.
|
---|
68 | *
|
---|
69 | * @opt_param string etag The current etag of the connection. If an etag is
|
---|
70 | * provided and does not match the current etag of the connection, deletion will
|
---|
71 | * be blocked and an ABORTED error will be returned.
|
---|
72 | * @opt_param bool validateOnly If set, validate the request, but do not
|
---|
73 | * actually post it.
|
---|
74 | * @return Operation
|
---|
75 | * @throws \Google\Service\Exception
|
---|
76 | */
|
---|
77 | public function delete($name, $optParams = [])
|
---|
78 | {
|
---|
79 | $params = ['name' => $name];
|
---|
80 | $params = array_merge($params, $optParams);
|
---|
81 | return $this->call('delete', [$params], Operation::class);
|
---|
82 | }
|
---|
83 | /**
|
---|
84 | * FetchLinkableRepositories get repositories from SCM that are accessible and
|
---|
85 | * could be added to the connection. (connections.fetchLinkableRepositories)
|
---|
86 | *
|
---|
87 | * @param string $connection Required. The name of the Connection. Format:
|
---|
88 | * `projects/locations/connections`.
|
---|
89 | * @param array $optParams Optional parameters.
|
---|
90 | *
|
---|
91 | * @opt_param int pageSize Number of results to return in the list. Default to
|
---|
92 | * 20.
|
---|
93 | * @opt_param string pageToken Page start.
|
---|
94 | * @return FetchLinkableRepositoriesResponse
|
---|
95 | * @throws \Google\Service\Exception
|
---|
96 | */
|
---|
97 | public function fetchLinkableRepositories($connection, $optParams = [])
|
---|
98 | {
|
---|
99 | $params = ['connection' => $connection];
|
---|
100 | $params = array_merge($params, $optParams);
|
---|
101 | return $this->call('fetchLinkableRepositories', [$params], FetchLinkableRepositoriesResponse::class);
|
---|
102 | }
|
---|
103 | /**
|
---|
104 | * Gets details of a single connection. (connections.get)
|
---|
105 | *
|
---|
106 | * @param string $name Required. The name of the Connection to retrieve. Format:
|
---|
107 | * `projects/locations/connections`.
|
---|
108 | * @param array $optParams Optional parameters.
|
---|
109 | * @return Connection
|
---|
110 | * @throws \Google\Service\Exception
|
---|
111 | */
|
---|
112 | public function get($name, $optParams = [])
|
---|
113 | {
|
---|
114 | $params = ['name' => $name];
|
---|
115 | $params = array_merge($params, $optParams);
|
---|
116 | return $this->call('get', [$params], Connection::class);
|
---|
117 | }
|
---|
118 | /**
|
---|
119 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
120 | * resource exists and does not have a policy set. (connections.getIamPolicy)
|
---|
121 | *
|
---|
122 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
123 | * requested. See [Resource
|
---|
124 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
125 | * appropriate value for this field.
|
---|
126 | * @param array $optParams Optional parameters.
|
---|
127 | *
|
---|
128 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
129 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
130 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
131 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
132 | * conditional role bindings may specify any valid value or leave the field
|
---|
133 | * unset. The policy in the response might use the policy version that you
|
---|
134 | * specified, or it might use a lower policy version. For example, if you
|
---|
135 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
136 | * response uses version 1. To learn which resources support conditions in their
|
---|
137 | * IAM policies, see the [IAM
|
---|
138 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
139 | * policies).
|
---|
140 | * @return Policy
|
---|
141 | * @throws \Google\Service\Exception
|
---|
142 | */
|
---|
143 | public function getIamPolicy($resource, $optParams = [])
|
---|
144 | {
|
---|
145 | $params = ['resource' => $resource];
|
---|
146 | $params = array_merge($params, $optParams);
|
---|
147 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
148 | }
|
---|
149 | /**
|
---|
150 | * Lists Connections in a given project and location.
|
---|
151 | * (connections.listProjectsLocationsConnections)
|
---|
152 | *
|
---|
153 | * @param string $parent Required. The parent, which owns this collection of
|
---|
154 | * Connections. Format: `projects/locations`.
|
---|
155 | * @param array $optParams Optional parameters.
|
---|
156 | *
|
---|
157 | * @opt_param int pageSize Number of results to return in the list.
|
---|
158 | * @opt_param string pageToken Page start.
|
---|
159 | * @return ListConnectionsResponse
|
---|
160 | * @throws \Google\Service\Exception
|
---|
161 | */
|
---|
162 | public function listProjectsLocationsConnections($parent, $optParams = [])
|
---|
163 | {
|
---|
164 | $params = ['parent' => $parent];
|
---|
165 | $params = array_merge($params, $optParams);
|
---|
166 | return $this->call('list', [$params], ListConnectionsResponse::class);
|
---|
167 | }
|
---|
168 | /**
|
---|
169 | * Updates a single connection. (connections.patch)
|
---|
170 | *
|
---|
171 | * @param string $name Immutable. The resource name of the connection, in the
|
---|
172 | * format `projects/{project}/locations/{location}/connections/{connection_id}`.
|
---|
173 | * @param Connection $postBody
|
---|
174 | * @param array $optParams Optional parameters.
|
---|
175 | *
|
---|
176 | * @opt_param bool allowMissing If set to true, and the connection is not found
|
---|
177 | * a new connection will be created. In this situation `update_mask` is ignored.
|
---|
178 | * The creation will succeed only if the input connection has all the necessary
|
---|
179 | * information (e.g a github_config with both user_oauth_token and
|
---|
180 | * installation_id properties).
|
---|
181 | * @opt_param string etag The current etag of the connection. If an etag is
|
---|
182 | * provided and does not match the current etag of the connection, update will
|
---|
183 | * be blocked and an ABORTED error will be returned.
|
---|
184 | * @opt_param string updateMask The list of fields to be updated.
|
---|
185 | * @return Operation
|
---|
186 | * @throws \Google\Service\Exception
|
---|
187 | */
|
---|
188 | public function patch($name, Connection $postBody, $optParams = [])
|
---|
189 | {
|
---|
190 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
191 | $params = array_merge($params, $optParams);
|
---|
192 | return $this->call('patch', [$params], Operation::class);
|
---|
193 | }
|
---|
194 | /**
|
---|
195 | * ProcessWebhook is called by the external SCM for notifying of events.
|
---|
196 | * (connections.processWebhook)
|
---|
197 | *
|
---|
198 | * @param string $parent Required. Project and location where the webhook will
|
---|
199 | * be received. Format: `projects/locations`.
|
---|
200 | * @param HttpBody $postBody
|
---|
201 | * @param array $optParams Optional parameters.
|
---|
202 | *
|
---|
203 | * @opt_param string webhookKey Arbitrary additional key to find the maching
|
---|
204 | * repository for a webhook event if needed.
|
---|
205 | * @return CloudbuildEmpty
|
---|
206 | * @throws \Google\Service\Exception
|
---|
207 | */
|
---|
208 | public function processWebhook($parent, HttpBody $postBody, $optParams = [])
|
---|
209 | {
|
---|
210 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
211 | $params = array_merge($params, $optParams);
|
---|
212 | return $this->call('processWebhook', [$params], CloudbuildEmpty::class);
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Sets the access control policy on the specified resource. Replaces any
|
---|
216 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
217 | * `PERMISSION_DENIED` errors. (connections.setIamPolicy)
|
---|
218 | *
|
---|
219 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
220 | * specified. See [Resource
|
---|
221 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
222 | * appropriate value for this field.
|
---|
223 | * @param SetIamPolicyRequest $postBody
|
---|
224 | * @param array $optParams Optional parameters.
|
---|
225 | * @return Policy
|
---|
226 | * @throws \Google\Service\Exception
|
---|
227 | */
|
---|
228 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
229 | {
|
---|
230 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
231 | $params = array_merge($params, $optParams);
|
---|
232 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
233 | }
|
---|
234 | /**
|
---|
235 | * Returns permissions that a caller has on the specified resource. If the
|
---|
236 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
237 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
238 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
239 | * This operation may "fail open" without warning.
|
---|
240 | * (connections.testIamPermissions)
|
---|
241 | *
|
---|
242 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
243 | * being requested. See [Resource
|
---|
244 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
245 | * appropriate value for this field.
|
---|
246 | * @param TestIamPermissionsRequest $postBody
|
---|
247 | * @param array $optParams Optional parameters.
|
---|
248 | * @return TestIamPermissionsResponse
|
---|
249 | * @throws \Google\Service\Exception
|
---|
250 | */
|
---|
251 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
252 | {
|
---|
253 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
254 | $params = array_merge($params, $optParams);
|
---|
255 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
256 | }
|
---|
257 | }
|
---|
258 |
|
---|
259 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
260 | class_alias(ProjectsLocationsConnections::class, 'Google_Service_CloudBuild_Resource_ProjectsLocationsConnections');
|
---|