@Path(value="/instances")
@Consumes(value="application/json")
public interface InstanceApi
| Modifier and Type | Interface and Description |
|---|---|
static class |
InstanceApi.InstancePages |
| Modifier and Type | Method and Description |
|---|---|
Operation |
addAccessConfigToNic(String instance,
Instance.NetworkInterface.AccessConfig accessConfig,
String networkInterfaceName)
Adds an access config to an instance's network interface.
|
Operation |
attachDisk(String instance,
AttachDisk attachDiskOptions)
Attaches a disk to an instance
|
Operation |
create(NewInstance template)
Creates a instance resource in the specified project using the data included in the request.
|
Operation |
delete(String instance)
Deletes an instance by name and returns the operation in progress, or null if not found.
|
Operation |
deleteAccessConfigFromNic(String instance,
String accessConfigName,
String networkInterfaceName)
Deletes an access config from an instance's network interface.
|
Operation |
detachDisk(String instance,
String deviceName)
Detaches an attached disk from an instance
|
Instance |
get(String instance)
Returns an instance by name or null if not found.
|
Instance.SerialPortOutput |
getSerialPortOutput(String instance)
Returns the specified instance's serial port output.
|
Instance.SerialPortOutput |
getSerialPortOutput(String instance,
int port)
Returns the specified instance's serial port output.
|
Iterator<ListPage<Instance>> |
list() |
Iterator<ListPage<Instance>> |
list(ListOptions options) |
ListPage<Instance> |
listPage(String pageToken,
ListOptions listOptions)
Retrieves the list of instance resources available to the specified project.
|
Operation |
reset(String instance)
Hard-resets the instance.
|
Operation |
setDiskAutoDelete(String instanceName,
String deviceName,
boolean autoDelete)
Sets the auto-delete flag for a disk attached to an instance
|
Operation |
setMetadata(String instance,
Metadata metadata)
Sets metadata for an instance using the data included in the request.
|
Operation |
setScheduling(String instanceName,
Instance.Scheduling.OnHostMaintenance onHostMaintenance,
boolean automaticRestart,
boolean preemptible)
Sets an instance's scheduling options.
|
Operation |
setTags(String instance,
Iterable<String> items,
String fingerprint)
Lists items for an instance
|
Operation |
start(String instance)
This method starts an instance that was stopped using the using the
stop(String) method. |
Operation |
stop(String instance)
This method stops a running instance, shutting it down cleanly, and allows you to restart
the instance at a later time.
|
@Named(value="Instances:get")
@GET
@Path(value="/{instance}")
@Nullable
Instance get(@PathParam(value="instance")
String instance)
@Named(value="Instances:insert") @POST @Produces(value="application/json") Operation create(NewInstance template)
template - the instance template@Named(value="Instances:delete")
@DELETE
@Path(value="/{instance}")
@Nullable
Operation delete(@PathParam(value="instance")
String instance)
@Named(value="Instances:addAccessConfig")
@POST
@Produces(value="application/json")
@Path(value="/{instance}/addAccessConfig")
Operation addAccessConfigToNic(@PathParam(value="instance")
String instance,
Instance.NetworkInterface.AccessConfig accessConfig,
@QueryParam(value="networkInterface")
String networkInterfaceName)
instance - the instance name.accessConfig - the AccessConfig to add.networkInterfaceName - network interface name.@Named(value="Instances:deleteAccessConfig")
@POST
@Path(value="/{instance}/deleteAccessConfig")
Operation deleteAccessConfigFromNic(@PathParam(value="instance")
String instance,
@QueryParam(value="accessConfig")
String accessConfigName,
@QueryParam(value="networkInterface")
String networkInterfaceName)
instance - the instance name.accessConfigName - the name of the access config to deletenetworkInterfaceName - network interface name.@Named(value="Instances:getSerialPortOutput")
@GET
@Path(value="/{instance}/serialPort")
Instance.SerialPortOutput getSerialPortOutput(@PathParam(value="instance")
String instance)
instance - the instance name.@Named(value="Instances:getSerialPortOutput")
@GET
@Path(value="/{instance}/serialPort")
Instance.SerialPortOutput getSerialPortOutput(@PathParam(value="instance")
String instance,
@QueryParam(value="port")
int port)
instance - the instance name.@Named(value="Instances:reset")
@POST
@Path(value="/{instance}/reset")
Operation reset(@PathParam(value="instance")
String instance)
instance - the instance name@Named(value="Instances:attachDisk")
@POST
@Produces(value="application/json")
@Path(value="/{instance}/attachDisk")
Operation attachDisk(@PathParam(value="instance")
String instance,
AttachDisk attachDiskOptions)
instance - The instance name to attach toattachDiskOptions - The options for attaching the disk.@Named(value="Instances:detachDisk")
@POST
@Path(value="/{instance}/detachDisk")
Operation detachDisk(@PathParam(value="instance")
String instance,
@QueryParam(value="deviceName")
String deviceName)
instance - The instance name to attach todeviceName - The device name of the disk to detach.@Named(value="Instances:setMetadata")
@POST
@Path(value="/{instance}/setMetadata")
Operation setMetadata(@PathParam(value="instance")
String instance,
Metadata metadata)
Metadata update = instanceApi.get("myInstance").metadata().clone();
update.put("newItem","newItemValue");
instanceApi.setMetadata("myInstance", update);
instance - The name of the instancemetadata - the metadata to set@Named(value="Instances:setTags")
@POST
@Path(value="/{instance}/setTags")
@Produces(value="application/json")
Operation setTags(@PathParam(value="instance")
String instance,
Iterable<String> items,
String fingerprint)
instance - the name of the instanceitems - A set of itemsfingerprint - The current fingerprint for the items@Named(value="Instances:setDiskAutoDelete")
@POST
@Path(value="/{instance}/setDiskAutoDelete")
Operation setDiskAutoDelete(@PathParam(value="instance")
String instanceName,
@QueryParam(value="deviceName")
String deviceName,
@QueryParam(value="autoDelete")
boolean autoDelete)
instanceName - The name of the instancedeviceName - Disk device name to modify.autoDelete - Whether to auto-delete the disk when the instance is deleted@Named(value="Instances:setScheduling")
@POST
@Path(value="/{instance}/setScheduling")
Operation setScheduling(@PathParam(value="instance")
String instanceName,
Instance.Scheduling.OnHostMaintenance onHostMaintenance,
boolean automaticRestart,
boolean preemptible)
instanceName - The name of the instanceonHostMaintenance - either MIGRATE or TERMINATE the default is MIGRATE (Live Migration).automaticRestart - Defines whether the Instance should be automatically
restarted when it is terminated by Compute Engine (not terminated by user).
Used when onHostMaintenance is set to TERMINATE.preemptible - Defines whether the Instance should be launched as spot instance@Named(value="Instances:start")
@POST
@Path(value="/{instance}/start")
@Produces(value="application/json")
Operation start(@PathParam(value="instance")
String instance)
stop(String) method.instance - - name of the instance to be started@Named(value="Instances:stop")
@POST
@Path(value="/{instance}/stop")
@Produces(value="application/json")
Operation stop(@PathParam(value="instance")
String instance)
instance - @Named(value="Instances:list") @GET ListPage<Instance> listPage(@Nullable@QueryParam(value="pageToken") String pageToken, ListOptions listOptions)
pageToken - marks the beginning of the next list pagelistOptions - listing options@Named(value="Instances:list") @GET Iterator<ListPage<Instance>> list()
listPage(String, ListOptions)@Named(value="Instances:list") @GET Iterator<ListPage<Instance>> list(ListOptions options)
listPage(String, ListOptions)Copyright © 2009-2018 The Apache Software Foundation. All Rights Reserved.