| <html><body> | |
| <style> | |
| body, h1, h2, h3, div, span, p, pre, a { | |
| margin: 0; | |
| padding: 0; | |
| border: 0; | |
| font-weight: inherit; | |
| font-style: inherit; | |
| font-size: 100%; | |
| font-family: inherit; | |
| vertical-align: baseline; | |
| } | |
| body { | |
| font-size: 13px; | |
| padding: 1em; | |
| } | |
| h1 { | |
| font-size: 26px; | |
| margin-bottom: 1em; | |
| } | |
| h2 { | |
| font-size: 24px; | |
| margin-bottom: 1em; | |
| } | |
| h3 { | |
| font-size: 20px; | |
| margin-bottom: 1em; | |
| margin-top: 1em; | |
| } | |
| pre, code { | |
| line-height: 1.5; | |
| font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; | |
| } | |
| pre { | |
| margin-top: 0.5em; | |
| } | |
| h1, h2, h3, p { | |
| font-family: Arial, sans serif; | |
| } | |
| h1, h2, h3 { | |
| border-bottom: solid #CCC 1px; | |
| } | |
| .toc_element { | |
| margin-top: 0.5em; | |
| } | |
| .firstline { | |
| margin-left: 2 em; | |
| } | |
| .method { | |
| margin-top: 1em; | |
| border: solid 1px #CCC; | |
| padding: 1em; | |
| background: #EEE; | |
| } | |
| .details { | |
| font-weight: bold; | |
| font-size: 14px; | |
| } | |
| </style> | |
| <h1><a href="compute_preview.html">Compute Engine API</a> . <a href="compute_preview.advice.html">advice</a></h1> | |
| <h2>Instance Methods</h2> | |
| <p class="toc_element"> | |
| <code><a href="#calendarMode">calendarMode(project, region, body=None, x__xgafv=None)</a></code></p> | |
| <p class="firstline">Advise how, where and when to create the requested amount of instances</p> | |
| <p class="toc_element"> | |
| <code><a href="#capacity">capacity(project, region, body=None, x__xgafv=None)</a></code></p> | |
| <p class="firstline">Advice on making real-time decisions (such as choosing zone or</p> | |
| <p class="toc_element"> | |
| <code><a href="#capacityHistory">capacityHistory(project, region, body=None, x__xgafv=None)</a></code></p> | |
| <p class="firstline">Gets the capacity history.</p> | |
| <p class="toc_element"> | |
| <code><a href="#close">close()</a></code></p> | |
| <p class="firstline">Close httplib2 connections.</p> | |
| <h3>Method Details</h3> | |
| <div class="method"> | |
| <code class="details" id="calendarMode">calendarMode(project, region, body=None, x__xgafv=None)</code> | |
| <pre>Advise how, where and when to create the requested amount of instances | |
| with specified accelerators, within the specified time and location limits. | |
| The method recommends creating future reservations for the requested | |
| resources. | |
| Args: | |
| project: string, Project ID for this request. (required) | |
| region: string, Name of the region for this request. (required) | |
| body: object, The request body. | |
| The object takes the form of: | |
| { # A request to recommend the best way to consume the specified resources in the | |
| # future. | |
| "futureResourcesSpecs": { # Specification of resources to create in the future. | |
| # The key of the map is an arbitrary string specified by the caller. | |
| # Value of the map is a specification of required resources and their | |
| # constraints. Currently only one value is allowed in this map. | |
| "a_key": { # Specification of resources to be created at some time in the future within an | |
| # optionally specified set of locations, and within the specified time range. | |
| "deploymentType": "A String", # Indicates if the reservation allocation strategy is static (DENSE) or | |
| # dynamic (STANDARD). Defaults to DENSE. | |
| "locationPolicy": { # Specification of locations to create resources in. # Optional location policy allowing to exclude some zone(s) in which | |
| # the resources must not be created. | |
| "locations": { # Preferences for specified locations. | |
| # Keys of the map are locations - zones, in format of 'zones/'. | |
| # Values are preferences for the zones. | |
| # If a zone is not specified in this map, it is ALLOWed. | |
| "a_key": { # Preference for a single specified location. | |
| "preference": "A String", # Preference for this location. | |
| }, | |
| }, | |
| }, | |
| "targetResources": { # Specification of reserved resources. # Specification of the reserved resources. | |
| "aggregateResources": { | |
| "acceleratorCount": "A String", # Size of the request, in accelerator (chip) count. | |
| "vmFamily": "A String", # The VM family that all instances scheduled against this reservation | |
| # must belong to. Use for TPU reservations. | |
| "workloadType": "A String", # Workload type. Use for TPU reservations. | |
| }, | |
| "specificSkuResources": { | |
| "instanceCount": "A String", # Size of the request, in instance count. | |
| "localSsdPartitions": [ # Local SSD partitions. You do not have to include SSD partitions that | |
| # are built in the machine type. | |
| { | |
| "diskInterface": "A String", # Disk interface. Defaults to SCSI. | |
| "diskSizeGb": "A String", # The size of the disk in GB. | |
| }, | |
| ], | |
| "machineType": "A String", # The machine type to use for instances that will use the reservation. | |
| # This field only accepts machine type names. e.g. n2-standard-4 | |
| # and does not accept machine type full or partial url. e.g. | |
| # projects/my-l7ilb-project/zones/us-central1-a/machineTypes/n2-standard-4. | |
| # Use for GPU reservations. | |
| }, | |
| }, | |
| "timeRangeSpec": { # Specifies a flexible time range with flexible start time and duration. # Specification of a time range in which the resources may be created. | |
| # The time range specifies start of resource use and planned end of resource | |
| # use. | |
| # | |
| # It is possible to specify a contradictory time range that cannot be matched | |
| # by any Interval. This causes a validation error. | |
| "maxDuration": "A String", | |
| "minDuration": "A String", | |
| "startTimeNotEarlierThan": "A String", | |
| "startTimeNotLaterThan": "A String", | |
| }, | |
| }, | |
| }, | |
| } | |
| x__xgafv: string, V1 error format. | |
| Allowed values | |
| 1 - v1 error format | |
| 2 - v2 error format | |
| Returns: | |
| An object of the form: | |
| { # A response containing the recommended way of creating the specified resources | |
| # in the future. It contains (will contain) multiple recommendations that can | |
| # be analyzed by the customer and the best one can be picked. | |
| "recommendations": [ # Recommendations where, how and when to create the requested resources | |
| # in order to maximize their obtainability and minimize cost. | |
| { # A single recommendation to create requested resources. Contains detailed | |
| # recommendations for every future resources specification specified in | |
| # CalendarModeAdviceRequest. | |
| "recommendationsPerSpec": { # Recommendations for every future resource specification passed in | |
| # CalendarModeAdviceRequest. Keys of the map correspond to keys | |
| # specified in the request. | |
| "a_key": { # Recommendation for single resources specification, to be created in the | |
| # future. | |
| "endTime": "A String", | |
| "location": "A String", # The advised location for resource usage. When a zone, in format | |
| # 'zones/'. | |
| # If not set, it means that no location is recommended - see | |
| # other_locations for details. | |
| "otherLocations": { # List of locations in the request scope that were not | |
| # recommended. Keys of the map are zones, in format 'zones/'. | |
| # The values are status information indicating the recommendation status. | |
| "a_key": { # Information about recommendation status for locations | |
| # that were allowed but not used by the response. | |
| "details": "A String", # Details (human readable) describing the situation. | |
| # For example, if status is CONDITION_NOT_MET, then | |
| # details contain information about the parameters of the time window | |
| # that did not meet the required conditions. | |
| "status": "A String", # Status of recommendation in this location. | |
| }, | |
| }, | |
| "recommendationId": "A String", # Unique id of the recommendation, a UUID string generated by the API. | |
| "recommendationType": "A String", # Type of recommendation. Currently only FUTURE_RESERVATION is supported. | |
| "startTime": "A String", | |
| }, | |
| }, | |
| }, | |
| ], | |
| }</pre> | |
| </div> | |
| <div class="method"> | |
| <code class="details" id="capacity">capacity(project, region, body=None, x__xgafv=None)</code> | |
| <pre>Advice on making real-time decisions (such as choosing zone or | |
| machine types) during deployment to maximize your chances of obtaining | |
| capacity. | |
| Args: | |
| project: string, Project ID for this request. (required) | |
| region: string, Name of the region for this request. (required) | |
| body: object, The request body. | |
| The object takes the form of: | |
| { # A request to provide Assistant Scores. These scores determine VM | |
| # obtainability and preemption likelihood. | |
| "distributionPolicy": { # Distribution policy. # Policy specifying the distribution of instances across | |
| # zones within the requested region. | |
| "targetShape": "A String", # Target distribution shape. You can specify the following values:ANY, ANY_SINGLE_ZONE, or BALANCED. | |
| "zones": [ # Zones where Capacity Advisor looks for capacity. | |
| { # Zone configuration for the distribution policy. | |
| "zone": "A String", # The URL of the zone. It can be a | |
| # partial or full URL. For example, the following are valid values: | |
| # | |
| # | |
| # - https://www.googleapis.com/compute/v1/projects/project/zones/zone | |
| # - projects/project/zones/zone | |
| # - zones/zone | |
| }, | |
| ], | |
| }, | |
| "instanceFlexibilityPolicy": { # Specification of alternative, flexible instance configurations. # Policy for instance selectors. | |
| "instanceSelections": { # Named instance selections to configure properties. | |
| # The key is an arbitrary, unique RFC1035 string that identifies the | |
| # instance selection. | |
| "a_key": { # Machine specification. | |
| "disks": [ # Local SSDs. | |
| { # Attached disk configuration. | |
| "type": "A String", # Specifies the type of the disk. | |
| }, | |
| ], | |
| "guestAccelerators": [ # Accelerators configuration. | |
| { # A specification of the type and number of accelerator cards attached to the | |
| # instance. | |
| "acceleratorCount": 42, # The number of the guest accelerator cards exposed to this instance. | |
| "acceleratorType": "A String", # Full or partial URL of the accelerator type resource to attach to this | |
| # instance. For example:projects/my-project/zones/us-central1-c/acceleratorTypes/nvidia-tesla-p100 | |
| # If you are creating an instance template, specify only the | |
| # accelerator name. | |
| # See GPUs on Compute Engine | |
| # for a full list of accelerator types. | |
| }, | |
| ], | |
| "machineTypes": [ # Full machine-type names, e.g. "n1-standard-16". | |
| "A String", | |
| ], | |
| "rank": "A String", # Optional. Rank when prioritizing the shape flexibilities. | |
| # The instance selections are considered in the ascending order of the | |
| # rank. If not set, defaults to 0. | |
| }, | |
| }, | |
| }, | |
| "instanceProperties": { # Instance provisioning properties. # Instance properties for this request. | |
| "scheduling": { # Defines the instance scheduling options. # Specifies the scheduling options. | |
| "provisioningModel": "A String", # Specifies the provisioning model. | |
| }, | |
| }, | |
| "size": 42, # The number of VM instances to request. | |
| } | |
| x__xgafv: string, V1 error format. | |
| Allowed values | |
| 1 - v1 error format | |
| 2 - v2 error format | |
| Returns: | |
| An object of the form: | |
| { # A response contains scoring recommendations. | |
| "recommendations": [ # Initially the API will provide one recommendation which balances the | |
| # individual scores according to the service provider's preference. | |
| { # Recommendation. | |
| "scores": { # Groups information about a shard of capacity. # Scores for the recommendation. | |
| "estimatedUptime": "A String", # The estimated run time of the majority of Spot VMs in the request | |
| # before preemption. The estimate is best-effort only. It is based on | |
| # historical data and current conditions. | |
| "obtainability": 3.14, # The obtainability score indicates the likelihood of successfully | |
| # obtaining (provisioning) the requested number of VMs. | |
| # The score range is 0.0 through 1.0. Higher is better. | |
| }, | |
| "shards": [ # Shards represent blocks of uniform capacity in recommendations. | |
| { # Shards represent blocks of uniform capacity in recommendations. | |
| # Each shard is for a single zone and a single machine shape. Each shard | |
| # defines a size expressed as the number of VMs. | |
| "instanceCount": 42, # The number of instances. | |
| "machineType": "A String", # The machine type corresponds to the instance selection in the request. | |
| "provisioningModel": "A String", # The provisioning model that you want to view recommendations for. | |
| "zone": "A String", # Output only. The zone name for this shard. | |
| }, | |
| ], | |
| }, | |
| ], | |
| }</pre> | |
| </div> | |
| <div class="method"> | |
| <code class="details" id="capacityHistory">capacityHistory(project, region, body=None, x__xgafv=None)</code> | |
| <pre>Gets the capacity history. | |
| Args: | |
| project: string, Project ID for this request. (required) | |
| region: string, Name of the region for this request. (required) | |
| body: object, The request body. | |
| The object takes the form of: | |
| { # A request to get the capacity history. | |
| "instanceProperties": { # Instance properties for this request. # Instance properties for this request. | |
| "disks": [ # Local SSDs. | |
| { # AttachedDisk modeled after Instance's AttachedDisk. | |
| "type": "A String", # Specifies the type of the disk. | |
| }, | |
| ], | |
| "guestAccelerators": [ # Accelerators configuration. | |
| { # A specification of the type and number of accelerator cards attached to the | |
| # instance. | |
| "acceleratorCount": 42, # The number of the guest accelerator cards exposed to this instance. | |
| "acceleratorType": "A String", # Full or partial URL of the accelerator type resource to attach to this | |
| # instance. For example:projects/my-project/zones/us-central1-c/acceleratorTypes/nvidia-tesla-p100 | |
| # If you are creating an instance template, specify only the | |
| # accelerator name. | |
| # See GPUs on Compute Engine | |
| # for a full list of accelerator types. | |
| }, | |
| ], | |
| "machineType": "A String", # The machine type for the VM, such as `n2-standard-4`. | |
| "scheduling": { # Scheduling options. # Specifies the scheduling options. | |
| "provisioningModel": "A String", # The provisioning model to get capacity history for. | |
| # This field must be set to SPOT. | |
| # | |
| # For more information, see | |
| # Compute Engine instances provisioning models. | |
| }, | |
| }, | |
| "locationPolicy": { # Location policy for this request. # Location policy for this request. | |
| "location": "A String", # The region or zone to get capacity history for. | |
| # | |
| # It can be a partial or full URL. For example, the following are valid | |
| # values: | |
| # | |
| # | |
| # - https://www.googleapis.com/compute/v1/projects/project/zones/zone | |
| # - projects/project/zones/zone | |
| # - zones/zone | |
| # | |
| # | |
| # | |
| # This field is optional. | |
| }, | |
| "types": [ # List of history types to get capacity history for. | |
| "A String", | |
| ], | |
| } | |
| x__xgafv: string, V1 error format. | |
| Allowed values | |
| 1 - v1 error format | |
| 2 - v2 error format | |
| Returns: | |
| An object of the form: | |
| { # Contains the capacity history. | |
| "location": "A String", # Output only. The location (region or zone) for which the capacity history is returned. | |
| # It is returned as a URL - For example,https://www.googleapis.com/compute/v1/projects/project/zones/zone. | |
| "machineType": "A String", # The machine type for which the capacity history is returned. | |
| "preemptionHistory": [ # The preemption history for the requested machine type and location. | |
| { # A record of Spot VM preemption history. | |
| "interval": { # Represents a time interval, encoded as a Timestamp start (inclusive) and a # The time interval for this preemption record. | |
| # Timestamp end (exclusive). | |
| # | |
| # The start must be less than or equal to the end. | |
| # When the start equals the end, the interval is empty (matches no time). | |
| # When both start and end are unspecified, the interval matches any time. | |
| "endTime": "A String", # Optional. Exclusive end of the interval. | |
| # | |
| # If specified, a Timestamp matching this interval will have to be before the | |
| # end. | |
| "startTime": "A String", # Optional. Inclusive start of the interval. | |
| # | |
| # If specified, a Timestamp matching this interval will have to be the same | |
| # or after the start. | |
| }, | |
| "preemptionRate": 3.14, # The preemption rate during the interval, representing the fraction of | |
| # Spot VMs that were preempted. Range: 0.0 to 1.0. Preemption rate is | |
| # calculated as (total preempted Spots) / (total Spots that stopped | |
| # running). | |
| }, | |
| ], | |
| "priceHistory": [ # The price history for the requested machine type and location. | |
| { # A record of price history. | |
| "interval": { # Represents a time interval, encoded as a Timestamp start (inclusive) and a # The time interval for this price record. | |
| # Timestamp end (exclusive). | |
| # | |
| # The start must be less than or equal to the end. | |
| # When the start equals the end, the interval is empty (matches no time). | |
| # When both start and end are unspecified, the interval matches any time. | |
| "endTime": "A String", # Optional. Exclusive end of the interval. | |
| # | |
| # If specified, a Timestamp matching this interval will have to be before the | |
| # end. | |
| "startTime": "A String", # Optional. Inclusive start of the interval. | |
| # | |
| # If specified, a Timestamp matching this interval will have to be the same | |
| # or after the start. | |
| }, | |
| "listPrice": { # Represents an amount of money with its currency type. # The Spot VM list price during the interval. | |
| "currencyCode": "A String", # The three-letter currency code defined in ISO 4217. | |
| "nanos": 42, # Number of nano (10^-9) units of the amount. | |
| # The value must be between -999,999,999 and +999,999,999 inclusive. | |
| # If `units` is positive, `nanos` must be positive or zero. | |
| # If `units` is zero, `nanos` can be positive, zero, or negative. | |
| # If `units` is negative, `nanos` must be negative or zero. | |
| # For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. | |
| "units": "A String", # The whole units of the amount. | |
| # For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. | |
| }, | |
| }, | |
| ], | |
| }</pre> | |
| </div> | |
| <div class="method"> | |
| <code class="details" id="close">close()</code> | |
| <pre>Close httplib2 connections.</pre> | |
| </div> | |
| </body></html> |