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\BatchCreateRepositoriesRequest;
|
---|
21 | use Google\Service\CloudBuild\FetchGitRefsResponse;
|
---|
22 | use Google\Service\CloudBuild\FetchReadTokenRequest;
|
---|
23 | use Google\Service\CloudBuild\FetchReadTokenResponse;
|
---|
24 | use Google\Service\CloudBuild\FetchReadWriteTokenRequest;
|
---|
25 | use Google\Service\CloudBuild\FetchReadWriteTokenResponse;
|
---|
26 | use Google\Service\CloudBuild\ListRepositoriesResponse;
|
---|
27 | use Google\Service\CloudBuild\Operation;
|
---|
28 | use Google\Service\CloudBuild\Repository;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The "repositories" collection of methods.
|
---|
32 | * Typical usage is:
|
---|
33 | * <code>
|
---|
34 | * $cloudbuildService = new Google\Service\CloudBuild(...);
|
---|
35 | * $repositories = $cloudbuildService->projects_locations_connections_repositories;
|
---|
36 | * </code>
|
---|
37 | */
|
---|
38 | class ProjectsLocationsConnectionsRepositories extends \Google\Service\Resource
|
---|
39 | {
|
---|
40 | /**
|
---|
41 | * Fetches read token of a given repository. (repositories.accessReadToken)
|
---|
42 | *
|
---|
43 | * @param string $repository Required. The resource name of the repository in
|
---|
44 | * the format `projects/locations/connections/repositories`.
|
---|
45 | * @param FetchReadTokenRequest $postBody
|
---|
46 | * @param array $optParams Optional parameters.
|
---|
47 | * @return FetchReadTokenResponse
|
---|
48 | * @throws \Google\Service\Exception
|
---|
49 | */
|
---|
50 | public function accessReadToken($repository, FetchReadTokenRequest $postBody, $optParams = [])
|
---|
51 | {
|
---|
52 | $params = ['repository' => $repository, 'postBody' => $postBody];
|
---|
53 | $params = array_merge($params, $optParams);
|
---|
54 | return $this->call('accessReadToken', [$params], FetchReadTokenResponse::class);
|
---|
55 | }
|
---|
56 | /**
|
---|
57 | * Fetches read/write token of a given repository.
|
---|
58 | * (repositories.accessReadWriteToken)
|
---|
59 | *
|
---|
60 | * @param string $repository Required. The resource name of the repository in
|
---|
61 | * the format `projects/locations/connections/repositories`.
|
---|
62 | * @param FetchReadWriteTokenRequest $postBody
|
---|
63 | * @param array $optParams Optional parameters.
|
---|
64 | * @return FetchReadWriteTokenResponse
|
---|
65 | * @throws \Google\Service\Exception
|
---|
66 | */
|
---|
67 | public function accessReadWriteToken($repository, FetchReadWriteTokenRequest $postBody, $optParams = [])
|
---|
68 | {
|
---|
69 | $params = ['repository' => $repository, 'postBody' => $postBody];
|
---|
70 | $params = array_merge($params, $optParams);
|
---|
71 | return $this->call('accessReadWriteToken', [$params], FetchReadWriteTokenResponse::class);
|
---|
72 | }
|
---|
73 | /**
|
---|
74 | * Creates multiple repositories inside a connection. (repositories.batchCreate)
|
---|
75 | *
|
---|
76 | * @param string $parent Required. The connection to contain all the
|
---|
77 | * repositories being created. Format: projects/locations/connections The parent
|
---|
78 | * field in the CreateRepositoryRequest messages must either be empty or match
|
---|
79 | * this field.
|
---|
80 | * @param BatchCreateRepositoriesRequest $postBody
|
---|
81 | * @param array $optParams Optional parameters.
|
---|
82 | * @return Operation
|
---|
83 | * @throws \Google\Service\Exception
|
---|
84 | */
|
---|
85 | public function batchCreate($parent, BatchCreateRepositoriesRequest $postBody, $optParams = [])
|
---|
86 | {
|
---|
87 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
88 | $params = array_merge($params, $optParams);
|
---|
89 | return $this->call('batchCreate', [$params], Operation::class);
|
---|
90 | }
|
---|
91 | /**
|
---|
92 | * Creates a Repository. (repositories.create)
|
---|
93 | *
|
---|
94 | * @param string $parent Required. The connection to contain the repository. If
|
---|
95 | * the request is part of a BatchCreateRepositoriesRequest, this field should be
|
---|
96 | * empty or match the parent specified there.
|
---|
97 | * @param Repository $postBody
|
---|
98 | * @param array $optParams Optional parameters.
|
---|
99 | *
|
---|
100 | * @opt_param string repositoryId Required. The ID to use for the repository,
|
---|
101 | * which will become the final component of the repository's resource name. This
|
---|
102 | * ID should be unique in the connection. Allows alphanumeric characters and any
|
---|
103 | * of -._~%!$&'()*+,;=@.
|
---|
104 | * @return Operation
|
---|
105 | * @throws \Google\Service\Exception
|
---|
106 | */
|
---|
107 | public function create($parent, Repository $postBody, $optParams = [])
|
---|
108 | {
|
---|
109 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
110 | $params = array_merge($params, $optParams);
|
---|
111 | return $this->call('create', [$params], Operation::class);
|
---|
112 | }
|
---|
113 | /**
|
---|
114 | * Deletes a single repository. (repositories.delete)
|
---|
115 | *
|
---|
116 | * @param string $name Required. The name of the Repository to delete. Format:
|
---|
117 | * `projects/locations/connections/repositories`.
|
---|
118 | * @param array $optParams Optional parameters.
|
---|
119 | *
|
---|
120 | * @opt_param string etag The current etag of the repository. If an etag is
|
---|
121 | * provided and does not match the current etag of the repository, deletion will
|
---|
122 | * be blocked and an ABORTED error will be returned.
|
---|
123 | * @opt_param bool validateOnly If set, validate the request, but do not
|
---|
124 | * actually post it.
|
---|
125 | * @return Operation
|
---|
126 | * @throws \Google\Service\Exception
|
---|
127 | */
|
---|
128 | public function delete($name, $optParams = [])
|
---|
129 | {
|
---|
130 | $params = ['name' => $name];
|
---|
131 | $params = array_merge($params, $optParams);
|
---|
132 | return $this->call('delete', [$params], Operation::class);
|
---|
133 | }
|
---|
134 | /**
|
---|
135 | * Fetch the list of branches or tags for a given repository.
|
---|
136 | * (repositories.fetchGitRefs)
|
---|
137 | *
|
---|
138 | * @param string $repository Required. The resource name of the repository in
|
---|
139 | * the format `projects/locations/connections/repositories`.
|
---|
140 | * @param array $optParams Optional parameters.
|
---|
141 | *
|
---|
142 | * @opt_param int pageSize Optional. Number of results to return in the list.
|
---|
143 | * Default to 20.
|
---|
144 | * @opt_param string pageToken Optional. Page start.
|
---|
145 | * @opt_param string refType Type of refs to fetch
|
---|
146 | * @return FetchGitRefsResponse
|
---|
147 | * @throws \Google\Service\Exception
|
---|
148 | */
|
---|
149 | public function fetchGitRefs($repository, $optParams = [])
|
---|
150 | {
|
---|
151 | $params = ['repository' => $repository];
|
---|
152 | $params = array_merge($params, $optParams);
|
---|
153 | return $this->call('fetchGitRefs', [$params], FetchGitRefsResponse::class);
|
---|
154 | }
|
---|
155 | /**
|
---|
156 | * Gets details of a single repository. (repositories.get)
|
---|
157 | *
|
---|
158 | * @param string $name Required. The name of the Repository to retrieve. Format:
|
---|
159 | * `projects/locations/connections/repositories`.
|
---|
160 | * @param array $optParams Optional parameters.
|
---|
161 | * @return Repository
|
---|
162 | * @throws \Google\Service\Exception
|
---|
163 | */
|
---|
164 | public function get($name, $optParams = [])
|
---|
165 | {
|
---|
166 | $params = ['name' => $name];
|
---|
167 | $params = array_merge($params, $optParams);
|
---|
168 | return $this->call('get', [$params], Repository::class);
|
---|
169 | }
|
---|
170 | /**
|
---|
171 | * Lists Repositories in a given connection.
|
---|
172 | * (repositories.listProjectsLocationsConnectionsRepositories)
|
---|
173 | *
|
---|
174 | * @param string $parent Required. The parent, which owns this collection of
|
---|
175 | * Repositories. Format: `projects/locations/connections`.
|
---|
176 | * @param array $optParams Optional parameters.
|
---|
177 | *
|
---|
178 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
179 | * the response. Expressions must follow API improvement proposal
|
---|
180 | * [AIP-160](https://google.aip.dev/160). e.g.
|
---|
181 | * `remote_uri:"https://github.com*"`.
|
---|
182 | * @opt_param int pageSize Number of results to return in the list.
|
---|
183 | * @opt_param string pageToken Page start.
|
---|
184 | * @return ListRepositoriesResponse
|
---|
185 | * @throws \Google\Service\Exception
|
---|
186 | */
|
---|
187 | public function listProjectsLocationsConnectionsRepositories($parent, $optParams = [])
|
---|
188 | {
|
---|
189 | $params = ['parent' => $parent];
|
---|
190 | $params = array_merge($params, $optParams);
|
---|
191 | return $this->call('list', [$params], ListRepositoriesResponse::class);
|
---|
192 | }
|
---|
193 | }
|
---|
194 |
|
---|
195 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
196 | class_alias(ProjectsLocationsConnectionsRepositories::class, 'Google_Service_CloudBuild_Resource_ProjectsLocationsConnectionsRepositories');
|
---|