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\Appengine\Resource; 19 20use Google\Service\Appengine\DebugInstanceRequest; 21use Google\Service\Appengine\Instance; 22use Google\Service\Appengine\ListInstancesResponse; 23use Google\Service\Appengine\Operation; 24 25/** 26 * The "instances" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $appengineService = new Google\Service\Appengine(...); 30 * $instances = $appengineService->instances; 31 * </code> 32 */ 33class AppsServicesVersionsInstances extends \Google\Service\Resource 34{ 35 /** 36 * Enables debugging on a VM instance. This allows you to use the SSH command to 37 * connect to the virtual machine where the instance lives. While in "debug 38 * mode", the instance continues to serve live traffic. You should delete the 39 * instance when you are done debugging and then allow the system to take over 40 * and determine if another instance should be started.Only applicable for 41 * instances in App Engine flexible environment. (instances.debug) 42 * 43 * @param string $appsId Part of `name`. Name of the resource requested. 44 * Example: apps/myapp/services/default/versions/v1/instances/instance-1. 45 * @param string $servicesId Part of `name`. See documentation of `appsId`. 46 * @param string $versionsId Part of `name`. See documentation of `appsId`. 47 * @param string $instancesId Part of `name`. See documentation of `appsId`. 48 * @param DebugInstanceRequest $postBody 49 * @param array $optParams Optional parameters. 50 * @return Operation 51 */ 52 public function debug($appsId, $servicesId, $versionsId, $instancesId, DebugInstanceRequest $postBody, $optParams = []) 53 { 54 $params = ['appsId' => $appsId, 'servicesId' => $servicesId, 'versionsId' => $versionsId, 'instancesId' => $instancesId, 'postBody' => $postBody]; 55 $params = array_merge($params, $optParams); 56 return $this->call('debug', [$params], Operation::class); 57 } 58 /** 59 * Stops a running instance.The instance might be automatically recreated based 60 * on the scaling settings of the version. For more information, see "How 61 * Instances are Managed" (standard environment 62 * (https://cloud.google.com/appengine/docs/standard/python/how-instances-are- 63 * managed) | flexible environment 64 * (https://cloud.google.com/appengine/docs/flexible/python/how-instances-are- 65 * managed)).To ensure that instances are not re-created and avoid getting 66 * billed, you can stop all instances within the target version by changing the 67 * serving status of the version to STOPPED with the 68 * apps.services.versions.patch (https://cloud.google.com/appengine/docs/admin- 69 * api/reference/rest/v1/apps.services.versions/patch) method. 70 * (instances.delete) 71 * 72 * @param string $appsId Part of `name`. Name of the resource requested. 73 * Example: apps/myapp/services/default/versions/v1/instances/instance-1. 74 * @param string $servicesId Part of `name`. See documentation of `appsId`. 75 * @param string $versionsId Part of `name`. See documentation of `appsId`. 76 * @param string $instancesId Part of `name`. See documentation of `appsId`. 77 * @param array $optParams Optional parameters. 78 * @return Operation 79 */ 80 public function delete($appsId, $servicesId, $versionsId, $instancesId, $optParams = []) 81 { 82 $params = ['appsId' => $appsId, 'servicesId' => $servicesId, 'versionsId' => $versionsId, 'instancesId' => $instancesId]; 83 $params = array_merge($params, $optParams); 84 return $this->call('delete', [$params], Operation::class); 85 } 86 /** 87 * Gets instance information. (instances.get) 88 * 89 * @param string $appsId Part of `name`. Name of the resource requested. 90 * Example: apps/myapp/services/default/versions/v1/instances/instance-1. 91 * @param string $servicesId Part of `name`. See documentation of `appsId`. 92 * @param string $versionsId Part of `name`. See documentation of `appsId`. 93 * @param string $instancesId Part of `name`. See documentation of `appsId`. 94 * @param array $optParams Optional parameters. 95 * @return Instance 96 */ 97 public function get($appsId, $servicesId, $versionsId, $instancesId, $optParams = []) 98 { 99 $params = ['appsId' => $appsId, 'servicesId' => $servicesId, 'versionsId' => $versionsId, 'instancesId' => $instancesId]; 100 $params = array_merge($params, $optParams); 101 return $this->call('get', [$params], Instance::class); 102 } 103 /** 104 * Lists the instances of a version.Tip: To aggregate details about instances 105 * over time, see the Stackdriver Monitoring API (https://cloud.google.com/monit 106 * oring/api/ref_v3/rest/v3/projects.timeSeries/list). 107 * (instances.listAppsServicesVersionsInstances) 108 * 109 * @param string $appsId Part of `parent`. Name of the parent Version resource. 110 * Example: apps/myapp/services/default/versions/v1. 111 * @param string $servicesId Part of `parent`. See documentation of `appsId`. 112 * @param string $versionsId Part of `parent`. See documentation of `appsId`. 113 * @param array $optParams Optional parameters. 114 * 115 * @opt_param int pageSize Maximum results to return per page. 116 * @opt_param string pageToken Continuation token for fetching the next page of 117 * results. 118 * @return ListInstancesResponse 119 */ 120 public function listAppsServicesVersionsInstances($appsId, $servicesId, $versionsId, $optParams = []) 121 { 122 $params = ['appsId' => $appsId, 'servicesId' => $servicesId, 'versionsId' => $versionsId]; 123 $params = array_merge($params, $optParams); 124 return $this->call('list', [$params], ListInstancesResponse::class); 125 } 126} 127 128// Adding a class alias for backwards compatibility with the previous class name. 129class_alias(AppsServicesVersionsInstances::class, 'Google_Service_Appengine_Resource_AppsServicesVersionsInstances'); 130