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\ArtifactRegistry\Resource; 19 20use Google\Service\ArtifactRegistry\ListRepositoriesResponse; 21use Google\Service\ArtifactRegistry\Operation; 22use Google\Service\ArtifactRegistry\Policy; 23use Google\Service\ArtifactRegistry\Repository; 24use Google\Service\ArtifactRegistry\SetIamPolicyRequest; 25use Google\Service\ArtifactRegistry\TestIamPermissionsRequest; 26use Google\Service\ArtifactRegistry\TestIamPermissionsResponse; 27 28/** 29 * The "repositories" collection of methods. 30 * Typical usage is: 31 * <code> 32 * $artifactregistryService = new Google\Service\ArtifactRegistry(...); 33 * $repositories = $artifactregistryService->repositories; 34 * </code> 35 */ 36class ProjectsLocationsRepositories extends \Google\Service\Resource 37{ 38 /** 39 * Creates a repository. The returned Operation will finish once the repository 40 * has been created. Its response will be the created Repository. 41 * (repositories.create) 42 * 43 * @param string $parent Required. The name of the parent resource where the 44 * repository will be created. 45 * @param Repository $postBody 46 * @param array $optParams Optional parameters. 47 * 48 * @opt_param string repositoryId The repository id to use for this repository. 49 * @return Operation 50 */ 51 public function create($parent, Repository $postBody, $optParams = []) 52 { 53 $params = ['parent' => $parent, 'postBody' => $postBody]; 54 $params = array_merge($params, $optParams); 55 return $this->call('create', [$params], Operation::class); 56 } 57 /** 58 * Deletes a repository and all of its contents. The returned Operation will 59 * finish once the repository has been deleted. It will not have any Operation 60 * metadata and will return a google.protobuf.Empty response. 61 * (repositories.delete) 62 * 63 * @param string $name Required. The name of the repository to delete. 64 * @param array $optParams Optional parameters. 65 * @return Operation 66 */ 67 public function delete($name, $optParams = []) 68 { 69 $params = ['name' => $name]; 70 $params = array_merge($params, $optParams); 71 return $this->call('delete', [$params], Operation::class); 72 } 73 /** 74 * Gets a repository. (repositories.get) 75 * 76 * @param string $name Required. The name of the repository to retrieve. 77 * @param array $optParams Optional parameters. 78 * @return Repository 79 */ 80 public function get($name, $optParams = []) 81 { 82 $params = ['name' => $name]; 83 $params = array_merge($params, $optParams); 84 return $this->call('get', [$params], Repository::class); 85 } 86 /** 87 * Gets the IAM policy for a given resource. (repositories.getIamPolicy) 88 * 89 * @param string $resource REQUIRED: The resource for which the policy is being 90 * requested. See the operation documentation for the appropriate value for this 91 * field. 92 * @param array $optParams Optional parameters. 93 * 94 * @opt_param int options.requestedPolicyVersion Optional. The maximum policy 95 * version that will be used to format the policy. Valid values are 0, 1, and 3. 96 * Requests specifying an invalid value will be rejected. Requests for policies 97 * with any conditional role bindings must specify version 3. Policies with no 98 * conditional role bindings may specify any valid value or leave the field 99 * unset. The policy in the response might use the policy version that you 100 * specified, or it might use a lower policy version. For example, if you 101 * specify version 3, but the policy has no conditional role bindings, the 102 * response uses version 1. To learn which resources support conditions in their 103 * IAM policies, see the [IAM 104 * documentation](https://cloud.google.com/iam/help/conditions/resource- 105 * policies). 106 * @return Policy 107 */ 108 public function getIamPolicy($resource, $optParams = []) 109 { 110 $params = ['resource' => $resource]; 111 $params = array_merge($params, $optParams); 112 return $this->call('getIamPolicy', [$params], Policy::class); 113 } 114 /** 115 * Lists repositories. (repositories.listProjectsLocationsRepositories) 116 * 117 * @param string $parent Required. The name of the parent resource whose 118 * repositories will be listed. 119 * @param array $optParams Optional parameters. 120 * 121 * @opt_param int pageSize The maximum number of repositories to return. Maximum 122 * page size is 1,000. 123 * @opt_param string pageToken The next_page_token value returned from a 124 * previous list request, if any. 125 * @return ListRepositoriesResponse 126 */ 127 public function listProjectsLocationsRepositories($parent, $optParams = []) 128 { 129 $params = ['parent' => $parent]; 130 $params = array_merge($params, $optParams); 131 return $this->call('list', [$params], ListRepositoriesResponse::class); 132 } 133 /** 134 * Updates a repository. (repositories.patch) 135 * 136 * @param string $name The name of the repository, for example: 137 * "projects/p1/locations/us-central1/repositories/repo1". 138 * @param Repository $postBody 139 * @param array $optParams Optional parameters. 140 * 141 * @opt_param string updateMask The update mask applies to the resource. For the 142 * `FieldMask` definition, see https://developers.google.com/protocol- 143 * buffers/docs/reference/google.protobuf#fieldmask 144 * @return Repository 145 */ 146 public function patch($name, Repository $postBody, $optParams = []) 147 { 148 $params = ['name' => $name, 'postBody' => $postBody]; 149 $params = array_merge($params, $optParams); 150 return $this->call('patch', [$params], Repository::class); 151 } 152 /** 153 * Updates the IAM policy for a given resource. (repositories.setIamPolicy) 154 * 155 * @param string $resource REQUIRED: The resource for which the policy is being 156 * specified. See the operation documentation for the appropriate value for this 157 * field. 158 * @param SetIamPolicyRequest $postBody 159 * @param array $optParams Optional parameters. 160 * @return Policy 161 */ 162 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 163 { 164 $params = ['resource' => $resource, 'postBody' => $postBody]; 165 $params = array_merge($params, $optParams); 166 return $this->call('setIamPolicy', [$params], Policy::class); 167 } 168 /** 169 * Tests if the caller has a list of permissions on a resource. 170 * (repositories.testIamPermissions) 171 * 172 * @param string $resource REQUIRED: The resource for which the policy detail is 173 * being requested. See the operation documentation for the appropriate value 174 * for this field. 175 * @param TestIamPermissionsRequest $postBody 176 * @param array $optParams Optional parameters. 177 * @return TestIamPermissionsResponse 178 */ 179 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 180 { 181 $params = ['resource' => $resource, 'postBody' => $postBody]; 182 $params = array_merge($params, $optParams); 183 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 184 } 185} 186 187// Adding a class alias for backwards compatibility with the previous class name. 188class_alias(ProjectsLocationsRepositories::class, 'Google_Service_ArtifactRegistry_Resource_ProjectsLocationsRepositories'); 189