1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="compute_alpha.html">Compute Engine API</a> . <a href="compute_alpha.autoscalers.html">autoscalers</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#aggregatedList">aggregatedList(project, orderBy=None, maxResults=None, pageToken=None, filter=None)</a></code></p> 79<p class="firstline">Retrieves an aggregated list of autoscalers.</p> 80<p class="toc_element"> 81 <code><a href="#aggregatedList_next">aggregatedList_next(previous_request, previous_response)</a></code></p> 82<p class="firstline">Retrieves the next page of results.</p> 83<p class="toc_element"> 84 <code><a href="#delete">delete(project, zone, autoscaler, requestId=None)</a></code></p> 85<p class="firstline">Deletes the specified autoscaler.</p> 86<p class="toc_element"> 87 <code><a href="#get">get(project, zone, autoscaler)</a></code></p> 88<p class="firstline">Returns the specified autoscaler resource. Gets a list of available autoscalers by making a list() request.</p> 89<p class="toc_element"> 90 <code><a href="#insert">insert(project, zone, body, requestId=None)</a></code></p> 91<p class="firstline">Creates an autoscaler in the specified project using the data included in the request.</p> 92<p class="toc_element"> 93 <code><a href="#list">list(project, zone, orderBy=None, maxResults=None, pageToken=None, filter=None)</a></code></p> 94<p class="firstline">Retrieves a list of autoscalers contained within the specified zone.</p> 95<p class="toc_element"> 96 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> 97<p class="firstline">Retrieves the next page of results.</p> 98<p class="toc_element"> 99 <code><a href="#patch">patch(project, zone, body, requestId=None, autoscaler=None)</a></code></p> 100<p class="firstline">Updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.</p> 101<p class="toc_element"> 102 <code><a href="#testIamPermissions">testIamPermissions(project, zone, resource, body)</a></code></p> 103<p class="firstline">Returns permissions that a caller has on the specified resource.</p> 104<p class="toc_element"> 105 <code><a href="#update">update(project, zone, body, requestId=None, autoscaler=None)</a></code></p> 106<p class="firstline">Updates an autoscaler in the specified project using the data included in the request.</p> 107<h3>Method Details</h3> 108<div class="method"> 109 <code class="details" id="aggregatedList">aggregatedList(project, orderBy=None, maxResults=None, pageToken=None, filter=None)</code> 110 <pre>Retrieves an aggregated list of autoscalers. 111 112Args: 113 project: string, Project ID for this request. (required) 114 orderBy: string, Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. 115 116You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. 117 118Currently, only sorting by name or creationTimestamp desc is supported. 119 maxResults: integer, The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) 120 pageToken: string, Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. 121 filter: string, A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. 122 123For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. 124 125You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. 126 127To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). 128 129Returns: 130 An object of the form: 131 132 { 133 "nextPageToken": "A String", # [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. 134 "kind": "compute#autoscalerAggregatedList", # [Output Only] Type of resource. Always compute#autoscalerAggregatedList for aggregated lists of autoscalers. 135 "items": { # A list of AutoscalersScopedList resources. 136 "a_key": { # [Output Only] Name of the scope containing this set of autoscalers. 137 "warning": { # [Output Only] Informational warning which replaces the list of autoscalers when the list is empty. 138 "message": "A String", # [Output Only] A human-readable description of the warning code. 139 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 140 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 141 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 142 { 143 "value": "A String", # [Output Only] A warning data value corresponding to the key. 144 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 145 }, 146 ], 147 }, 148 "autoscalers": [ # [Output Only] A list of autoscalers contained in this scope. 149 { # Represents an Autoscaler resource. 150 # 151 # 152 # 153 # Use autoscalers to automatically add or delete instances from a managed instance group according to your defined autoscaling policy. For more information, read Autoscaling Groups of Instances. 154 # 155 # For zonal managed instance groups resource, use the autoscaler resource. 156 # 157 # For regional managed instance groups, use the regionAutoscalers resource. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) 158 "status": "A String", # [Output Only] The status of the autoscaler configuration. 159 "recommendedSize": 42, # [Output Only] Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates recommended MIG size even when autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to the existing managed instance group or autoscaler did not generate its prediction. 160 "kind": "compute#autoscaler", # [Output Only] Type of the resource. Always compute#autoscaler for autoscalers. 161 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 162 "zone": "A String", # [Output Only] URL of the zone where the instance group resides (for autoscalers living in zonal scope). 163 "region": "A String", # [Output Only] URL of the region where the instance group resides (for autoscalers living in regional scope). 164 "autoscalingPolicy": { # Cloud Autoscaler policy. # The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. 165 # 166 # If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. 167 "maxNumReplicas": 42, # The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas. 168 "coolDownPeriodSec": 42, # The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. 169 # 170 # Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process. 171 "loadBalancingUtilization": { # Configuration parameters of autoscaling based on load balancing. # Configuration parameters of autoscaling based on load balancer. 172 "utilizationTarget": 3.14, # Fraction of backend capacity utilization (set in HTTP(S) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. 173 }, 174 "queueBasedScaling": { # Configuration parameters of autoscaling based on queuing system. # Configuration parameters of autoscaling based on queuing system. 175 "acceptableBacklogPerInstance": 3.14, # Scaling based on the average number of tasks in the queue per each active instance. The autoscaler keeps the average number of tasks per instance below this number, based on data collected in the last couple of minutes. The autoscaler will also take into account incoming tasks when calculating when to scale. 176 "singleWorkerThroughputPerSec": 3.14, # The scaling algorithm will also calculate throughput estimates on its own; if you explicitly provide this value, the autoscaler will take into account your value as well as automatic estimates when deciding how to scale. 177 "cloudPubSub": { # Configuration parameters for scaling based on Cloud Pub/Sub subscription queue. # Configuration for Cloud Pub/Sub subscription queue. 178 "topic": "A String", # Cloud Pub/Sub topic used for scaling. Provide the partial URL or partial URL (starting with projects/) or just the topic name. The topic must belong to the same project as the Autoscaler resource. 179 "subscription": "A String", # Cloud Pub/Sub subscription used for scaling. Provide the partial URL (starting with projects/) or just the subscription name. The subscription must be assigned to the topic specified in topicName and must be in a pull configuration. The subscription must belong to the same project as the Autoscaler. 180 }, 181 }, 182 "customMetricUtilizations": [ # Configuration parameters of autoscaling based on a custom metric. 183 { # Custom utilization metric policy. 184 "filter": "A String", # A filter string, compatible with a Stackdriver Monitoring filter string for TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. 185 # 186 # For the filter to be valid for autoscaling purposes, the following rules apply: 187 # - You can only use the AND operator for joining selectors. 188 # - You can only use direct equality comparison operator (=) without any functions for each selector. 189 # - You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. 190 # - The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. 191 # If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. 192 # 193 # If not specified, the type defaults to gce_instance. 194 # 195 # You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value. 196 "metric": "A String", # The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. 197 # 198 # The metric must have a value type of INT64 or DOUBLE. 199 "singleInstanceAssignment": 3.14, # If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. Autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. 200 # 201 # A good metric to use with the target is for example pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. 202 # 203 # A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead. 204 "utilizationTarget": 3.14, # The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. 205 # 206 # For example, a good metric to use as a utilization_target is compute.googleapis.com/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances. 207 "utilizationTargetType": "A String", # Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. 208 }, 209 ], 210 "mode": "A String", # Defines operating mode for this policy. 211 "cpuUtilization": { # CPU utilization policy. # Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. 212 "utilizationTarget": 3.14, # The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. 213 # 214 # If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. 215 # 216 # If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization. 217 }, 218 "minNumReplicas": 42, # The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed. 219 "scaleDownControl": { # Configuration that allows for slower scale down so that even if Autoscaler recommends an abrupt scale down of a MIG, it will be throttled as specified by the parameters below. 220 "maxScaledDownReplicas": { # Encapsulates numeric value that can be either absolute or relative. # Maximum allowed number (or %) of VMs that can be deducted from the peak recommendation during the window autoscaler looks at when computing recommendations. Possibly all these VMs can be deleted at once so user service needs to be prepared to lose that many VMs in one step. 221 "calculated": 42, # [Output Only] Absolute value of VM instances calculated based on the specific mode. 222 # 223 # 224 # - If the value is fixed, then the calculated value is equal to the fixed value. 225 # - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded up. 226 "fixed": 42, # Specifies a fixed number of VM instances. This must be a positive integer. 227 "percent": 42, # Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%. 228 }, 229 "timeWindowSec": 42, # How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above. 230 }, 231 }, 232 "target": "A String", # URL of the managed instance group that this autoscaler will scale. 233 "statusDetails": [ # [Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter. 234 { 235 "message": "A String", # The status message. 236 "type": "A String", # The type of error returned. 237 }, 238 ], 239 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 240 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 241 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 242 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 243 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 244 }, 245 ], 246 }, 247 }, 248 "warning": { # [Output Only] Informational warning message. 249 "message": "A String", # [Output Only] A human-readable description of the warning code. 250 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 251 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 252 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 253 { 254 "value": "A String", # [Output Only] A warning data value corresponding to the key. 255 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 256 }, 257 ], 258 }, 259 "id": "A String", # [Output Only] Unique identifier for the resource; defined by the server. 260 "selfLink": "A String", # [Output Only] Server-defined URL for this resource. 261 }</pre> 262</div> 263 264<div class="method"> 265 <code class="details" id="aggregatedList_next">aggregatedList_next(previous_request, previous_response)</code> 266 <pre>Retrieves the next page of results. 267 268Args: 269 previous_request: The request for the previous page. (required) 270 previous_response: The response from the request for the previous page. (required) 271 272Returns: 273 A request object that you can call 'execute()' on to request the next 274 page. Returns None if there are no more items in the collection. 275 </pre> 276</div> 277 278<div class="method"> 279 <code class="details" id="delete">delete(project, zone, autoscaler, requestId=None)</code> 280 <pre>Deletes the specified autoscaler. 281 282Args: 283 project: string, Project ID for this request. (required) 284 zone: string, Name of the zone for this request. (required) 285 autoscaler: string, Name of the autoscaler to delete. (required) 286 requestId: string, An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. 287 288For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. 289 290The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). 291 292Returns: 293 An object of the form: 294 295 { # Represents an Operation resource. 296 # 297 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 298 # 299 # Operations can be global, regional or zonal. 300 # - For global operations, use the globalOperations resource. 301 # - For regional operations, use the regionOperations resource. 302 # - For zonal operations, use the zonalOperations resource. 303 # 304 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 305 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 306 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 307 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 308 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 309 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 310 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 311 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 312 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 313 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 314 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. 315 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 316 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 317 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 318 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 319 { 320 "message": "A String", # [Output Only] A human-readable description of the warning code. 321 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 322 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 323 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 324 { 325 "value": "A String", # [Output Only] A warning data value corresponding to the key. 326 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 327 }, 328 ], 329 }, 330 ], 331 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 332 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 333 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 334 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 335 "name": "A String", # [Output Only] Name of the resource. 336 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 337 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 338 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 339 { 340 "message": "A String", # [Output Only] An optional, human-readable error message. 341 "code": "A String", # [Output Only] The error type identifier for this error. 342 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 343 }, 344 ], 345 }, 346 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 347 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 348 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 349 }</pre> 350</div> 351 352<div class="method"> 353 <code class="details" id="get">get(project, zone, autoscaler)</code> 354 <pre>Returns the specified autoscaler resource. Gets a list of available autoscalers by making a list() request. 355 356Args: 357 project: string, Project ID for this request. (required) 358 zone: string, Name of the zone for this request. (required) 359 autoscaler: string, Name of the autoscaler to return. (required) 360 361Returns: 362 An object of the form: 363 364 { # Represents an Autoscaler resource. 365 # 366 # 367 # 368 # Use autoscalers to automatically add or delete instances from a managed instance group according to your defined autoscaling policy. For more information, read Autoscaling Groups of Instances. 369 # 370 # For zonal managed instance groups resource, use the autoscaler resource. 371 # 372 # For regional managed instance groups, use the regionAutoscalers resource. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) 373 "status": "A String", # [Output Only] The status of the autoscaler configuration. 374 "recommendedSize": 42, # [Output Only] Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates recommended MIG size even when autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to the existing managed instance group or autoscaler did not generate its prediction. 375 "kind": "compute#autoscaler", # [Output Only] Type of the resource. Always compute#autoscaler for autoscalers. 376 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 377 "zone": "A String", # [Output Only] URL of the zone where the instance group resides (for autoscalers living in zonal scope). 378 "region": "A String", # [Output Only] URL of the region where the instance group resides (for autoscalers living in regional scope). 379 "autoscalingPolicy": { # Cloud Autoscaler policy. # The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. 380 # 381 # If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. 382 "maxNumReplicas": 42, # The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas. 383 "coolDownPeriodSec": 42, # The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. 384 # 385 # Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process. 386 "loadBalancingUtilization": { # Configuration parameters of autoscaling based on load balancing. # Configuration parameters of autoscaling based on load balancer. 387 "utilizationTarget": 3.14, # Fraction of backend capacity utilization (set in HTTP(S) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. 388 }, 389 "queueBasedScaling": { # Configuration parameters of autoscaling based on queuing system. # Configuration parameters of autoscaling based on queuing system. 390 "acceptableBacklogPerInstance": 3.14, # Scaling based on the average number of tasks in the queue per each active instance. The autoscaler keeps the average number of tasks per instance below this number, based on data collected in the last couple of minutes. The autoscaler will also take into account incoming tasks when calculating when to scale. 391 "singleWorkerThroughputPerSec": 3.14, # The scaling algorithm will also calculate throughput estimates on its own; if you explicitly provide this value, the autoscaler will take into account your value as well as automatic estimates when deciding how to scale. 392 "cloudPubSub": { # Configuration parameters for scaling based on Cloud Pub/Sub subscription queue. # Configuration for Cloud Pub/Sub subscription queue. 393 "topic": "A String", # Cloud Pub/Sub topic used for scaling. Provide the partial URL or partial URL (starting with projects/) or just the topic name. The topic must belong to the same project as the Autoscaler resource. 394 "subscription": "A String", # Cloud Pub/Sub subscription used for scaling. Provide the partial URL (starting with projects/) or just the subscription name. The subscription must be assigned to the topic specified in topicName and must be in a pull configuration. The subscription must belong to the same project as the Autoscaler. 395 }, 396 }, 397 "customMetricUtilizations": [ # Configuration parameters of autoscaling based on a custom metric. 398 { # Custom utilization metric policy. 399 "filter": "A String", # A filter string, compatible with a Stackdriver Monitoring filter string for TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. 400 # 401 # For the filter to be valid for autoscaling purposes, the following rules apply: 402 # - You can only use the AND operator for joining selectors. 403 # - You can only use direct equality comparison operator (=) without any functions for each selector. 404 # - You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. 405 # - The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. 406 # If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. 407 # 408 # If not specified, the type defaults to gce_instance. 409 # 410 # You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value. 411 "metric": "A String", # The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. 412 # 413 # The metric must have a value type of INT64 or DOUBLE. 414 "singleInstanceAssignment": 3.14, # If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. Autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. 415 # 416 # A good metric to use with the target is for example pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. 417 # 418 # A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead. 419 "utilizationTarget": 3.14, # The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. 420 # 421 # For example, a good metric to use as a utilization_target is compute.googleapis.com/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances. 422 "utilizationTargetType": "A String", # Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. 423 }, 424 ], 425 "mode": "A String", # Defines operating mode for this policy. 426 "cpuUtilization": { # CPU utilization policy. # Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. 427 "utilizationTarget": 3.14, # The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. 428 # 429 # If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. 430 # 431 # If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization. 432 }, 433 "minNumReplicas": 42, # The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed. 434 "scaleDownControl": { # Configuration that allows for slower scale down so that even if Autoscaler recommends an abrupt scale down of a MIG, it will be throttled as specified by the parameters below. 435 "maxScaledDownReplicas": { # Encapsulates numeric value that can be either absolute or relative. # Maximum allowed number (or %) of VMs that can be deducted from the peak recommendation during the window autoscaler looks at when computing recommendations. Possibly all these VMs can be deleted at once so user service needs to be prepared to lose that many VMs in one step. 436 "calculated": 42, # [Output Only] Absolute value of VM instances calculated based on the specific mode. 437 # 438 # 439 # - If the value is fixed, then the calculated value is equal to the fixed value. 440 # - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded up. 441 "fixed": 42, # Specifies a fixed number of VM instances. This must be a positive integer. 442 "percent": 42, # Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%. 443 }, 444 "timeWindowSec": 42, # How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above. 445 }, 446 }, 447 "target": "A String", # URL of the managed instance group that this autoscaler will scale. 448 "statusDetails": [ # [Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter. 449 { 450 "message": "A String", # The status message. 451 "type": "A String", # The type of error returned. 452 }, 453 ], 454 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 455 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 456 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 457 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 458 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 459 }</pre> 460</div> 461 462<div class="method"> 463 <code class="details" id="insert">insert(project, zone, body, requestId=None)</code> 464 <pre>Creates an autoscaler in the specified project using the data included in the request. 465 466Args: 467 project: string, Project ID for this request. (required) 468 zone: string, Name of the zone for this request. (required) 469 body: object, The request body. (required) 470 The object takes the form of: 471 472{ # Represents an Autoscaler resource. 473 # 474 # 475 # 476 # Use autoscalers to automatically add or delete instances from a managed instance group according to your defined autoscaling policy. For more information, read Autoscaling Groups of Instances. 477 # 478 # For zonal managed instance groups resource, use the autoscaler resource. 479 # 480 # For regional managed instance groups, use the regionAutoscalers resource. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) 481 "status": "A String", # [Output Only] The status of the autoscaler configuration. 482 "recommendedSize": 42, # [Output Only] Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates recommended MIG size even when autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to the existing managed instance group or autoscaler did not generate its prediction. 483 "kind": "compute#autoscaler", # [Output Only] Type of the resource. Always compute#autoscaler for autoscalers. 484 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 485 "zone": "A String", # [Output Only] URL of the zone where the instance group resides (for autoscalers living in zonal scope). 486 "region": "A String", # [Output Only] URL of the region where the instance group resides (for autoscalers living in regional scope). 487 "autoscalingPolicy": { # Cloud Autoscaler policy. # The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. 488 # 489 # If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. 490 "maxNumReplicas": 42, # The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas. 491 "coolDownPeriodSec": 42, # The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. 492 # 493 # Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process. 494 "loadBalancingUtilization": { # Configuration parameters of autoscaling based on load balancing. # Configuration parameters of autoscaling based on load balancer. 495 "utilizationTarget": 3.14, # Fraction of backend capacity utilization (set in HTTP(S) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. 496 }, 497 "queueBasedScaling": { # Configuration parameters of autoscaling based on queuing system. # Configuration parameters of autoscaling based on queuing system. 498 "acceptableBacklogPerInstance": 3.14, # Scaling based on the average number of tasks in the queue per each active instance. The autoscaler keeps the average number of tasks per instance below this number, based on data collected in the last couple of minutes. The autoscaler will also take into account incoming tasks when calculating when to scale. 499 "singleWorkerThroughputPerSec": 3.14, # The scaling algorithm will also calculate throughput estimates on its own; if you explicitly provide this value, the autoscaler will take into account your value as well as automatic estimates when deciding how to scale. 500 "cloudPubSub": { # Configuration parameters for scaling based on Cloud Pub/Sub subscription queue. # Configuration for Cloud Pub/Sub subscription queue. 501 "topic": "A String", # Cloud Pub/Sub topic used for scaling. Provide the partial URL or partial URL (starting with projects/) or just the topic name. The topic must belong to the same project as the Autoscaler resource. 502 "subscription": "A String", # Cloud Pub/Sub subscription used for scaling. Provide the partial URL (starting with projects/) or just the subscription name. The subscription must be assigned to the topic specified in topicName and must be in a pull configuration. The subscription must belong to the same project as the Autoscaler. 503 }, 504 }, 505 "customMetricUtilizations": [ # Configuration parameters of autoscaling based on a custom metric. 506 { # Custom utilization metric policy. 507 "filter": "A String", # A filter string, compatible with a Stackdriver Monitoring filter string for TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. 508 # 509 # For the filter to be valid for autoscaling purposes, the following rules apply: 510 # - You can only use the AND operator for joining selectors. 511 # - You can only use direct equality comparison operator (=) without any functions for each selector. 512 # - You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. 513 # - The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. 514 # If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. 515 # 516 # If not specified, the type defaults to gce_instance. 517 # 518 # You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value. 519 "metric": "A String", # The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. 520 # 521 # The metric must have a value type of INT64 or DOUBLE. 522 "singleInstanceAssignment": 3.14, # If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. Autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. 523 # 524 # A good metric to use with the target is for example pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. 525 # 526 # A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead. 527 "utilizationTarget": 3.14, # The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. 528 # 529 # For example, a good metric to use as a utilization_target is compute.googleapis.com/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances. 530 "utilizationTargetType": "A String", # Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. 531 }, 532 ], 533 "mode": "A String", # Defines operating mode for this policy. 534 "cpuUtilization": { # CPU utilization policy. # Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. 535 "utilizationTarget": 3.14, # The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. 536 # 537 # If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. 538 # 539 # If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization. 540 }, 541 "minNumReplicas": 42, # The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed. 542 "scaleDownControl": { # Configuration that allows for slower scale down so that even if Autoscaler recommends an abrupt scale down of a MIG, it will be throttled as specified by the parameters below. 543 "maxScaledDownReplicas": { # Encapsulates numeric value that can be either absolute or relative. # Maximum allowed number (or %) of VMs that can be deducted from the peak recommendation during the window autoscaler looks at when computing recommendations. Possibly all these VMs can be deleted at once so user service needs to be prepared to lose that many VMs in one step. 544 "calculated": 42, # [Output Only] Absolute value of VM instances calculated based on the specific mode. 545 # 546 # 547 # - If the value is fixed, then the calculated value is equal to the fixed value. 548 # - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded up. 549 "fixed": 42, # Specifies a fixed number of VM instances. This must be a positive integer. 550 "percent": 42, # Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%. 551 }, 552 "timeWindowSec": 42, # How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above. 553 }, 554 }, 555 "target": "A String", # URL of the managed instance group that this autoscaler will scale. 556 "statusDetails": [ # [Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter. 557 { 558 "message": "A String", # The status message. 559 "type": "A String", # The type of error returned. 560 }, 561 ], 562 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 563 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 564 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 565 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 566 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 567 } 568 569 requestId: string, An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. 570 571For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. 572 573The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). 574 575Returns: 576 An object of the form: 577 578 { # Represents an Operation resource. 579 # 580 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 581 # 582 # Operations can be global, regional or zonal. 583 # - For global operations, use the globalOperations resource. 584 # - For regional operations, use the regionOperations resource. 585 # - For zonal operations, use the zonalOperations resource. 586 # 587 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 588 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 589 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 590 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 591 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 592 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 593 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 594 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 595 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 596 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 597 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. 598 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 599 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 600 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 601 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 602 { 603 "message": "A String", # [Output Only] A human-readable description of the warning code. 604 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 605 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 606 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 607 { 608 "value": "A String", # [Output Only] A warning data value corresponding to the key. 609 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 610 }, 611 ], 612 }, 613 ], 614 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 615 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 616 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 617 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 618 "name": "A String", # [Output Only] Name of the resource. 619 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 620 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 621 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 622 { 623 "message": "A String", # [Output Only] An optional, human-readable error message. 624 "code": "A String", # [Output Only] The error type identifier for this error. 625 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 626 }, 627 ], 628 }, 629 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 630 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 631 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 632 }</pre> 633</div> 634 635<div class="method"> 636 <code class="details" id="list">list(project, zone, orderBy=None, maxResults=None, pageToken=None, filter=None)</code> 637 <pre>Retrieves a list of autoscalers contained within the specified zone. 638 639Args: 640 project: string, Project ID for this request. (required) 641 zone: string, Name of the zone for this request. (required) 642 orderBy: string, Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. 643 644You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. 645 646Currently, only sorting by name or creationTimestamp desc is supported. 647 maxResults: integer, The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) 648 pageToken: string, Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. 649 filter: string, A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. 650 651For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. 652 653You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. 654 655To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). 656 657Returns: 658 An object of the form: 659 660 { # Contains a list of Autoscaler resources. 661 "nextPageToken": "A String", # [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. 662 "kind": "compute#autoscalerList", # [Output Only] Type of resource. Always compute#autoscalerList for lists of autoscalers. 663 "items": [ # A list of Autoscaler resources. 664 { # Represents an Autoscaler resource. 665 # 666 # 667 # 668 # Use autoscalers to automatically add or delete instances from a managed instance group according to your defined autoscaling policy. For more information, read Autoscaling Groups of Instances. 669 # 670 # For zonal managed instance groups resource, use the autoscaler resource. 671 # 672 # For regional managed instance groups, use the regionAutoscalers resource. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) 673 "status": "A String", # [Output Only] The status of the autoscaler configuration. 674 "recommendedSize": 42, # [Output Only] Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates recommended MIG size even when autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to the existing managed instance group or autoscaler did not generate its prediction. 675 "kind": "compute#autoscaler", # [Output Only] Type of the resource. Always compute#autoscaler for autoscalers. 676 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 677 "zone": "A String", # [Output Only] URL of the zone where the instance group resides (for autoscalers living in zonal scope). 678 "region": "A String", # [Output Only] URL of the region where the instance group resides (for autoscalers living in regional scope). 679 "autoscalingPolicy": { # Cloud Autoscaler policy. # The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. 680 # 681 # If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. 682 "maxNumReplicas": 42, # The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas. 683 "coolDownPeriodSec": 42, # The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. 684 # 685 # Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process. 686 "loadBalancingUtilization": { # Configuration parameters of autoscaling based on load balancing. # Configuration parameters of autoscaling based on load balancer. 687 "utilizationTarget": 3.14, # Fraction of backend capacity utilization (set in HTTP(S) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. 688 }, 689 "queueBasedScaling": { # Configuration parameters of autoscaling based on queuing system. # Configuration parameters of autoscaling based on queuing system. 690 "acceptableBacklogPerInstance": 3.14, # Scaling based on the average number of tasks in the queue per each active instance. The autoscaler keeps the average number of tasks per instance below this number, based on data collected in the last couple of minutes. The autoscaler will also take into account incoming tasks when calculating when to scale. 691 "singleWorkerThroughputPerSec": 3.14, # The scaling algorithm will also calculate throughput estimates on its own; if you explicitly provide this value, the autoscaler will take into account your value as well as automatic estimates when deciding how to scale. 692 "cloudPubSub": { # Configuration parameters for scaling based on Cloud Pub/Sub subscription queue. # Configuration for Cloud Pub/Sub subscription queue. 693 "topic": "A String", # Cloud Pub/Sub topic used for scaling. Provide the partial URL or partial URL (starting with projects/) or just the topic name. The topic must belong to the same project as the Autoscaler resource. 694 "subscription": "A String", # Cloud Pub/Sub subscription used for scaling. Provide the partial URL (starting with projects/) or just the subscription name. The subscription must be assigned to the topic specified in topicName and must be in a pull configuration. The subscription must belong to the same project as the Autoscaler. 695 }, 696 }, 697 "customMetricUtilizations": [ # Configuration parameters of autoscaling based on a custom metric. 698 { # Custom utilization metric policy. 699 "filter": "A String", # A filter string, compatible with a Stackdriver Monitoring filter string for TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. 700 # 701 # For the filter to be valid for autoscaling purposes, the following rules apply: 702 # - You can only use the AND operator for joining selectors. 703 # - You can only use direct equality comparison operator (=) without any functions for each selector. 704 # - You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. 705 # - The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. 706 # If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. 707 # 708 # If not specified, the type defaults to gce_instance. 709 # 710 # You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value. 711 "metric": "A String", # The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. 712 # 713 # The metric must have a value type of INT64 or DOUBLE. 714 "singleInstanceAssignment": 3.14, # If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. Autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. 715 # 716 # A good metric to use with the target is for example pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. 717 # 718 # A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead. 719 "utilizationTarget": 3.14, # The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. 720 # 721 # For example, a good metric to use as a utilization_target is compute.googleapis.com/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances. 722 "utilizationTargetType": "A String", # Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. 723 }, 724 ], 725 "mode": "A String", # Defines operating mode for this policy. 726 "cpuUtilization": { # CPU utilization policy. # Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. 727 "utilizationTarget": 3.14, # The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. 728 # 729 # If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. 730 # 731 # If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization. 732 }, 733 "minNumReplicas": 42, # The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed. 734 "scaleDownControl": { # Configuration that allows for slower scale down so that even if Autoscaler recommends an abrupt scale down of a MIG, it will be throttled as specified by the parameters below. 735 "maxScaledDownReplicas": { # Encapsulates numeric value that can be either absolute or relative. # Maximum allowed number (or %) of VMs that can be deducted from the peak recommendation during the window autoscaler looks at when computing recommendations. Possibly all these VMs can be deleted at once so user service needs to be prepared to lose that many VMs in one step. 736 "calculated": 42, # [Output Only] Absolute value of VM instances calculated based on the specific mode. 737 # 738 # 739 # - If the value is fixed, then the calculated value is equal to the fixed value. 740 # - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded up. 741 "fixed": 42, # Specifies a fixed number of VM instances. This must be a positive integer. 742 "percent": 42, # Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%. 743 }, 744 "timeWindowSec": 42, # How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above. 745 }, 746 }, 747 "target": "A String", # URL of the managed instance group that this autoscaler will scale. 748 "statusDetails": [ # [Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter. 749 { 750 "message": "A String", # The status message. 751 "type": "A String", # The type of error returned. 752 }, 753 ], 754 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 755 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 756 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 757 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 758 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 759 }, 760 ], 761 "warning": { # [Output Only] Informational warning message. 762 "message": "A String", # [Output Only] A human-readable description of the warning code. 763 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 764 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 765 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 766 { 767 "value": "A String", # [Output Only] A warning data value corresponding to the key. 768 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 769 }, 770 ], 771 }, 772 "id": "A String", # [Output Only] Unique identifier for the resource; defined by the server. 773 "selfLink": "A String", # [Output Only] Server-defined URL for this resource. 774 }</pre> 775</div> 776 777<div class="method"> 778 <code class="details" id="list_next">list_next(previous_request, previous_response)</code> 779 <pre>Retrieves the next page of results. 780 781Args: 782 previous_request: The request for the previous page. (required) 783 previous_response: The response from the request for the previous page. (required) 784 785Returns: 786 A request object that you can call 'execute()' on to request the next 787 page. Returns None if there are no more items in the collection. 788 </pre> 789</div> 790 791<div class="method"> 792 <code class="details" id="patch">patch(project, zone, body, requestId=None, autoscaler=None)</code> 793 <pre>Updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. 794 795Args: 796 project: string, Project ID for this request. (required) 797 zone: string, Name of the zone for this request. (required) 798 body: object, The request body. (required) 799 The object takes the form of: 800 801{ # Represents an Autoscaler resource. 802 # 803 # 804 # 805 # Use autoscalers to automatically add or delete instances from a managed instance group according to your defined autoscaling policy. For more information, read Autoscaling Groups of Instances. 806 # 807 # For zonal managed instance groups resource, use the autoscaler resource. 808 # 809 # For regional managed instance groups, use the regionAutoscalers resource. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) 810 "status": "A String", # [Output Only] The status of the autoscaler configuration. 811 "recommendedSize": 42, # [Output Only] Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates recommended MIG size even when autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to the existing managed instance group or autoscaler did not generate its prediction. 812 "kind": "compute#autoscaler", # [Output Only] Type of the resource. Always compute#autoscaler for autoscalers. 813 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 814 "zone": "A String", # [Output Only] URL of the zone where the instance group resides (for autoscalers living in zonal scope). 815 "region": "A String", # [Output Only] URL of the region where the instance group resides (for autoscalers living in regional scope). 816 "autoscalingPolicy": { # Cloud Autoscaler policy. # The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. 817 # 818 # If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. 819 "maxNumReplicas": 42, # The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas. 820 "coolDownPeriodSec": 42, # The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. 821 # 822 # Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process. 823 "loadBalancingUtilization": { # Configuration parameters of autoscaling based on load balancing. # Configuration parameters of autoscaling based on load balancer. 824 "utilizationTarget": 3.14, # Fraction of backend capacity utilization (set in HTTP(S) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. 825 }, 826 "queueBasedScaling": { # Configuration parameters of autoscaling based on queuing system. # Configuration parameters of autoscaling based on queuing system. 827 "acceptableBacklogPerInstance": 3.14, # Scaling based on the average number of tasks in the queue per each active instance. The autoscaler keeps the average number of tasks per instance below this number, based on data collected in the last couple of minutes. The autoscaler will also take into account incoming tasks when calculating when to scale. 828 "singleWorkerThroughputPerSec": 3.14, # The scaling algorithm will also calculate throughput estimates on its own; if you explicitly provide this value, the autoscaler will take into account your value as well as automatic estimates when deciding how to scale. 829 "cloudPubSub": { # Configuration parameters for scaling based on Cloud Pub/Sub subscription queue. # Configuration for Cloud Pub/Sub subscription queue. 830 "topic": "A String", # Cloud Pub/Sub topic used for scaling. Provide the partial URL or partial URL (starting with projects/) or just the topic name. The topic must belong to the same project as the Autoscaler resource. 831 "subscription": "A String", # Cloud Pub/Sub subscription used for scaling. Provide the partial URL (starting with projects/) or just the subscription name. The subscription must be assigned to the topic specified in topicName and must be in a pull configuration. The subscription must belong to the same project as the Autoscaler. 832 }, 833 }, 834 "customMetricUtilizations": [ # Configuration parameters of autoscaling based on a custom metric. 835 { # Custom utilization metric policy. 836 "filter": "A String", # A filter string, compatible with a Stackdriver Monitoring filter string for TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. 837 # 838 # For the filter to be valid for autoscaling purposes, the following rules apply: 839 # - You can only use the AND operator for joining selectors. 840 # - You can only use direct equality comparison operator (=) without any functions for each selector. 841 # - You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. 842 # - The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. 843 # If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. 844 # 845 # If not specified, the type defaults to gce_instance. 846 # 847 # You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value. 848 "metric": "A String", # The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. 849 # 850 # The metric must have a value type of INT64 or DOUBLE. 851 "singleInstanceAssignment": 3.14, # If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. Autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. 852 # 853 # A good metric to use with the target is for example pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. 854 # 855 # A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead. 856 "utilizationTarget": 3.14, # The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. 857 # 858 # For example, a good metric to use as a utilization_target is compute.googleapis.com/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances. 859 "utilizationTargetType": "A String", # Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. 860 }, 861 ], 862 "mode": "A String", # Defines operating mode for this policy. 863 "cpuUtilization": { # CPU utilization policy. # Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. 864 "utilizationTarget": 3.14, # The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. 865 # 866 # If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. 867 # 868 # If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization. 869 }, 870 "minNumReplicas": 42, # The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed. 871 "scaleDownControl": { # Configuration that allows for slower scale down so that even if Autoscaler recommends an abrupt scale down of a MIG, it will be throttled as specified by the parameters below. 872 "maxScaledDownReplicas": { # Encapsulates numeric value that can be either absolute or relative. # Maximum allowed number (or %) of VMs that can be deducted from the peak recommendation during the window autoscaler looks at when computing recommendations. Possibly all these VMs can be deleted at once so user service needs to be prepared to lose that many VMs in one step. 873 "calculated": 42, # [Output Only] Absolute value of VM instances calculated based on the specific mode. 874 # 875 # 876 # - If the value is fixed, then the calculated value is equal to the fixed value. 877 # - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded up. 878 "fixed": 42, # Specifies a fixed number of VM instances. This must be a positive integer. 879 "percent": 42, # Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%. 880 }, 881 "timeWindowSec": 42, # How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above. 882 }, 883 }, 884 "target": "A String", # URL of the managed instance group that this autoscaler will scale. 885 "statusDetails": [ # [Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter. 886 { 887 "message": "A String", # The status message. 888 "type": "A String", # The type of error returned. 889 }, 890 ], 891 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 892 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 893 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 894 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 895 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 896 } 897 898 requestId: string, An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. 899 900For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. 901 902The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). 903 autoscaler: string, Name of the autoscaler to patch. 904 905Returns: 906 An object of the form: 907 908 { # Represents an Operation resource. 909 # 910 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 911 # 912 # Operations can be global, regional or zonal. 913 # - For global operations, use the globalOperations resource. 914 # - For regional operations, use the regionOperations resource. 915 # - For zonal operations, use the zonalOperations resource. 916 # 917 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 918 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 919 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 920 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 921 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 922 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 923 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 924 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 925 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 926 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 927 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. 928 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 929 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 930 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 931 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 932 { 933 "message": "A String", # [Output Only] A human-readable description of the warning code. 934 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 935 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 936 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 937 { 938 "value": "A String", # [Output Only] A warning data value corresponding to the key. 939 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 940 }, 941 ], 942 }, 943 ], 944 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 945 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 946 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 947 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 948 "name": "A String", # [Output Only] Name of the resource. 949 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 950 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 951 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 952 { 953 "message": "A String", # [Output Only] An optional, human-readable error message. 954 "code": "A String", # [Output Only] The error type identifier for this error. 955 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 956 }, 957 ], 958 }, 959 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 960 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 961 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 962 }</pre> 963</div> 964 965<div class="method"> 966 <code class="details" id="testIamPermissions">testIamPermissions(project, zone, resource, body)</code> 967 <pre>Returns permissions that a caller has on the specified resource. 968 969Args: 970 project: string, Project ID for this request. (required) 971 zone: string, The name of the zone for this request. (required) 972 resource: string, Name or id of the resource for this request. (required) 973 body: object, The request body. (required) 974 The object takes the form of: 975 976{ 977 "permissions": [ # The set of permissions to check for the 'resource'. Permissions with wildcards (such as '*' or 'storage.*') are not allowed. 978 "A String", 979 ], 980 } 981 982 983Returns: 984 An object of the form: 985 986 { 987 "permissions": [ # A subset of `TestPermissionsRequest.permissions` that the caller is allowed. 988 "A String", 989 ], 990 }</pre> 991</div> 992 993<div class="method"> 994 <code class="details" id="update">update(project, zone, body, requestId=None, autoscaler=None)</code> 995 <pre>Updates an autoscaler in the specified project using the data included in the request. 996 997Args: 998 project: string, Project ID for this request. (required) 999 zone: string, Name of the zone for this request. (required) 1000 body: object, The request body. (required) 1001 The object takes the form of: 1002 1003{ # Represents an Autoscaler resource. 1004 # 1005 # 1006 # 1007 # Use autoscalers to automatically add or delete instances from a managed instance group according to your defined autoscaling policy. For more information, read Autoscaling Groups of Instances. 1008 # 1009 # For zonal managed instance groups resource, use the autoscaler resource. 1010 # 1011 # For regional managed instance groups, use the regionAutoscalers resource. (== resource_for beta.autoscalers ==) (== resource_for v1.autoscalers ==) (== resource_for beta.regionAutoscalers ==) (== resource_for v1.regionAutoscalers ==) 1012 "status": "A String", # [Output Only] The status of the autoscaler configuration. 1013 "recommendedSize": 42, # [Output Only] Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates recommended MIG size even when autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to the existing managed instance group or autoscaler did not generate its prediction. 1014 "kind": "compute#autoscaler", # [Output Only] Type of the resource. Always compute#autoscaler for autoscalers. 1015 "description": "A String", # An optional description of this resource. Provide this property when you create the resource. 1016 "zone": "A String", # [Output Only] URL of the zone where the instance group resides (for autoscalers living in zonal scope). 1017 "region": "A String", # [Output Only] URL of the region where the instance group resides (for autoscalers living in regional scope). 1018 "autoscalingPolicy": { # Cloud Autoscaler policy. # The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. 1019 # 1020 # If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. 1021 "maxNumReplicas": 42, # The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas. 1022 "coolDownPeriodSec": 42, # The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. 1023 # 1024 # Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process. 1025 "loadBalancingUtilization": { # Configuration parameters of autoscaling based on load balancing. # Configuration parameters of autoscaling based on load balancer. 1026 "utilizationTarget": 3.14, # Fraction of backend capacity utilization (set in HTTP(S) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8. 1027 }, 1028 "queueBasedScaling": { # Configuration parameters of autoscaling based on queuing system. # Configuration parameters of autoscaling based on queuing system. 1029 "acceptableBacklogPerInstance": 3.14, # Scaling based on the average number of tasks in the queue per each active instance. The autoscaler keeps the average number of tasks per instance below this number, based on data collected in the last couple of minutes. The autoscaler will also take into account incoming tasks when calculating when to scale. 1030 "singleWorkerThroughputPerSec": 3.14, # The scaling algorithm will also calculate throughput estimates on its own; if you explicitly provide this value, the autoscaler will take into account your value as well as automatic estimates when deciding how to scale. 1031 "cloudPubSub": { # Configuration parameters for scaling based on Cloud Pub/Sub subscription queue. # Configuration for Cloud Pub/Sub subscription queue. 1032 "topic": "A String", # Cloud Pub/Sub topic used for scaling. Provide the partial URL or partial URL (starting with projects/) or just the topic name. The topic must belong to the same project as the Autoscaler resource. 1033 "subscription": "A String", # Cloud Pub/Sub subscription used for scaling. Provide the partial URL (starting with projects/) or just the subscription name. The subscription must be assigned to the topic specified in topicName and must be in a pull configuration. The subscription must belong to the same project as the Autoscaler. 1034 }, 1035 }, 1036 "customMetricUtilizations": [ # Configuration parameters of autoscaling based on a custom metric. 1037 { # Custom utilization metric policy. 1038 "filter": "A String", # A filter string, compatible with a Stackdriver Monitoring filter string for TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. 1039 # 1040 # For the filter to be valid for autoscaling purposes, the following rules apply: 1041 # - You can only use the AND operator for joining selectors. 1042 # - You can only use direct equality comparison operator (=) without any functions for each selector. 1043 # - You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. 1044 # - The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. 1045 # If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. 1046 # 1047 # If not specified, the type defaults to gce_instance. 1048 # 1049 # You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value. 1050 "metric": "A String", # The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. 1051 # 1052 # The metric must have a value type of INT64 or DOUBLE. 1053 "singleInstanceAssignment": 3.14, # If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. Autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. 1054 # 1055 # A good metric to use with the target is for example pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. 1056 # 1057 # A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead. 1058 "utilizationTarget": 3.14, # The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. 1059 # 1060 # For example, a good metric to use as a utilization_target is compute.googleapis.com/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances. 1061 "utilizationTargetType": "A String", # Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. 1062 }, 1063 ], 1064 "mode": "A String", # Defines operating mode for this policy. 1065 "cpuUtilization": { # CPU utilization policy. # Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. 1066 "utilizationTarget": 3.14, # The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. 1067 # 1068 # If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. 1069 # 1070 # If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization. 1071 }, 1072 "minNumReplicas": 42, # The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed. 1073 "scaleDownControl": { # Configuration that allows for slower scale down so that even if Autoscaler recommends an abrupt scale down of a MIG, it will be throttled as specified by the parameters below. 1074 "maxScaledDownReplicas": { # Encapsulates numeric value that can be either absolute or relative. # Maximum allowed number (or %) of VMs that can be deducted from the peak recommendation during the window autoscaler looks at when computing recommendations. Possibly all these VMs can be deleted at once so user service needs to be prepared to lose that many VMs in one step. 1075 "calculated": 42, # [Output Only] Absolute value of VM instances calculated based on the specific mode. 1076 # 1077 # 1078 # - If the value is fixed, then the calculated value is equal to the fixed value. 1079 # - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded up. 1080 "fixed": 42, # Specifies a fixed number of VM instances. This must be a positive integer. 1081 "percent": 42, # Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%. 1082 }, 1083 "timeWindowSec": 42, # How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above. 1084 }, 1085 }, 1086 "target": "A String", # URL of the managed instance group that this autoscaler will scale. 1087 "statusDetails": [ # [Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter. 1088 { 1089 "message": "A String", # The status message. 1090 "type": "A String", # The type of error returned. 1091 }, 1092 ], 1093 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 1094 "creationTimestamp": "A String", # [Output Only] Creation timestamp in RFC3339 text format. 1095 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 1096 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1097 "name": "A String", # Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. 1098 } 1099 1100 requestId: string, An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. 1101 1102For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. 1103 1104The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). 1105 autoscaler: string, Name of the autoscaler to update. 1106 1107Returns: 1108 An object of the form: 1109 1110 { # Represents an Operation resource. 1111 # 1112 # You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. 1113 # 1114 # Operations can be global, regional or zonal. 1115 # - For global operations, use the globalOperations resource. 1116 # - For regional operations, use the regionOperations resource. 1117 # - For zonal operations, use the zonalOperations resource. 1118 # 1119 # For more information, read Global, Regional, and Zonal Resources. (== resource_for v1.globalOperations ==) (== resource_for beta.globalOperations ==) (== resource_for v1.regionOperations ==) (== resource_for beta.regionOperations ==) (== resource_for v1.zoneOperations ==) (== resource_for beta.zoneOperations ==) 1120 "targetId": "A String", # [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. 1121 "clientOperationId": "A String", # [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. 1122 "creationTimestamp": "A String", # [Deprecated] This field is deprecated. 1123 "id": "A String", # [Output Only] The unique identifier for the resource. This identifier is defined by the server. 1124 "zone": "A String", # [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. 1125 "insertTime": "A String", # [Output Only] The time that this operation was requested. This value is in RFC3339 text format. 1126 "operationType": "A String", # [Output Only] The type of operation, such as insert, update, or delete, and so on. 1127 "httpErrorMessage": "A String", # [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. 1128 "progress": 42, # [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. 1129 "httpErrorStatusCode": 42, # [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. 1130 "statusMessage": "A String", # [Output Only] An optional textual description of the current status of the operation. 1131 "status": "A String", # [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. 1132 "description": "A String", # [Output Only] A textual description of the operation, which is set when the operation is created. 1133 "warnings": [ # [Output Only] If warning messages are generated during processing of the operation, this field will be populated. 1134 { 1135 "message": "A String", # [Output Only] A human-readable description of the warning code. 1136 "code": "A String", # [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. 1137 "data": [ # [Output Only] Metadata about this warning in key: value format. For example: 1138 # "data": [ { "key": "scope", "value": "zones/us-east1-d" } 1139 { 1140 "value": "A String", # [Output Only] A warning data value corresponding to the key. 1141 "key": "A String", # [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). 1142 }, 1143 ], 1144 }, 1145 ], 1146 "selfLinkWithId": "A String", # [Output Only] Server-defined URL for this resource with the resource id. 1147 "user": "A String", # [Output Only] User who requested the operation, for example: user@example.com. 1148 "startTime": "A String", # [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. 1149 "kind": "compute#operation", # [Output Only] Type of the resource. Always compute#operation for Operation resources. 1150 "name": "A String", # [Output Only] Name of the resource. 1151 "region": "A String", # [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. 1152 "error": { # [Output Only] If errors are generated during processing of the operation, this field will be populated. 1153 "errors": [ # [Output Only] The array of errors encountered while processing this operation. 1154 { 1155 "message": "A String", # [Output Only] An optional, human-readable error message. 1156 "code": "A String", # [Output Only] The error type identifier for this error. 1157 "location": "A String", # [Output Only] Indicates the field in the request that caused the error. This property is optional. 1158 }, 1159 ], 1160 }, 1161 "endTime": "A String", # [Output Only] The time that this operation was completed. This value is in RFC3339 text format. 1162 "selfLink": "A String", # [Output Only] Server-defined URL for the resource. 1163 "targetLink": "A String", # [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. 1164 }</pre> 1165</div> 1166 1167</body></html>