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\CloudFilestore\Resource; 19 20use Google\Service\CloudFilestore\Instance; 21use Google\Service\CloudFilestore\ListInstancesResponse; 22use Google\Service\CloudFilestore\Operation; 23use Google\Service\CloudFilestore\RestoreInstanceRequest; 24 25/** 26 * The "instances" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $fileService = new Google\Service\CloudFilestore(...); 30 * $instances = $fileService->instances; 31 * </code> 32 */ 33class ProjectsLocationsInstances extends \Google\Service\Resource 34{ 35 /** 36 * Creates an instance. When creating from a backup, the capacity of the new 37 * instance needs to be equal to or larger than the capacity of the backup (and 38 * also equal to or larger than the minimum capacity of the tier). 39 * (instances.create) 40 * 41 * @param string $parent Required. The instance's project and location, in the 42 * format `projects/{project_id}/locations/{location}`. In Cloud Filestore, 43 * locations map to GCP zones, for example **us-west1-b**. 44 * @param Instance $postBody 45 * @param array $optParams Optional parameters. 46 * 47 * @opt_param string instanceId Required. The name of the instance to create. 48 * The name must be unique for the specified project and location. 49 * @return Operation 50 */ 51 public function create($parent, Instance $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 an instance. (instances.delete) 59 * 60 * @param string $name Required. The instance resource name, in the format 61 * `projects/{project_id}/locations/{location}/instances/{instance_id}` 62 * @param array $optParams Optional parameters. 63 * 64 * @opt_param bool force If set to true, all snapshots of the instance will also 65 * be deleted. (Otherwise, the request will only work if the instance has no 66 * snapshots.) 67 * @return Operation 68 */ 69 public function delete($name, $optParams = []) 70 { 71 $params = ['name' => $name]; 72 $params = array_merge($params, $optParams); 73 return $this->call('delete', [$params], Operation::class); 74 } 75 /** 76 * Gets the details of a specific instance. (instances.get) 77 * 78 * @param string $name Required. The instance resource name, in the format 79 * `projects/{project_id}/locations/{location}/instances/{instance_id}`. 80 * @param array $optParams Optional parameters. 81 * @return Instance 82 */ 83 public function get($name, $optParams = []) 84 { 85 $params = ['name' => $name]; 86 $params = array_merge($params, $optParams); 87 return $this->call('get', [$params], Instance::class); 88 } 89 /** 90 * Lists all instances in a project for either a specified location or for all 91 * locations. (instances.listProjectsLocationsInstances) 92 * 93 * @param string $parent Required. The project and location for which to 94 * retrieve instance information, in the format 95 * `projects/{project_id}/locations/{location}`. In Cloud Filestore, locations 96 * map to GCP zones, for example **us-west1-b**. To retrieve instance 97 * information for all locations, use "-" for the `{location}` value. 98 * @param array $optParams Optional parameters. 99 * 100 * @opt_param string filter List filter. 101 * @opt_param string orderBy Sort results. Supported values are "name", "name 102 * desc" or "" (unsorted). 103 * @opt_param int pageSize The maximum number of items to return. 104 * @opt_param string pageToken The next_page_token value to use if there are 105 * additional results to retrieve for this list request. 106 * @return ListInstancesResponse 107 */ 108 public function listProjectsLocationsInstances($parent, $optParams = []) 109 { 110 $params = ['parent' => $parent]; 111 $params = array_merge($params, $optParams); 112 return $this->call('list', [$params], ListInstancesResponse::class); 113 } 114 /** 115 * Updates the settings of a specific instance. (instances.patch) 116 * 117 * @param string $name Output only. The resource name of the instance, in the 118 * format `projects/{project}/locations/{location}/instances/{instance}`. 119 * @param Instance $postBody 120 * @param array $optParams Optional parameters. 121 * 122 * @opt_param string updateMask Mask of fields to update. At least one path must 123 * be supplied in this field. The elements of the repeated paths field may only 124 * include these fields: * "description" * "file_shares" * "labels" 125 * @return Operation 126 */ 127 public function patch($name, Instance $postBody, $optParams = []) 128 { 129 $params = ['name' => $name, 'postBody' => $postBody]; 130 $params = array_merge($params, $optParams); 131 return $this->call('patch', [$params], Operation::class); 132 } 133 /** 134 * Restores an existing instance's file share from a backup. The capacity of the 135 * instance needs to be equal to or larger than the capacity of the backup (and 136 * also equal to or larger than the minimum capacity of the tier). 137 * (instances.restore) 138 * 139 * @param string $name Required. The resource name of the instance, in the 140 * format 141 * `projects/{project_number}/locations/{location_id}/instances/{instance_id}`. 142 * @param RestoreInstanceRequest $postBody 143 * @param array $optParams Optional parameters. 144 * @return Operation 145 */ 146 public function restore($name, RestoreInstanceRequest $postBody, $optParams = []) 147 { 148 $params = ['name' => $name, 'postBody' => $postBody]; 149 $params = array_merge($params, $optParams); 150 return $this->call('restore', [$params], Operation::class); 151 } 152} 153 154// Adding a class alias for backwards compatibility with the previous class name. 155class_alias(ProjectsLocationsInstances::class, 'Google_Service_CloudFilestore_Resource_ProjectsLocationsInstances'); 156