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