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\BackupforGKE\Resource; 19 20use Google\Service\BackupforGKE\GoogleLongrunningOperation; 21use Google\Service\BackupforGKE\ListRestoresResponse; 22use Google\Service\BackupforGKE\Policy; 23use Google\Service\BackupforGKE\Restore; 24use Google\Service\BackupforGKE\SetIamPolicyRequest; 25use Google\Service\BackupforGKE\TestIamPermissionsRequest; 26use Google\Service\BackupforGKE\TestIamPermissionsResponse; 27 28/** 29 * The "restores" collection of methods. 30 * Typical usage is: 31 * <code> 32 * $gkebackupService = new Google\Service\BackupforGKE(...); 33 * $restores = $gkebackupService->restores; 34 * </code> 35 */ 36class ProjectsLocationsRestorePlansRestores extends \Google\Service\Resource 37{ 38 /** 39 * Creates a new Restore for the given RestorePlan. (restores.create) 40 * 41 * @param string $parent Required. The RestorePlan within which to create the 42 * Restore. Format: 43 * projects/{project}/locations/{location}/restorePlans/{restore_plan} 44 * @param Restore $postBody 45 * @param array $optParams Optional parameters. 46 * 47 * @opt_param string restoreId Required. The client-provided short name for the 48 * Restore resource. This name must: a. be between 1 and 63 characters long 49 * (inclusive) b. consist of only lower-case ASCII letters, numbers, and dashes 50 * c. start with a lower-case letter d. end with a lower-case letter or number 51 * e. be unique within the set of Restores in this RestorePlan. 52 * @return GoogleLongrunningOperation 53 */ 54 public function create($parent, Restore $postBody, $optParams = []) 55 { 56 $params = ['parent' => $parent, 'postBody' => $postBody]; 57 $params = array_merge($params, $optParams); 58 return $this->call('create', [$params], GoogleLongrunningOperation::class); 59 } 60 /** 61 * Deletes an existing Restore. (restores.delete) 62 * 63 * @param string $name Required. Full name of the Restore Format: projects/{proj 64 * ect}/locations/{location}/restorePlans/{restore_plan}/restores/{restore} 65 * @param array $optParams Optional parameters. 66 * 67 * @opt_param string etag etag, if provided, it must match the server's etag for 68 * delete to happen. 69 * @opt_param bool force If set to true, any volumeRestores below this restore 70 * will also be deleted. Otherwise, the request will only succeed if the restore 71 * has no volumeRestores. 72 * @return GoogleLongrunningOperation 73 */ 74 public function delete($name, $optParams = []) 75 { 76 $params = ['name' => $name]; 77 $params = array_merge($params, $optParams); 78 return $this->call('delete', [$params], GoogleLongrunningOperation::class); 79 } 80 /** 81 * Retrieves the details of a single Restore. (restores.get) 82 * 83 * @param string $name Required. Name of the restore resource. Format: projects/ 84 * {project}/locations/{location}/restorePlans/{restore_plan}/restores/{restore} 85 * @param array $optParams Optional parameters. 86 * @return Restore 87 */ 88 public function get($name, $optParams = []) 89 { 90 $params = ['name' => $name]; 91 $params = array_merge($params, $optParams); 92 return $this->call('get', [$params], Restore::class); 93 } 94 /** 95 * Gets the access control policy for a resource. Returns an empty policy if the 96 * resource exists and does not have a policy set. (restores.getIamPolicy) 97 * 98 * @param string $resource REQUIRED: The resource for which the policy is being 99 * requested. See the operation documentation for the appropriate value for this 100 * field. 101 * @param array $optParams Optional parameters. 102 * 103 * @opt_param int options.requestedPolicyVersion Optional. The maximum policy 104 * version that will be used to format the policy. Valid values are 0, 1, and 3. 105 * Requests specifying an invalid value will be rejected. Requests for policies 106 * with any conditional role bindings must specify version 3. Policies with no 107 * conditional role bindings may specify any valid value or leave the field 108 * unset. The policy in the response might use the policy version that you 109 * specified, or it might use a lower policy version. For example, if you 110 * specify version 3, but the policy has no conditional role bindings, the 111 * response uses version 1. To learn which resources support conditions in their 112 * IAM policies, see the [IAM 113 * documentation](https://cloud.google.com/iam/help/conditions/resource- 114 * policies). 115 * @return Policy 116 */ 117 public function getIamPolicy($resource, $optParams = []) 118 { 119 $params = ['resource' => $resource]; 120 $params = array_merge($params, $optParams); 121 return $this->call('getIamPolicy', [$params], Policy::class); 122 } 123 /** 124 * Lists the Restores for a given RestorePlan. 125 * (restores.listProjectsLocationsRestorePlansRestores) 126 * 127 * @param string $parent Required. The RestorePlan that contains the Restores to 128 * list. Format: 129 * projects/{project}/locations/{location}/restorePlans/{restore_plan} 130 * @param array $optParams Optional parameters. 131 * 132 * @opt_param string filter List filter. 133 * @opt_param string orderBy Sort results. 134 * @opt_param int pageSize The target number of results to return in a single 135 * response. If not specified, a default value will be chosen by the service. 136 * Note that the response may inclue a partial list and a caller should only 137 * rely on the response's next_page_token to determine if there are more 138 * instances left to be queried. 139 * @opt_param string pageToken The value of next_page_token received from a 140 * previous `ListRestores` call. Provide this to retrieve the subsequent page in 141 * a multi-page list of results. When paginating, all other parameters provided 142 * to `ListRestores` must match the call that provided the page token. 143 * @return ListRestoresResponse 144 */ 145 public function listProjectsLocationsRestorePlansRestores($parent, $optParams = []) 146 { 147 $params = ['parent' => $parent]; 148 $params = array_merge($params, $optParams); 149 return $this->call('list', [$params], ListRestoresResponse::class); 150 } 151 /** 152 * Update a Restore. (restores.patch) 153 * 154 * @param string $name Output only. The full name of the Restore resource. 155 * Format: projects/locations/restorePlans/restores 156 * @param Restore $postBody 157 * @param array $optParams Optional parameters. 158 * 159 * @opt_param string updateMask This is used to specify the fields to be 160 * overwritten in the Restore targeted for update. The values for each of these 161 * updated fields will be taken from the `restore` provided with this request. 162 * Field names are relative to the root of the resource. If no `update_mask` is 163 * provided, all fields in `restore` will be written to the target Restore 164 * resource. Note that OUTPUT_ONLY and IMMUTABLE fields in `restore` are ignored 165 * and are not used to update the target Restore. 166 * @return GoogleLongrunningOperation 167 */ 168 public function patch($name, Restore $postBody, $optParams = []) 169 { 170 $params = ['name' => $name, 'postBody' => $postBody]; 171 $params = array_merge($params, $optParams); 172 return $this->call('patch', [$params], GoogleLongrunningOperation::class); 173 } 174 /** 175 * Sets the access control policy on the specified resource. Replaces any 176 * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and 177 * `PERMISSION_DENIED` errors. (restores.setIamPolicy) 178 * 179 * @param string $resource REQUIRED: The resource for which the policy is being 180 * specified. See the operation documentation for the appropriate value for this 181 * field. 182 * @param SetIamPolicyRequest $postBody 183 * @param array $optParams Optional parameters. 184 * @return Policy 185 */ 186 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 187 { 188 $params = ['resource' => $resource, 'postBody' => $postBody]; 189 $params = array_merge($params, $optParams); 190 return $this->call('setIamPolicy', [$params], Policy::class); 191 } 192 /** 193 * Returns permissions that a caller has on the specified resource. If the 194 * resource does not exist, this will return an empty set of permissions, not a 195 * `NOT_FOUND` error. Note: This operation is designed to be used for building 196 * permission-aware UIs and command-line tools, not for authorization checking. 197 * This operation may "fail open" without warning. (restores.testIamPermissions) 198 * 199 * @param string $resource REQUIRED: The resource for which the policy detail is 200 * being requested. See the operation documentation for the appropriate value 201 * for this field. 202 * @param TestIamPermissionsRequest $postBody 203 * @param array $optParams Optional parameters. 204 * @return TestIamPermissionsResponse 205 */ 206 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 207 { 208 $params = ['resource' => $resource, 'postBody' => $postBody]; 209 $params = array_merge($params, $optParams); 210 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 211 } 212} 213 214// Adding a class alias for backwards compatibility with the previous class name. 215class_alias(ProjectsLocationsRestorePlansRestores::class, 'Google_Service_BackupforGKE_Resource_ProjectsLocationsRestorePlansRestores'); 216