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\CloudMemorystoreforMemcached\Resource; 19 20use Google\Service\CloudMemorystoreforMemcached\ApplyParametersRequest; 21use Google\Service\CloudMemorystoreforMemcached\Instance; 22use Google\Service\CloudMemorystoreforMemcached\ListInstancesResponse; 23use Google\Service\CloudMemorystoreforMemcached\Operation; 24use Google\Service\CloudMemorystoreforMemcached\UpdateParametersRequest; 25 26/** 27 * The "instances" collection of methods. 28 * Typical usage is: 29 * <code> 30 * $memcacheService = new Google\Service\CloudMemorystoreforMemcached(...); 31 * $instances = $memcacheService->instances; 32 * </code> 33 */ 34class ProjectsLocationsInstances extends \Google\Service\Resource 35{ 36 /** 37 * `ApplyParameters` restarts the set of specified nodes in order to update them 38 * to the current set of parameters for the Memcached Instance. 39 * (instances.applyParameters) 40 * 41 * @param string $name Required. Resource name of the Memcached instance for 42 * which parameter group updates should be applied. 43 * @param ApplyParametersRequest $postBody 44 * @param array $optParams Optional parameters. 45 * @return Operation 46 */ 47 public function applyParameters($name, ApplyParametersRequest $postBody, $optParams = []) 48 { 49 $params = ['name' => $name, 'postBody' => $postBody]; 50 $params = array_merge($params, $optParams); 51 return $this->call('applyParameters', [$params], Operation::class); 52 } 53 /** 54 * Creates a new Instance in a given location. (instances.create) 55 * 56 * @param string $parent Required. The resource name of the instance location 57 * using the form: `projects/{project_id}/locations/{location_id}` where 58 * `location_id` refers to a GCP region 59 * @param Instance $postBody 60 * @param array $optParams Optional parameters. 61 * 62 * @opt_param string instanceId Required. The logical name of the Memcached 63 * instance in the user project with the following restrictions: * Must contain 64 * only lowercase letters, numbers, and hyphens. * Must start with a letter. * 65 * Must be between 1-40 characters. * Must end with a number or a letter. * Must 66 * be unique within the user project / location. If any of the above are not 67 * met, the API raises an invalid argument error. 68 * @return Operation 69 */ 70 public function create($parent, Instance $postBody, $optParams = []) 71 { 72 $params = ['parent' => $parent, 'postBody' => $postBody]; 73 $params = array_merge($params, $optParams); 74 return $this->call('create', [$params], Operation::class); 75 } 76 /** 77 * Deletes a single Instance. (instances.delete) 78 * 79 * @param string $name Required. Memcached instance resource name in the format: 80 * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where 81 * `location_id` refers to a GCP region 82 * @param array $optParams Optional parameters. 83 * @return Operation 84 */ 85 public function delete($name, $optParams = []) 86 { 87 $params = ['name' => $name]; 88 $params = array_merge($params, $optParams); 89 return $this->call('delete', [$params], Operation::class); 90 } 91 /** 92 * Gets details of a single Instance. (instances.get) 93 * 94 * @param string $name Required. Memcached instance resource name in the format: 95 * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where 96 * `location_id` refers to a GCP region 97 * @param array $optParams Optional parameters. 98 * @return Instance 99 */ 100 public function get($name, $optParams = []) 101 { 102 $params = ['name' => $name]; 103 $params = array_merge($params, $optParams); 104 return $this->call('get', [$params], Instance::class); 105 } 106 /** 107 * Lists Instances in a given location. 108 * (instances.listProjectsLocationsInstances) 109 * 110 * @param string $parent Required. The resource name of the instance location 111 * using the form: `projects/{project_id}/locations/{location_id}` where 112 * `location_id` refers to a GCP region 113 * @param array $optParams Optional parameters. 114 * 115 * @opt_param string filter List filter. For example, exclude all Memcached 116 * instances with name as my-instance by specifying `"name != my-instance"`. 117 * @opt_param string orderBy Sort results. Supported values are "name", "name 118 * desc" or "" (unsorted). 119 * @opt_param int pageSize The maximum number of items to return. If not 120 * specified, a default value of 1000 will be used by the service. Regardless of 121 * the `page_size` value, the response may include a partial list and a caller 122 * should only rely on response's `next_page_token` to determine if there are 123 * more instances left to be queried. 124 * @opt_param string pageToken The `next_page_token` value returned from a 125 * previous List request, if any. 126 * @return ListInstancesResponse 127 */ 128 public function listProjectsLocationsInstances($parent, $optParams = []) 129 { 130 $params = ['parent' => $parent]; 131 $params = array_merge($params, $optParams); 132 return $this->call('list', [$params], ListInstancesResponse::class); 133 } 134 /** 135 * Updates an existing Instance in a given project and location. 136 * (instances.patch) 137 * 138 * @param string $name Required. Unique name of the resource in this scope 139 * including project and location using the form: 140 * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` Note: 141 * Memcached instances are managed and addressed at the regional level so 142 * `location_id` here refers to a Google Cloud region; however, users may choose 143 * which zones Memcached nodes should be provisioned in within an instance. 144 * Refer to zones field for more details. 145 * @param Instance $postBody 146 * @param array $optParams Optional parameters. 147 * 148 * @opt_param string updateMask Required. Mask of fields to update. * 149 * `displayName` 150 * @return Operation 151 */ 152 public function patch($name, Instance $postBody, $optParams = []) 153 { 154 $params = ['name' => $name, 'postBody' => $postBody]; 155 $params = array_merge($params, $optParams); 156 return $this->call('patch', [$params], Operation::class); 157 } 158 /** 159 * Updates the defined Memcached parameters for an existing instance. This 160 * method only stages the parameters, it must be followed by `ApplyParameters` 161 * to apply the parameters to nodes of the Memcached instance. 162 * (instances.updateParameters) 163 * 164 * @param string $name Required. Resource name of the Memcached instance for 165 * which the parameters should be updated. 166 * @param UpdateParametersRequest $postBody 167 * @param array $optParams Optional parameters. 168 * @return Operation 169 */ 170 public function updateParameters($name, UpdateParametersRequest $postBody, $optParams = []) 171 { 172 $params = ['name' => $name, 'postBody' => $postBody]; 173 $params = array_merge($params, $optParams); 174 return $this->call('updateParameters', [$params], Operation::class); 175 } 176} 177 178// Adding a class alias for backwards compatibility with the previous class name. 179class_alias(ProjectsLocationsInstances::class, 'Google_Service_CloudMemorystoreforMemcached_Resource_ProjectsLocationsInstances'); 180