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\Dataform\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Dataform\CommitRepositoryChangesRequest;
|
---|
21 | use Google\Service\Dataform\CommitRepositoryChangesResponse;
|
---|
22 | use Google\Service\Dataform\ComputeRepositoryAccessTokenStatusResponse;
|
---|
23 | use Google\Service\Dataform\DataformEmpty;
|
---|
24 | use Google\Service\Dataform\FetchRemoteBranchesResponse;
|
---|
25 | use Google\Service\Dataform\FetchRepositoryHistoryResponse;
|
---|
26 | use Google\Service\Dataform\ListRepositoriesResponse;
|
---|
27 | use Google\Service\Dataform\Policy;
|
---|
28 | use Google\Service\Dataform\QueryRepositoryDirectoryContentsResponse;
|
---|
29 | use Google\Service\Dataform\ReadRepositoryFileResponse;
|
---|
30 | use Google\Service\Dataform\Repository;
|
---|
31 | use Google\Service\Dataform\SetIamPolicyRequest;
|
---|
32 | use Google\Service\Dataform\TestIamPermissionsRequest;
|
---|
33 | use Google\Service\Dataform\TestIamPermissionsResponse;
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * The "repositories" collection of methods.
|
---|
37 | * Typical usage is:
|
---|
38 | * <code>
|
---|
39 | * $dataformService = new Google\Service\Dataform(...);
|
---|
40 | * $repositories = $dataformService->projects_locations_repositories;
|
---|
41 | * </code>
|
---|
42 | */
|
---|
43 | class ProjectsLocationsRepositories extends \Google\Service\Resource
|
---|
44 | {
|
---|
45 | /**
|
---|
46 | * Applies a Git commit to a Repository. The Repository must not have a value
|
---|
47 | * for `git_remote_settings.url`. (repositories.commit)
|
---|
48 | *
|
---|
49 | * @param string $name Required. The repository's name.
|
---|
50 | * @param CommitRepositoryChangesRequest $postBody
|
---|
51 | * @param array $optParams Optional parameters.
|
---|
52 | * @return CommitRepositoryChangesResponse
|
---|
53 | * @throws \Google\Service\Exception
|
---|
54 | */
|
---|
55 | public function commit($name, CommitRepositoryChangesRequest $postBody, $optParams = [])
|
---|
56 | {
|
---|
57 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
58 | $params = array_merge($params, $optParams);
|
---|
59 | return $this->call('commit', [$params], CommitRepositoryChangesResponse::class);
|
---|
60 | }
|
---|
61 | /**
|
---|
62 | * Computes a Repository's Git access token status.
|
---|
63 | * (repositories.computeAccessTokenStatus)
|
---|
64 | *
|
---|
65 | * @param string $name Required. The repository's name.
|
---|
66 | * @param array $optParams Optional parameters.
|
---|
67 | * @return ComputeRepositoryAccessTokenStatusResponse
|
---|
68 | * @throws \Google\Service\Exception
|
---|
69 | */
|
---|
70 | public function computeAccessTokenStatus($name, $optParams = [])
|
---|
71 | {
|
---|
72 | $params = ['name' => $name];
|
---|
73 | $params = array_merge($params, $optParams);
|
---|
74 | return $this->call('computeAccessTokenStatus', [$params], ComputeRepositoryAccessTokenStatusResponse::class);
|
---|
75 | }
|
---|
76 | /**
|
---|
77 | * Creates a new Repository in a given project and location.
|
---|
78 | * (repositories.create)
|
---|
79 | *
|
---|
80 | * @param string $parent Required. The location in which to create the
|
---|
81 | * repository. Must be in the format `projects/locations`.
|
---|
82 | * @param Repository $postBody
|
---|
83 | * @param array $optParams Optional parameters.
|
---|
84 | *
|
---|
85 | * @opt_param string repositoryId Required. The ID to use for the repository,
|
---|
86 | * which will become the final component of the repository's resource name.
|
---|
87 | * @return Repository
|
---|
88 | * @throws \Google\Service\Exception
|
---|
89 | */
|
---|
90 | public function create($parent, Repository $postBody, $optParams = [])
|
---|
91 | {
|
---|
92 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
93 | $params = array_merge($params, $optParams);
|
---|
94 | return $this->call('create', [$params], Repository::class);
|
---|
95 | }
|
---|
96 | /**
|
---|
97 | * Deletes a single Repository. (repositories.delete)
|
---|
98 | *
|
---|
99 | * @param string $name Required. The repository's name.
|
---|
100 | * @param array $optParams Optional parameters.
|
---|
101 | *
|
---|
102 | * @opt_param bool force If set to true, any child resources of this repository
|
---|
103 | * will also be deleted. (Otherwise, the request will only succeed if the
|
---|
104 | * repository has no child resources.)
|
---|
105 | * @return DataformEmpty
|
---|
106 | * @throws \Google\Service\Exception
|
---|
107 | */
|
---|
108 | public function delete($name, $optParams = [])
|
---|
109 | {
|
---|
110 | $params = ['name' => $name];
|
---|
111 | $params = array_merge($params, $optParams);
|
---|
112 | return $this->call('delete', [$params], DataformEmpty::class);
|
---|
113 | }
|
---|
114 | /**
|
---|
115 | * Fetches a Repository's history of commits. The Repository must not have a
|
---|
116 | * value for `git_remote_settings.url`. (repositories.fetchHistory)
|
---|
117 | *
|
---|
118 | * @param string $name Required. The repository's name.
|
---|
119 | * @param array $optParams Optional parameters.
|
---|
120 | *
|
---|
121 | * @opt_param int pageSize Optional. Maximum number of commits to return. The
|
---|
122 | * server may return fewer items than requested. If unspecified, the server will
|
---|
123 | * pick an appropriate default.
|
---|
124 | * @opt_param string pageToken Optional. Page token received from a previous
|
---|
125 | * `FetchRepositoryHistory` call. Provide this to retrieve the subsequent page.
|
---|
126 | * When paginating, all other parameters provided to `FetchRepositoryHistory`,
|
---|
127 | * with the exception of `page_size`, must match the call that provided the page
|
---|
128 | * token.
|
---|
129 | * @return FetchRepositoryHistoryResponse
|
---|
130 | * @throws \Google\Service\Exception
|
---|
131 | */
|
---|
132 | public function fetchHistory($name, $optParams = [])
|
---|
133 | {
|
---|
134 | $params = ['name' => $name];
|
---|
135 | $params = array_merge($params, $optParams);
|
---|
136 | return $this->call('fetchHistory', [$params], FetchRepositoryHistoryResponse::class);
|
---|
137 | }
|
---|
138 | /**
|
---|
139 | * Fetches a Repository's remote branches. (repositories.fetchRemoteBranches)
|
---|
140 | *
|
---|
141 | * @param string $name Required. The repository's name.
|
---|
142 | * @param array $optParams Optional parameters.
|
---|
143 | * @return FetchRemoteBranchesResponse
|
---|
144 | * @throws \Google\Service\Exception
|
---|
145 | */
|
---|
146 | public function fetchRemoteBranches($name, $optParams = [])
|
---|
147 | {
|
---|
148 | $params = ['name' => $name];
|
---|
149 | $params = array_merge($params, $optParams);
|
---|
150 | return $this->call('fetchRemoteBranches', [$params], FetchRemoteBranchesResponse::class);
|
---|
151 | }
|
---|
152 | /**
|
---|
153 | * Fetches a single Repository. (repositories.get)
|
---|
154 | *
|
---|
155 | * @param string $name Required. The repository's name.
|
---|
156 | * @param array $optParams Optional parameters.
|
---|
157 | * @return Repository
|
---|
158 | * @throws \Google\Service\Exception
|
---|
159 | */
|
---|
160 | public function get($name, $optParams = [])
|
---|
161 | {
|
---|
162 | $params = ['name' => $name];
|
---|
163 | $params = array_merge($params, $optParams);
|
---|
164 | return $this->call('get', [$params], Repository::class);
|
---|
165 | }
|
---|
166 | /**
|
---|
167 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
168 | * resource exists and does not have a policy set. (repositories.getIamPolicy)
|
---|
169 | *
|
---|
170 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
171 | * requested. See [Resource
|
---|
172 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
173 | * appropriate value for this field.
|
---|
174 | * @param array $optParams Optional parameters.
|
---|
175 | *
|
---|
176 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
177 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
178 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
179 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
180 | * conditional role bindings may specify any valid value or leave the field
|
---|
181 | * unset. The policy in the response might use the policy version that you
|
---|
182 | * specified, or it might use a lower policy version. For example, if you
|
---|
183 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
184 | * response uses version 1. To learn which resources support conditions in their
|
---|
185 | * IAM policies, see the [IAM
|
---|
186 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
187 | * policies).
|
---|
188 | * @return Policy
|
---|
189 | * @throws \Google\Service\Exception
|
---|
190 | */
|
---|
191 | public function getIamPolicy($resource, $optParams = [])
|
---|
192 | {
|
---|
193 | $params = ['resource' => $resource];
|
---|
194 | $params = array_merge($params, $optParams);
|
---|
195 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
196 | }
|
---|
197 | /**
|
---|
198 | * Lists Repositories in a given project and location.
|
---|
199 | * (repositories.listProjectsLocationsRepositories)
|
---|
200 | *
|
---|
201 | * @param string $parent Required. The location in which to list repositories.
|
---|
202 | * Must be in the format `projects/locations`.
|
---|
203 | * @param array $optParams Optional parameters.
|
---|
204 | *
|
---|
205 | * @opt_param string filter Optional. Filter for the returned list.
|
---|
206 | * @opt_param string orderBy Optional. This field only supports ordering by
|
---|
207 | * `name`. If unspecified, the server will choose the ordering. If specified,
|
---|
208 | * the default order is ascending for the `name` field.
|
---|
209 | * @opt_param int pageSize Optional. Maximum number of repositories to return.
|
---|
210 | * The server may return fewer items than requested. If unspecified, the server
|
---|
211 | * will pick an appropriate default.
|
---|
212 | * @opt_param string pageToken Optional. Page token received from a previous
|
---|
213 | * `ListRepositories` call. Provide this to retrieve the subsequent page. When
|
---|
214 | * paginating, all other parameters provided to `ListRepositories`, with the
|
---|
215 | * exception of `page_size`, must match the call that provided the page token.
|
---|
216 | * @return ListRepositoriesResponse
|
---|
217 | * @throws \Google\Service\Exception
|
---|
218 | */
|
---|
219 | public function listProjectsLocationsRepositories($parent, $optParams = [])
|
---|
220 | {
|
---|
221 | $params = ['parent' => $parent];
|
---|
222 | $params = array_merge($params, $optParams);
|
---|
223 | return $this->call('list', [$params], ListRepositoriesResponse::class);
|
---|
224 | }
|
---|
225 | /**
|
---|
226 | * Updates a single Repository. *Note:* This method does not fully implement
|
---|
227 | * AIP/134. In particular: 1. The wildcard entry (***) is treated as a bad
|
---|
228 | * request 2. When the *field_mask* is omitted, instead of only updating the set
|
---|
229 | * fields, the request is treated as a full update on all modifiable fields
|
---|
230 | * (repositories.patch)
|
---|
231 | *
|
---|
232 | * @param string $name Identifier. The repository's name.
|
---|
233 | * @param Repository $postBody
|
---|
234 | * @param array $optParams Optional parameters.
|
---|
235 | *
|
---|
236 | * @opt_param string updateMask Optional. Specifies the fields to be updated in
|
---|
237 | * the repository. If left unset, all fields will be updated.
|
---|
238 | * @return Repository
|
---|
239 | * @throws \Google\Service\Exception
|
---|
240 | */
|
---|
241 | public function patch($name, Repository $postBody, $optParams = [])
|
---|
242 | {
|
---|
243 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
244 | $params = array_merge($params, $optParams);
|
---|
245 | return $this->call('patch', [$params], Repository::class);
|
---|
246 | }
|
---|
247 | /**
|
---|
248 | * Returns the contents of a given Repository directory. The Repository must not
|
---|
249 | * have a value for `git_remote_settings.url`.
|
---|
250 | * (repositories.queryDirectoryContents)
|
---|
251 | *
|
---|
252 | * @param string $name Required. The repository's name.
|
---|
253 | * @param array $optParams Optional parameters.
|
---|
254 | *
|
---|
255 | * @opt_param string commitSha Optional. The Commit SHA for the commit to query
|
---|
256 | * from. If unset, the directory will be queried from HEAD.
|
---|
257 | * @opt_param int pageSize Optional. Maximum number of paths to return. The
|
---|
258 | * server may return fewer items than requested. If unspecified, the server will
|
---|
259 | * pick an appropriate default.
|
---|
260 | * @opt_param string pageToken Optional. Page token received from a previous
|
---|
261 | * `QueryRepositoryDirectoryContents` call. Provide this to retrieve the
|
---|
262 | * subsequent page. When paginating, all other parameters provided to
|
---|
263 | * `QueryRepositoryDirectoryContents`, with the exception of `page_size`, must
|
---|
264 | * match the call that provided the page token.
|
---|
265 | * @opt_param string path Optional. The directory's full path including
|
---|
266 | * directory name, relative to root. If left unset, the root is used.
|
---|
267 | * @return QueryRepositoryDirectoryContentsResponse
|
---|
268 | * @throws \Google\Service\Exception
|
---|
269 | */
|
---|
270 | public function queryDirectoryContents($name, $optParams = [])
|
---|
271 | {
|
---|
272 | $params = ['name' => $name];
|
---|
273 | $params = array_merge($params, $optParams);
|
---|
274 | return $this->call('queryDirectoryContents', [$params], QueryRepositoryDirectoryContentsResponse::class);
|
---|
275 | }
|
---|
276 | /**
|
---|
277 | * Returns the contents of a file (inside a Repository). The Repository must not
|
---|
278 | * have a value for `git_remote_settings.url`. (repositories.readFile)
|
---|
279 | *
|
---|
280 | * @param string $name Required. The repository's name.
|
---|
281 | * @param array $optParams Optional parameters.
|
---|
282 | *
|
---|
283 | * @opt_param string commitSha Optional. The commit SHA for the commit to read
|
---|
284 | * from. If unset, the file will be read from HEAD.
|
---|
285 | * @opt_param string path Required. Full file path to read including filename,
|
---|
286 | * from repository root.
|
---|
287 | * @return ReadRepositoryFileResponse
|
---|
288 | * @throws \Google\Service\Exception
|
---|
289 | */
|
---|
290 | public function readFile($name, $optParams = [])
|
---|
291 | {
|
---|
292 | $params = ['name' => $name];
|
---|
293 | $params = array_merge($params, $optParams);
|
---|
294 | return $this->call('readFile', [$params], ReadRepositoryFileResponse::class);
|
---|
295 | }
|
---|
296 | /**
|
---|
297 | * Sets the access control policy on the specified resource. Replaces any
|
---|
298 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
299 | * `PERMISSION_DENIED` errors. (repositories.setIamPolicy)
|
---|
300 | *
|
---|
301 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
302 | * specified. See [Resource
|
---|
303 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
304 | * appropriate value for this field.
|
---|
305 | * @param SetIamPolicyRequest $postBody
|
---|
306 | * @param array $optParams Optional parameters.
|
---|
307 | * @return Policy
|
---|
308 | * @throws \Google\Service\Exception
|
---|
309 | */
|
---|
310 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
311 | {
|
---|
312 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
313 | $params = array_merge($params, $optParams);
|
---|
314 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
315 | }
|
---|
316 | /**
|
---|
317 | * Returns permissions that a caller has on the specified resource. If the
|
---|
318 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
319 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
320 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
321 | * This operation may "fail open" without warning.
|
---|
322 | * (repositories.testIamPermissions)
|
---|
323 | *
|
---|
324 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
325 | * being requested. See [Resource
|
---|
326 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
327 | * appropriate value for this field.
|
---|
328 | * @param TestIamPermissionsRequest $postBody
|
---|
329 | * @param array $optParams Optional parameters.
|
---|
330 | * @return TestIamPermissionsResponse
|
---|
331 | * @throws \Google\Service\Exception
|
---|
332 | */
|
---|
333 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
334 | {
|
---|
335 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
336 | $params = array_merge($params, $optParams);
|
---|
337 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
338 | }
|
---|
339 | }
|
---|
340 |
|
---|
341 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
342 | class_alias(ProjectsLocationsRepositories::class, 'Google_Service_Dataform_Resource_ProjectsLocationsRepositories');
|
---|