[e3d4e0a] | 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\CloudSourceRepositories\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\CloudSourceRepositories\ListReposResponse;
|
---|
| 21 | use Google\Service\CloudSourceRepositories\Operation;
|
---|
| 22 | use Google\Service\CloudSourceRepositories\Policy;
|
---|
| 23 | use Google\Service\CloudSourceRepositories\Repo;
|
---|
| 24 | use Google\Service\CloudSourceRepositories\SetIamPolicyRequest;
|
---|
| 25 | use Google\Service\CloudSourceRepositories\SourcerepoEmpty;
|
---|
| 26 | use Google\Service\CloudSourceRepositories\SyncRepoRequest;
|
---|
| 27 | use Google\Service\CloudSourceRepositories\TestIamPermissionsRequest;
|
---|
| 28 | use Google\Service\CloudSourceRepositories\TestIamPermissionsResponse;
|
---|
| 29 | use Google\Service\CloudSourceRepositories\UpdateRepoRequest;
|
---|
| 30 |
|
---|
| 31 | /**
|
---|
| 32 | * The "repos" collection of methods.
|
---|
| 33 | * Typical usage is:
|
---|
| 34 | * <code>
|
---|
| 35 | * $sourcerepoService = new Google\Service\CloudSourceRepositories(...);
|
---|
| 36 | * $repos = $sourcerepoService->projects_repos;
|
---|
| 37 | * </code>
|
---|
| 38 | */
|
---|
| 39 | class ProjectsRepos extends \Google\Service\Resource
|
---|
| 40 | {
|
---|
| 41 | /**
|
---|
| 42 | * Creates a repo in the given project with the given name. If the named
|
---|
| 43 | * repository already exists, `CreateRepo` returns `ALREADY_EXISTS`.
|
---|
| 44 | * (repos.create)
|
---|
| 45 | *
|
---|
| 46 | * @param string $parent The project in which to create the repo. Values are of
|
---|
| 47 | * the form `projects/`.
|
---|
| 48 | * @param Repo $postBody
|
---|
| 49 | * @param array $optParams Optional parameters.
|
---|
| 50 | * @return Repo
|
---|
| 51 | * @throws \Google\Service\Exception
|
---|
| 52 | */
|
---|
| 53 | public function create($parent, Repo $postBody, $optParams = [])
|
---|
| 54 | {
|
---|
| 55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 56 | $params = array_merge($params, $optParams);
|
---|
| 57 | return $this->call('create', [$params], Repo::class);
|
---|
| 58 | }
|
---|
| 59 | /**
|
---|
| 60 | * Deletes a repo. (repos.delete)
|
---|
| 61 | *
|
---|
| 62 | * @param string $name The name of the repo to delete. Values are of the form
|
---|
| 63 | * `projects//repos/`.
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | * @return SourcerepoEmpty
|
---|
| 66 | * @throws \Google\Service\Exception
|
---|
| 67 | */
|
---|
| 68 | public function delete($name, $optParams = [])
|
---|
| 69 | {
|
---|
| 70 | $params = ['name' => $name];
|
---|
| 71 | $params = array_merge($params, $optParams);
|
---|
| 72 | return $this->call('delete', [$params], SourcerepoEmpty::class);
|
---|
| 73 | }
|
---|
| 74 | /**
|
---|
| 75 | * Returns information about a repo. (repos.get)
|
---|
| 76 | *
|
---|
| 77 | * @param string $name The name of the requested repository. Values are of the
|
---|
| 78 | * form `projects//repos/`.
|
---|
| 79 | * @param array $optParams Optional parameters.
|
---|
| 80 | * @return Repo
|
---|
| 81 | * @throws \Google\Service\Exception
|
---|
| 82 | */
|
---|
| 83 | public function get($name, $optParams = [])
|
---|
| 84 | {
|
---|
| 85 | $params = ['name' => $name];
|
---|
| 86 | $params = array_merge($params, $optParams);
|
---|
| 87 | return $this->call('get', [$params], Repo::class);
|
---|
| 88 | }
|
---|
| 89 | /**
|
---|
| 90 | * Gets the IAM policy policy for a resource. Returns an empty policy if the
|
---|
| 91 | * resource exists and does not have a policy set. (repos.getIamPolicy)
|
---|
| 92 | *
|
---|
| 93 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 94 | * requested. See [Resource
|
---|
| 95 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 96 | * appropriate value for this field.
|
---|
| 97 | * @param array $optParams Optional parameters.
|
---|
| 98 | *
|
---|
| 99 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
| 100 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
| 101 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
| 102 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
| 103 | * conditional role bindings may specify any valid value or leave the field
|
---|
| 104 | * unset. The policy in the response might use the policy version that you
|
---|
| 105 | * specified, or it might use a lower policy version. For example, if you
|
---|
| 106 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
| 107 | * response uses version 1. To learn which resources support conditions in their
|
---|
| 108 | * IAM policies, see the [IAM
|
---|
| 109 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
| 110 | * policies).
|
---|
| 111 | * @return Policy
|
---|
| 112 | * @throws \Google\Service\Exception
|
---|
| 113 | */
|
---|
| 114 | public function getIamPolicy($resource, $optParams = [])
|
---|
| 115 | {
|
---|
| 116 | $params = ['resource' => $resource];
|
---|
| 117 | $params = array_merge($params, $optParams);
|
---|
| 118 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
| 119 | }
|
---|
| 120 | /**
|
---|
| 121 | * Returns all repos belonging to a project. The sizes of the repos are not set
|
---|
| 122 | * by ListRepos. To get the size of a repo, use GetRepo.
|
---|
| 123 | * (repos.listProjectsRepos)
|
---|
| 124 | *
|
---|
| 125 | * @param string $name The project ID whose repos should be listed. Values are
|
---|
| 126 | * of the form `projects/`.
|
---|
| 127 | * @param array $optParams Optional parameters.
|
---|
| 128 | *
|
---|
| 129 | * @opt_param int pageSize Maximum number of repositories to return; between 1
|
---|
| 130 | * and 500. If not set or zero, defaults to 100 at the server.
|
---|
| 131 | * @opt_param string pageToken Resume listing repositories where a prior
|
---|
| 132 | * ListReposResponse left off. This is an opaque token that must be obtained
|
---|
| 133 | * from a recent, prior ListReposResponse's next_page_token field.
|
---|
| 134 | * @return ListReposResponse
|
---|
| 135 | * @throws \Google\Service\Exception
|
---|
| 136 | */
|
---|
| 137 | public function listProjectsRepos($name, $optParams = [])
|
---|
| 138 | {
|
---|
| 139 | $params = ['name' => $name];
|
---|
| 140 | $params = array_merge($params, $optParams);
|
---|
| 141 | return $this->call('list', [$params], ListReposResponse::class);
|
---|
| 142 | }
|
---|
| 143 | /**
|
---|
| 144 | * Updates information about a repo. (repos.patch)
|
---|
| 145 | *
|
---|
| 146 | * @param string $name The name of the requested repository. Values are of the
|
---|
| 147 | * form `projects//repos/`.
|
---|
| 148 | * @param UpdateRepoRequest $postBody
|
---|
| 149 | * @param array $optParams Optional parameters.
|
---|
| 150 | * @return Repo
|
---|
| 151 | * @throws \Google\Service\Exception
|
---|
| 152 | */
|
---|
| 153 | public function patch($name, UpdateRepoRequest $postBody, $optParams = [])
|
---|
| 154 | {
|
---|
| 155 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 156 | $params = array_merge($params, $optParams);
|
---|
| 157 | return $this->call('patch', [$params], Repo::class);
|
---|
| 158 | }
|
---|
| 159 | /**
|
---|
| 160 | * Sets the IAM policy on the specified resource. Replaces any existing policy.
|
---|
| 161 | * (repos.setIamPolicy)
|
---|
| 162 | *
|
---|
| 163 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 164 | * specified. See [Resource
|
---|
| 165 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 166 | * appropriate value for this field.
|
---|
| 167 | * @param SetIamPolicyRequest $postBody
|
---|
| 168 | * @param array $optParams Optional parameters.
|
---|
| 169 | * @return Policy
|
---|
| 170 | * @throws \Google\Service\Exception
|
---|
| 171 | */
|
---|
| 172 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 173 | {
|
---|
| 174 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 175 | $params = array_merge($params, $optParams);
|
---|
| 176 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
| 177 | }
|
---|
| 178 | /**
|
---|
| 179 | * Synchronize a connected repo. The response contains SyncRepoMetadata in the
|
---|
| 180 | * metadata field. (repos.sync)
|
---|
| 181 | *
|
---|
| 182 | * @param string $name The name of the repo to synchronize. Values are of the
|
---|
| 183 | * form `projects//repos/`.
|
---|
| 184 | * @param SyncRepoRequest $postBody
|
---|
| 185 | * @param array $optParams Optional parameters.
|
---|
| 186 | * @return Operation
|
---|
| 187 | * @throws \Google\Service\Exception
|
---|
| 188 | */
|
---|
| 189 | public function sync($name, SyncRepoRequest $postBody, $optParams = [])
|
---|
| 190 | {
|
---|
| 191 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 192 | $params = array_merge($params, $optParams);
|
---|
| 193 | return $this->call('sync', [$params], Operation::class);
|
---|
| 194 | }
|
---|
| 195 | /**
|
---|
| 196 | * Returns permissions that a caller has on the specified resource. If the
|
---|
| 197 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
| 198 | * NOT_FOUND error. (repos.testIamPermissions)
|
---|
| 199 | *
|
---|
| 200 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
| 201 | * being requested. See [Resource
|
---|
| 202 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 203 | * appropriate value for this field.
|
---|
| 204 | * @param TestIamPermissionsRequest $postBody
|
---|
| 205 | * @param array $optParams Optional parameters.
|
---|
| 206 | * @return TestIamPermissionsResponse
|
---|
| 207 | * @throws \Google\Service\Exception
|
---|
| 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.
|
---|
| 218 | class_alias(ProjectsRepos::class, 'Google_Service_CloudSourceRepositories_Resource_ProjectsRepos');
|
---|