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\CloudDeploy\Resource; 19 20use Google\Service\CloudDeploy\ListTargetsResponse; 21use Google\Service\CloudDeploy\Operation; 22use Google\Service\CloudDeploy\Policy; 23use Google\Service\CloudDeploy\SetIamPolicyRequest; 24use Google\Service\CloudDeploy\Target; 25use Google\Service\CloudDeploy\TestIamPermissionsRequest; 26use Google\Service\CloudDeploy\TestIamPermissionsResponse; 27 28/** 29 * The "targets" collection of methods. 30 * Typical usage is: 31 * <code> 32 * $clouddeployService = new Google\Service\CloudDeploy(...); 33 * $targets = $clouddeployService->targets; 34 * </code> 35 */ 36class ProjectsLocationsTargets extends \Google\Service\Resource 37{ 38 /** 39 * Creates a new Target in a given project and location. (targets.create) 40 * 41 * @param string $parent Required. The parent collection in which the `Target` 42 * should be created. Format should be 43 * projects/{project_id}/locations/{location_name}. 44 * @param Target $postBody 45 * @param array $optParams Optional parameters. 46 * 47 * @opt_param string requestId Optional. A request ID to identify requests. 48 * Specify a unique request ID so that if you must retry your request, the 49 * server will know to ignore the request if it has already been completed. The 50 * server will guarantee that for at least 60 minutes since the first request. 51 * For example, consider a situation where you make an initial request and the 52 * request times out. If you make the request again with the same request ID, 53 * the server can check if original operation with the same request ID was 54 * received, and if so, will ignore the second request. This prevents clients 55 * from accidentally creating duplicate commitments. The request ID must be a 56 * valid UUID with the exception that zero UUID is not supported 57 * (00000000-0000-0000-0000-000000000000). 58 * @opt_param string targetId Required. ID of the `Target`. 59 * @opt_param bool validateOnly Optional. If set to true, the request is 60 * validated and the user is provided with an expected result, but no actual 61 * change is made. 62 * @return Operation 63 */ 64 public function create($parent, Target $postBody, $optParams = []) 65 { 66 $params = ['parent' => $parent, 'postBody' => $postBody]; 67 $params = array_merge($params, $optParams); 68 return $this->call('create', [$params], Operation::class); 69 } 70 /** 71 * Deletes a single Target. (targets.delete) 72 * 73 * @param string $name Required. The name of the `Target` to delete. Format 74 * should be 75 * projects/{project_id}/locations/{location_name}/targets/{target_name}. 76 * @param array $optParams Optional parameters. 77 * 78 * @opt_param bool allowMissing Optional. If set to true, then deleting an 79 * already deleted or non-existing DeliveryPipeline will succeed. 80 * @opt_param string etag Optional. This checksum is computed by the server 81 * based on the value of other fields, and may be sent on update and delete 82 * requests to ensure the client has an up-to-date value before proceeding. 83 * @opt_param string requestId Optional. A request ID to identify requests. 84 * Specify a unique request ID so that if you must retry your request, the 85 * server will know to ignore the request if it has already been completed. The 86 * server will guarantee that for at least 60 minutes after the first request. 87 * For example, consider a situation where you make an initial request and the 88 * request times out. If you make the request again with the same request ID, 89 * the server can check if original operation with the same request ID was 90 * received, and if so, will ignore the second request. This prevents clients 91 * from accidentally creating duplicate commitments. The request ID must be a 92 * valid UUID with the exception that zero UUID is not supported 93 * (00000000-0000-0000-0000-000000000000). 94 * @opt_param bool validateOnly Optional. If set, validate the request and 95 * preview the review, but do not actually post it. 96 * @return Operation 97 */ 98 public function delete($name, $optParams = []) 99 { 100 $params = ['name' => $name]; 101 $params = array_merge($params, $optParams); 102 return $this->call('delete', [$params], Operation::class); 103 } 104 /** 105 * Gets details of a single Target. (targets.get) 106 * 107 * @param string $name Required. Name of the `Target`. Format must be 108 * projects/{project_id}/locations/{location_name}/targets/{target_name}. 109 * @param array $optParams Optional parameters. 110 * @return Target 111 */ 112 public function get($name, $optParams = []) 113 { 114 $params = ['name' => $name]; 115 $params = array_merge($params, $optParams); 116 return $this->call('get', [$params], Target::class); 117 } 118 /** 119 * Gets the access control policy for a resource. Returns an empty policy if the 120 * resource exists and does not have a policy set. (targets.getIamPolicy) 121 * 122 * @param string $resource REQUIRED: The resource for which the policy is being 123 * requested. See the operation documentation for the appropriate value for this 124 * field. 125 * @param array $optParams Optional parameters. 126 * 127 * @opt_param int options.requestedPolicyVersion Optional. The maximum policy 128 * version that will be used to format the policy. Valid values are 0, 1, and 3. 129 * Requests specifying an invalid value will be rejected. Requests for policies 130 * with any conditional role bindings must specify version 3. Policies with no 131 * conditional role bindings may specify any valid value or leave the field 132 * unset. The policy in the response might use the policy version that you 133 * specified, or it might use a lower policy version. For example, if you 134 * specify version 3, but the policy has no conditional role bindings, the 135 * response uses version 1. To learn which resources support conditions in their 136 * IAM policies, see the [IAM 137 * documentation](https://cloud.google.com/iam/help/conditions/resource- 138 * policies). 139 * @return Policy 140 */ 141 public function getIamPolicy($resource, $optParams = []) 142 { 143 $params = ['resource' => $resource]; 144 $params = array_merge($params, $optParams); 145 return $this->call('getIamPolicy', [$params], Policy::class); 146 } 147 /** 148 * Lists Targets in a given project and location. 149 * (targets.listProjectsLocationsTargets) 150 * 151 * @param string $parent Required. The parent, which owns this collection of 152 * targets. Format must be projects/{project_id}/locations/{location_name}. 153 * @param array $optParams Optional parameters. 154 * 155 * @opt_param string filter Optional. Filter targets to be returned. See 156 * https://google.aip.dev/160 for more details. 157 * @opt_param string orderBy Optional. Field to sort by. See 158 * https://google.aip.dev/132#ordering for more details. 159 * @opt_param int pageSize Optional. The maximum number of `Target` objects to 160 * return. The service may return fewer than this value. If unspecified, at most 161 * 50 `Target` objects will be returned. The maximum value is 1000; values above 162 * 1000 will be set to 1000. 163 * @opt_param string pageToken Optional. A page token, received from a previous 164 * `ListTargets` call. Provide this to retrieve the subsequent page. When 165 * paginating, all other provided parameters match the call that provided the 166 * page token. 167 * @return ListTargetsResponse 168 */ 169 public function listProjectsLocationsTargets($parent, $optParams = []) 170 { 171 $params = ['parent' => $parent]; 172 $params = array_merge($params, $optParams); 173 return $this->call('list', [$params], ListTargetsResponse::class); 174 } 175 /** 176 * Updates the parameters of a single Target. (targets.patch) 177 * 178 * @param string $name Optional. Name of the `Target`. Format is 179 * projects/{project}/locations/{location}/targets/a-z{0,62}. 180 * @param Target $postBody 181 * @param array $optParams Optional parameters. 182 * 183 * @opt_param bool allowMissing Optional. If set to true, updating a `Target` 184 * that does not exist will result in the creation of a new `Target`. 185 * @opt_param string requestId Optional. A request ID to identify requests. 186 * Specify a unique request ID so that if you must retry your request, the 187 * server will know to ignore the request if it has already been completed. The 188 * server will guarantee that for at least 60 minutes since the first request. 189 * For example, consider a situation where you make an initial request and the 190 * request times out. If you make the request again with the same request ID, 191 * the server can check if original operation with the same request ID was 192 * received, and if so, will ignore the second request. This prevents clients 193 * from accidentally creating duplicate commitments. The request ID must be a 194 * valid UUID with the exception that zero UUID is not supported 195 * (00000000-0000-0000-0000-000000000000). 196 * @opt_param string updateMask Required. Field mask is used to specify the 197 * fields to be overwritten in the Target resource by the update. The fields 198 * specified in the update_mask are relative to the resource, not the full 199 * request. A field will be overwritten if it is in the mask. If the user does 200 * not provide a mask then all fields will be overwritten. 201 * @opt_param bool validateOnly Optional. If set to true, the request is 202 * validated and the user is provided with an expected result, but no actual 203 * change is made. 204 * @return Operation 205 */ 206 public function patch($name, Target $postBody, $optParams = []) 207 { 208 $params = ['name' => $name, 'postBody' => $postBody]; 209 $params = array_merge($params, $optParams); 210 return $this->call('patch', [$params], Operation::class); 211 } 212 /** 213 * Sets the access control policy on the specified resource. Replaces any 214 * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and 215 * `PERMISSION_DENIED` errors. (targets.setIamPolicy) 216 * 217 * @param string $resource REQUIRED: The resource for which the policy is being 218 * specified. See the operation documentation for the appropriate value for this 219 * field. 220 * @param SetIamPolicyRequest $postBody 221 * @param array $optParams Optional parameters. 222 * @return Policy 223 */ 224 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 225 { 226 $params = ['resource' => $resource, 'postBody' => $postBody]; 227 $params = array_merge($params, $optParams); 228 return $this->call('setIamPolicy', [$params], Policy::class); 229 } 230 /** 231 * Returns permissions that a caller has on the specified resource. If the 232 * resource does not exist, this will return an empty set of permissions, not a 233 * `NOT_FOUND` error. Note: This operation is designed to be used for building 234 * permission-aware UIs and command-line tools, not for authorization checking. 235 * This operation may "fail open" without warning. (targets.testIamPermissions) 236 * 237 * @param string $resource REQUIRED: The resource for which the policy detail is 238 * being requested. See the operation documentation for the appropriate value 239 * for this field. 240 * @param TestIamPermissionsRequest $postBody 241 * @param array $optParams Optional parameters. 242 * @return TestIamPermissionsResponse 243 */ 244 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 245 { 246 $params = ['resource' => $resource, 'postBody' => $postBody]; 247 $params = array_merge($params, $optParams); 248 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 249 } 250} 251 252// Adding a class alias for backwards compatibility with the previous class name. 253class_alias(ProjectsLocationsTargets::class, 'Google_Service_CloudDeploy_Resource_ProjectsLocationsTargets'); 254