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\DeploymentManager\Resource; 19 20use Google\Service\DeploymentManager\Deployment; 21use Google\Service\DeploymentManager\DeploymentsCancelPreviewRequest; 22use Google\Service\DeploymentManager\DeploymentsListResponse; 23use Google\Service\DeploymentManager\DeploymentsStopRequest; 24use Google\Service\DeploymentManager\GlobalSetPolicyRequest; 25use Google\Service\DeploymentManager\Operation; 26use Google\Service\DeploymentManager\Policy; 27use Google\Service\DeploymentManager\TestPermissionsRequest; 28use Google\Service\DeploymentManager\TestPermissionsResponse; 29 30/** 31 * The "deployments" collection of methods. 32 * Typical usage is: 33 * <code> 34 * $deploymentmanagerService = new Google\Service\DeploymentManager(...); 35 * $deployments = $deploymentmanagerService->deployments; 36 * </code> 37 */ 38class Deployments extends \Google\Service\Resource 39{ 40 /** 41 * Cancels and removes the preview currently associated with the deployment. 42 * (deployments.cancelPreview) 43 * 44 * @param string $project The project ID for this request. 45 * @param string $deployment The name of the deployment for this request. 46 * @param DeploymentsCancelPreviewRequest $postBody 47 * @param array $optParams Optional parameters. 48 * @return Operation 49 */ 50 public function cancelPreview($project, $deployment, DeploymentsCancelPreviewRequest $postBody, $optParams = []) 51 { 52 $params = ['project' => $project, 'deployment' => $deployment, 'postBody' => $postBody]; 53 $params = array_merge($params, $optParams); 54 return $this->call('cancelPreview', [$params], Operation::class); 55 } 56 /** 57 * Deletes a deployment and all of the resources in the deployment. 58 * (deployments.delete) 59 * 60 * @param string $project The project ID for this request. 61 * @param string $deployment The name of the deployment for this request. 62 * @param array $optParams Optional parameters. 63 * 64 * @opt_param string deletePolicy Sets the policy to use for deleting resources. 65 * @return Operation 66 */ 67 public function delete($project, $deployment, $optParams = []) 68 { 69 $params = ['project' => $project, 'deployment' => $deployment]; 70 $params = array_merge($params, $optParams); 71 return $this->call('delete', [$params], Operation::class); 72 } 73 /** 74 * Gets information about a specific deployment. (deployments.get) 75 * 76 * @param string $project The project ID for this request. 77 * @param string $deployment The name of the deployment for this request. 78 * @param array $optParams Optional parameters. 79 * @return Deployment 80 */ 81 public function get($project, $deployment, $optParams = []) 82 { 83 $params = ['project' => $project, 'deployment' => $deployment]; 84 $params = array_merge($params, $optParams); 85 return $this->call('get', [$params], Deployment::class); 86 } 87 /** 88 * Gets the access control policy for a resource. May be empty if no such policy 89 * or resource exists. (deployments.getIamPolicy) 90 * 91 * @param string $project Project ID for this request. 92 * @param string $resource Name or id of the resource for this request. 93 * @param array $optParams Optional parameters. 94 * 95 * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version. 96 * @return Policy 97 */ 98 public function getIamPolicy($project, $resource, $optParams = []) 99 { 100 $params = ['project' => $project, 'resource' => $resource]; 101 $params = array_merge($params, $optParams); 102 return $this->call('getIamPolicy', [$params], Policy::class); 103 } 104 /** 105 * Creates a deployment and all of the resources described by the deployment 106 * manifest. (deployments.insert) 107 * 108 * @param string $project The project ID for this request. 109 * @param Deployment $postBody 110 * @param array $optParams Optional parameters. 111 * 112 * @opt_param string createPolicy Sets the policy to use for creating new 113 * resources. 114 * @opt_param bool preview If set to true, creates a deployment and creates 115 * "shell" resources but does not actually instantiate these resources. This 116 * allows you to preview what your deployment looks like. After previewing a 117 * deployment, you can deploy your resources by making a request with the 118 * `update()` method or you can use the `cancelPreview()` method to cancel the 119 * preview altogether. Note that the deployment will still exist after you 120 * cancel the preview and you must separately delete this deployment if you want 121 * to remove it. 122 * @return Operation 123 */ 124 public function insert($project, Deployment $postBody, $optParams = []) 125 { 126 $params = ['project' => $project, 'postBody' => $postBody]; 127 $params = array_merge($params, $optParams); 128 return $this->call('insert', [$params], Operation::class); 129 } 130 /** 131 * Lists all deployments for a given project. (deployments.listDeployments) 132 * 133 * @param string $project The project ID for this request. 134 * @param array $optParams Optional parameters. 135 * 136 * @opt_param string filter A filter expression that filters resources listed in 137 * the response. The expression must specify the field name, an operator, and 138 * the value that you want to use for filtering. The value must be a string, a 139 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 140 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 141 * can exclude instances named `example-instance` by specifying `name != 142 * example-instance`. The `:` operator can be used with string fields to match 143 * substrings. For non-string fields it is equivalent to the `=` operator. The 144 * `:*` comparison can be used to test whether a key has been defined. For 145 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 146 * You can also filter nested fields. For example, you could specify 147 * `scheduling.automaticRestart = false` to include instances only if they are 148 * not scheduled for automatic restarts. You can use filtering on nested fields 149 * to filter based on resource labels. To filter on multiple expressions, 150 * provide each separate expression within parentheses. For example: ``` 151 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 152 * default, each expression is an `AND` expression. However, you can include 153 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 154 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 155 * (scheduling.automaticRestart = true) ``` 156 * @opt_param string maxResults The maximum number of results per page that 157 * should be returned. If the number of available results is larger than 158 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 159 * get the next page of results in subsequent list requests. Acceptable values 160 * are `0` to `500`, inclusive. (Default: `500`) 161 * @opt_param string orderBy Sorts list results by a certain order. By default, 162 * results are returned in alphanumerical order based on the resource name. You 163 * can also sort results in descending order based on the creation timestamp 164 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 165 * `creationTimestamp` field in reverse chronological order (newest result 166 * first). Use this to sort resources like operations so that the newest 167 * operation is returned first. Currently, only sorting by `name` or 168 * `creationTimestamp desc` is supported. 169 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 170 * the `nextPageToken` returned by a previous list request to get the next page 171 * of results. 172 * @return DeploymentsListResponse 173 */ 174 public function listDeployments($project, $optParams = []) 175 { 176 $params = ['project' => $project]; 177 $params = array_merge($params, $optParams); 178 return $this->call('list', [$params], DeploymentsListResponse::class); 179 } 180 /** 181 * Patches a deployment and all of the resources described by the deployment 182 * manifest. (deployments.patch) 183 * 184 * @param string $project The project ID for this request. 185 * @param string $deployment The name of the deployment for this request. 186 * @param Deployment $postBody 187 * @param array $optParams Optional parameters. 188 * 189 * @opt_param string createPolicy Sets the policy to use for creating new 190 * resources. 191 * @opt_param string deletePolicy Sets the policy to use for deleting resources. 192 * @opt_param bool preview If set to true, updates the deployment and creates 193 * and updates the "shell" resources but does not actually alter or instantiate 194 * these resources. This allows you to preview what your deployment will look 195 * like. You can use this intent to preview how an update would affect your 196 * deployment. You must provide a `target.config` with a configuration if this 197 * is set to true. After previewing a deployment, you can deploy your resources 198 * by making a request with the `update()` or you can `cancelPreview()` to 199 * remove the preview altogether. Note that the deployment will still exist 200 * after you cancel the preview and you must separately delete this deployment 201 * if you want to remove it. 202 * @return Operation 203 */ 204 public function patch($project, $deployment, Deployment $postBody, $optParams = []) 205 { 206 $params = ['project' => $project, 'deployment' => $deployment, 'postBody' => $postBody]; 207 $params = array_merge($params, $optParams); 208 return $this->call('patch', [$params], Operation::class); 209 } 210 /** 211 * Sets the access control policy on the specified resource. Replaces any 212 * existing policy. (deployments.setIamPolicy) 213 * 214 * @param string $project Project ID for this request. 215 * @param string $resource Name or id of the resource for this request. 216 * @param GlobalSetPolicyRequest $postBody 217 * @param array $optParams Optional parameters. 218 * @return Policy 219 */ 220 public function setIamPolicy($project, $resource, GlobalSetPolicyRequest $postBody, $optParams = []) 221 { 222 $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody]; 223 $params = array_merge($params, $optParams); 224 return $this->call('setIamPolicy', [$params], Policy::class); 225 } 226 /** 227 * Stops an ongoing operation. This does not roll back any work that has already 228 * been completed, but prevents any new work from being started. 229 * (deployments.stop) 230 * 231 * @param string $project The project ID for this request. 232 * @param string $deployment The name of the deployment for this request. 233 * @param DeploymentsStopRequest $postBody 234 * @param array $optParams Optional parameters. 235 * @return Operation 236 */ 237 public function stop($project, $deployment, DeploymentsStopRequest $postBody, $optParams = []) 238 { 239 $params = ['project' => $project, 'deployment' => $deployment, 'postBody' => $postBody]; 240 $params = array_merge($params, $optParams); 241 return $this->call('stop', [$params], Operation::class); 242 } 243 /** 244 * Returns permissions that a caller has on the specified resource. 245 * (deployments.testIamPermissions) 246 * 247 * @param string $project Project ID for this request. 248 * @param string $resource Name or id of the resource for this request. 249 * @param TestPermissionsRequest $postBody 250 * @param array $optParams Optional parameters. 251 * @return TestPermissionsResponse 252 */ 253 public function testIamPermissions($project, $resource, TestPermissionsRequest $postBody, $optParams = []) 254 { 255 $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody]; 256 $params = array_merge($params, $optParams); 257 return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class); 258 } 259 /** 260 * Updates a deployment and all of the resources described by the deployment 261 * manifest. (deployments.update) 262 * 263 * @param string $project The project ID for this request. 264 * @param string $deployment The name of the deployment for this request. 265 * @param Deployment $postBody 266 * @param array $optParams Optional parameters. 267 * 268 * @opt_param string createPolicy Sets the policy to use for creating new 269 * resources. 270 * @opt_param string deletePolicy Sets the policy to use for deleting resources. 271 * @opt_param bool preview If set to true, updates the deployment and creates 272 * and updates the "shell" resources but does not actually alter or instantiate 273 * these resources. This allows you to preview what your deployment will look 274 * like. You can use this intent to preview how an update would affect your 275 * deployment. You must provide a `target.config` with a configuration if this 276 * is set to true. After previewing a deployment, you can deploy your resources 277 * by making a request with the `update()` or you can `cancelPreview()` to 278 * remove the preview altogether. Note that the deployment will still exist 279 * after you cancel the preview and you must separately delete this deployment 280 * if you want to remove it. 281 * @return Operation 282 */ 283 public function update($project, $deployment, Deployment $postBody, $optParams = []) 284 { 285 $params = ['project' => $project, 'deployment' => $deployment, 'postBody' => $postBody]; 286 $params = array_merge($params, $optParams); 287 return $this->call('update', [$params], Operation::class); 288 } 289} 290 291// Adding a class alias for backwards compatibility with the previous class name. 292class_alias(Deployments::class, 'Google_Service_DeploymentManager_Resource_Deployments'); 293