Requires authorization
Updates the template used by the pool. If you update a template, the new template will only apply to new replicas or to replicas that are restarted. Try it now or see an example .
Request
HTTP request
POST https://www.googleapis.com/replicapool/v1beta1/projects/projectName/zones/zone/pools/poolName/updateTemplate
Parameters
Parameter name | Value | Description |
---|---|---|
Path parameters | ||
poolName
|
string
|
The name of the replica pool for this request. |
projectName
|
string
|
The project ID for this replica pool. |
zone
|
string
|
The zone for this replica pool. |
Authorization
This request requires authorization with at least one of the following scopes ( read more about authentication and authorization ).
Scope |
---|
[Deprecated]
https://www.googleapis.com/auth/ndev.cloudman
|
https://www.googleapis.com/auth/cloud-platform
|
https://www.googleapis.com/auth/replicapool
|
Request body
In the request body, supply data with the following structure:
{ "version": string, "vmParams": { "machineType": string, "baseInstanceName": string, "serviceAccounts": [ { "email": string, "scopes": [ string ] } ], "description": string, "tags": { "fingerPrint": string, "items": [ string ] }, "networkInterfaces": [ { "network": string, "networkIp": string, "accessConfigs": [ { "name": string, "type": string, "natIp": string } ] } ], "metadata": { "fingerPrint": string, "items": [ { "key": string, "value": string } ] }, "canIpForward": boolean, "onHostMaintenance": string, "disksToCreate": [ { "boot": boolean, "autoDelete": boolean, "attachment": { "deviceName": string, "index": unsigned integer }, "initializeParams": { "sourceImage": string, "diskSizeGb": long } } ], "disksToAttach": [ { "source": string, "attachment": { "deviceName": string, "index": unsigned integer } } ] }, "action": { "commands": [ string ], "envVariables": [ { "name": string, "value": string, "hidden": boolean } ], "timeoutMilliSeconds": integer }, "healthChecks": [ { "name": string, "description": string, "path": string, "host": string, "port": integer, "checkIntervalSec": integer, "timeoutSec": integer, "unhealthyThreshold": integer, "healthyThreshold": integer } ] }
Property name | Value | Description | Notes |
---|---|---|---|
version
|
string
|
A free-form string describing the version of this template. You can provide any versioning string you would like. For example,
version1
or
template-v1
.
|
|
vmParams
|
nested object
|
The virtual machine parameters to use for these replicas. You can define settings such as the machine type and the image of these replicas. | |
vmParams.
machineType
|
string
|
The machine type for this instance. The resource name (e.g.
n1-standard-1
).
|
|
vmParams.
baseInstanceName
|
string
|
Deprecated. Please use
baseInstanceName
instead.
|
|
vmParams.
serviceAccounts[]
|
list
|
A list of Service Accounts to enable for this instance. | |
vmParams.serviceAccounts[].
email
|
string
|
The service account email address, for example:
[email protected]
|
|
vmParams.serviceAccounts[].
scopes[]
|
list
|
The list of OAuth2 scopes to obtain for the service account, for example:
https://www.googleapis.com/auth/devstorage.full_control
|
|
vmParams.
description
|
string
|
An optional textual description of the instance. | |
vmParams.
tags
|
nested object
|
A list of tags to apply to the Google Compute Engine instance to identify resources. | |
vmParams.tags.
fingerPrint
|
string
|
The fingerprint of the tag. Required for updating the list of tags. | |
vmParams.tags.
items[]
|
list
|
The list of tags that apply to these replicas. | |
vmParams.
networkInterfaces[]
|
list
|
A list of network interfaces for the instance. Currently only one interface is supported by Google Compute Engine,
ONE_TO_ONE_NAT
.
|
|
vmParams.networkInterfaces[].
network
|
string
|
Name the Network resource to which this interface applies. | |
vmParams.networkInterfaces[].
networkIp
|
string
|
An optional IPV4 internal network address to assign to the instance for this network interface. | |
vmParams.networkInterfaces[].
accessConfigs[]
|
list
|
An array of configurations for this interface. This specifies how this interface is configured to interact with other network services. | |
vmParams.networkInterfaces[].accessConfigs[].
name
|
string
|
Name of this access configuration. | |
vmParams.networkInterfaces[].accessConfigs[].
type
|
string
|
Type of this access configuration file. Currently only
ONE_TO_ONE_NAT
is supported.
|
|
vmParams.networkInterfaces[].accessConfigs[].
natIp
|
string
|
An external IP address associated with these replicas. Compute Engine allows a static IP to be attached to just one instance at a time. If you create more than one replica and populate this field, all but one replica will fail. | |
vmParams.
metadata
|
nested object
|
The metadata key/value pairs assigned to this instance. | |
vmParams.metadata.
fingerPrint
|
string
|
The fingerprint of the metadata. Required for updating the metadata entries for this instance. | |
vmParams.metadata.
items[]
|
list
|
A list of metadata items. | |
vmParams.metadata.items[].
key
|
string
|
A metadata key. | |
vmParams.metadata.items[].
value
|
string
|
A metadata value. | |
vmParams.
canIpForward
|
boolean
|
Enables IP Forwarding, which allows this instance to receive packets destined for a different IP address, and send packets with a different source IP. See IP Forwarding for more information. | |
action
|
nested object
|
An action to run during initialization of your replicas. An action is run as shell commands which are executed one after the other in the same bash shell, so any state established by one command is inherited by later commands. | |
action.
commands[]
|
list
|
A list of commands to run, one per line. If any command fails, the whole action is considered a failure and no further actions are run. This also marks the virtual machine or replica as a failure. | |
action.
envVariables[]
|
list
|
A list of environment variables to use for the commands in this action. | |
action.envVariables[].
name
|
string
|
The name of the environment variable. | |
action.envVariables[].
value
|
string
|
The value of the variable. | |
action.
timeoutMilliSeconds
|
integer
|
If an action on a particular virtual machine does not finish in the
timeoutMS
, the current command is failed and the replica is considered a failure. No further actions are executed. The command is killed by sending a "kill" signal to the shell process that is running the command. No additional efforts are made to stop any processes that were spawned or created as the result of running the action. The default is the max allowed value, 1 hour (i.e. 3600000 milliseconds).
|
|
vmParams.
disksToCreate[]
|
list
|
A list of Disk resources to create and attach to each Replica in the Pool. Currently, you can only define one disk and it must be a root persistent disk. Note that Replica Pool will create a root persistent disk for each replica. | |
vmParams.disksToCreate[].
boot
|
boolean
|
If
true
, indicates that this is the root persistent disk.
|
|
vmParams.disksToCreate[].
autoDelete
|
boolean
|
If
true
, then this disk will be deleted when the instance is deleted. The default value is
true
.
|
|
vmParams.disksToCreate[].
attachment
|
nested object
|
How the disk will be attached to the Replica. | |
vmParams.disksToCreate[].attachment.
deviceName
|
string
|
The device name of this disk. | |
vmParams.disksToCreate[].attachment.
index
|
unsigned integer
|
A zero-based index to assign to this disk, where 0 is reserved for the boot disk. If not specified, this is assigned by the server. | |
vmParams.disksToCreate[].
initializeParams
|
nested object
|
Create the new disk using these parameters. The name of the disk will be
<instance_name>-<four_random_charactersgt;
.
|
|
vmParams.disksToCreate[].initializeParams.
sourceImage
|
string
|
The name or fully-qualified URL of a source image to use to create this disk. If you provide a name of the source image, Replica Pool will look for an image with that name in your project. If you are specifying an image provided by Compute Engine, you will need to provide the full URL with the correct project, such as:
http://www.googleapis.com/compute/v1/projects/debian-cloud/ global/images/debian-wheezy-7-vYYYYMMDD |
|
vmParams.disksToCreate[].initializeParams.
diskSizeGb
|
long
|
The size of the created disk in gigabytes. | |
vmParams.
disksToAttach[]
|
list
|
A list of existing Persistent Disk resources to attach to each replica in the pool. Each disk will be attached in read-only mode to every replica. | |
vmParams.disksToAttach[].
source
|
string
|
The name of the Persistent Disk resource. The Persistent Disk resource must be in the same zone as the Pool. | |
vmParams.disksToAttach[].
attachment
|
nested object
|
How the disk will be attached to the Replica. | |
vmParams.disksToAttach[].attachment.
deviceName
|
string
|
The device name of this disk. | |
vmParams.disksToAttach[].attachment.
index
|
unsigned integer
|
A zero-based index to assign to this disk, where 0 is reserved for the boot disk. If not specified, this is assigned by the server. | |
healthChecks[]
|
list
|
A list of HTTP Health Checks to configure for this replica pool and all virtual machines in this replica pool. | |
healthChecks[].
name
|
string
|
The name of this health check. | |
healthChecks[].
description
|
string
|
The description for this health check. | |
healthChecks[].
path
|
string
|
The localhost request path to send this health check, in the format
/path/to/use
. For example,
/healthcheck
.
|
|
healthChecks[].
host
|
string
|
The value of the host header in the HTTP health check request. If left empty (default value), the localhost IP
127.0.0.1
will be used.
|
|
healthChecks[].
port
|
integer
|
The TCP port for the health check requests. | |
healthChecks[].
checkIntervalSec
|
integer
|
How often (in seconds) to make HTTP requests for this healthcheck. The default value is 5 seconds. | |
healthChecks[].
timeoutSec
|
integer
|
How long (in seconds) to wait before a timeout failure for this healthcheck. The default value is 5 seconds. | |
healthChecks[].
unhealthyThreshold
|
integer
|
The number of consecutive health check requests that need to fail in order to consider the replica unhealthy. The default value is 2. | |
healthChecks[].
healthyThreshold
|
integer
|
The number of consecutive health check requests that need to succeed before the replica is considered healthy again. The default value is 2. | |
vmParams.
onHostMaintenance
|
string
|
Sets the
scheduling options
for the replicas in this pool. This determines how Compute Engine handles your instances when there is a maintenance event. You can set one of the following options:
|
Response
If successful, this method returns an empty response body.
Examples
Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).
Python
Uses the Python client library .
def updateTemplate(auth_http, replicapool_service): body = { "vmParams": { "machineType": "n1-standard-2", "baseInstanceName": "new-instance-name", "disks_to_create": [{ "boot": "true", "initializeParams": { "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20131120", "diskSizeGb": 100 } }], "networkInterfaces": [{ "network": "https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default", "accessConfigs": [{ "type": "ONE_TO_ONE_NAT", "name": "External NAT" }] }] } } request = replicapool_service.pools().updatetemplate(projectName=PROJECT_ID, zone=ZONE, body=body, poolName=POOLNAME) response = request.execute(auth_http) _printResults(response)
Try it!
Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer .