org.jclouds.googlecomputeengine.features
Interface InstanceApi


public interface InstanceApi

Provides access to Instances via their REST API.

See Also:
, InstanceApi

Method Summary
 Operation addAccessConfigToNicInZone(String zone, String instanceName, Instance.NetworkInterface.AccessConfig accessConfig, String networkInterfaceName)
          Adds an access config to an instance's network interface.
 Operation attachDiskInZone(String zone, String instanceName, AttachDiskOptions attachDiskOptions)
          Attaches a disk to an instance
 Operation createInZone(String instanceName, String zone, InstanceTemplate template)
          Creates a instance resource in the specified project using the data included in the request.
 Operation deleteAccessConfigFromNicInZone(String zone, String instanceName, String accessConfigName, String networkInterfaceName)
          Deletes an access config from an instance's network interface.
 Operation deleteInZone(String zone, String instanceName)
          Deletes the specified instance resource.
 Operation detachDiskInZone(String zone, String instanceName, String deviceName)
          Detaches an attached disk from an instance
 Instance getInZone(String zone, String instanceName)
          Returns the specified instance resource.
 Instance.SerialPortOutput getSerialPortOutputInZone(String zone, String instanceName)
          Returns the specified instance's serial port output.
 ListPage<Instance> listAtMarkerInZone(String zone, String marker)
           
 ListPage<Instance> listAtMarkerInZone(String zone, String marker, ListOptions listOptions)
          Retrieves the list of instance resources available to the specified project.
 ListPage<Instance> listFirstPageInZone(String zone)
          A paged version of InstanceApi#listInZone()
 org.jclouds.collect.PagedIterable<Instance> listInZone(String zone)
           
 org.jclouds.collect.PagedIterable<Instance> listInZone(String zone, ListOptions options)
           
 Operation resetInZone(String zone, String instanceName)
          Hard-resets the instance.
 Operation setMetadataInZone(String zone, String instanceName, Map<String,String> metadata, String fingerprint)
          Sets metadata for an instance using the data included in the request.
 Operation setTagsInZone(String zone, String instanceName, Set<String> items, String fingerprint)
          Sets items for an instance
 

Method Detail

getInZone

@Named(value="Instances:get")
@Nullable
Instance getInZone(String zone,
                                  String instanceName)
Returns the specified instance resource.

Parameters:
zone - zone the instance is in.
instanceName - name of the instance resource to return.
Returns:
an Instance resource

createInZone

@Named(value="Instances:insert")
Operation createInZone(String instanceName,
                             String zone,
                             InstanceTemplate template)
Creates a instance resource in the specified project using the data included in the request.

Parameters:
instanceName - this name of the instance to be created
zone - the name of the zone where the instance will be created
template - the instance template
Returns:
an Operation resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field.

deleteInZone

@Named(value="Instances:delete")
@Nullable
Operation deleteInZone(String zone,
                                      String instanceName)
Deletes the specified instance resource.

Parameters:
zone - the instance is in.
instanceName - name of the instance resource to delete.
Returns:
an Operation resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field. If the instance did not exist the result is null.

listFirstPageInZone

@Named(value="Instances:list")
ListPage<Instance> listFirstPageInZone(String zone)
A paged version of InstanceApi#listInZone()

Parameters:
zone - zone instances are in
Returns:
a Paged, Fluent Iterable that is able to fetch additional pages when required
See Also:
PagedIterable, listAtMarkerInZone(String, String, org.jclouds.googlecomputeengine.options.ListOptions)

listAtMarkerInZone

@Named(value="Instances:list")
ListPage<Instance> listAtMarkerInZone(String zone,
                                            @Nullable
                                            String marker,
                                            ListOptions listOptions)
Retrieves the list of instance resources available to the specified project. By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not been set.

Parameters:
zone - zone instances are in
marker - marks the beginning of the next list page
listOptions - listing options
Returns:
a page of the list
See Also:
ListOptions, ListPage

listAtMarkerInZone

@Named(value="Instances:list")
ListPage<Instance> listAtMarkerInZone(String zone,
                                            @Nullable
                                            String marker)
See Also:
listAtMarkerInZone(String, String, org.jclouds.googlecomputeengine.options.ListOptions)

listInZone

@Named(value="Instances:list")
org.jclouds.collect.PagedIterable<Instance> listInZone(String zone)
See Also:
listInZone(String, org.jclouds.googlecomputeengine.options.ListOptions)

listInZone

@Named(value="Instances:list")
org.jclouds.collect.PagedIterable<Instance> listInZone(String zone,
                                                             ListOptions options)
See Also:
listInZone(String, org.jclouds.googlecomputeengine.options.ListOptions)

addAccessConfigToNicInZone

@Named(value="Instances:addAccessConfig")
Operation addAccessConfigToNicInZone(String zone,
                                           String instanceName,
                                           Instance.NetworkInterface.AccessConfig accessConfig,
                                           String networkInterfaceName)
Adds an access config to an instance's network interface.

Parameters:
zone - zone instance is in
instanceName - the instance name.
accessConfig - the AccessConfig to add.
networkInterfaceName - network interface name.
Returns:
an Operation resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field.

deleteAccessConfigFromNicInZone

@Named(value="Instances:deleteAccessConfig")
Operation deleteAccessConfigFromNicInZone(String zone,
                                                String instanceName,
                                                String accessConfigName,
                                                String networkInterfaceName)
Deletes an access config from an instance's network interface.

Parameters:
zone - zone instance is in
instanceName - the instance name.
accessConfigName - the name of the access config to delete
networkInterfaceName - network interface name.
Returns:
an Operation resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field.

getSerialPortOutputInZone

@Named(value="Instances:serialPort")
Instance.SerialPortOutput getSerialPortOutputInZone(String zone,
                                                          String instanceName)
Returns the specified instance's serial port output.

Parameters:
zone - zone instance is in
instanceName - the instance name.
Returns:
if successful, this method returns a SerialPortOutput containing the instance's serial output.

resetInZone

@Named(value="Instances:reset")
@Nullable
Operation resetInZone(String zone,
                                     String instanceName)
Hard-resets the instance.

Parameters:
zone - the zone the instance is in
instanceName - the instance name
Returns:
an Operation resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field. If the instance did not exist the result is null.

attachDiskInZone

@Named(value="Instances:attachDisk")
@Nullable
Operation attachDiskInZone(String zone,
                                          String instanceName,
                                          AttachDiskOptions attachDiskOptions)
Attaches a disk to an instance

Parameters:
zone - The zone the instance is in.
instanceName - The instance name to attach to
attachDiskOptions - The options for attaching the disk.
Returns:
an Operation resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field.

detachDiskInZone

@Named(value="Instances:detachDisk")
@Nullable
Operation detachDiskInZone(String zone,
                                          String instanceName,
                                          String deviceName)
Detaches an attached disk from an instance

Parameters:
zone - The zone the instance is in.
instanceName - The instance name to attach to
deviceName - The device name of the disk to detach.
Returns:
an Operation resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field.

setMetadataInZone

@Named(value="Instances:setMetadata")
@Nullable
Operation setMetadataInZone(String zone,
                                           String instanceName,
                                           Map<String,String> metadata,
                                           String fingerprint)
Sets metadata for an instance using the data included in the request.

NOTE: This *sets* metadata items on the project (vs *adding* items to metadata), if there are pre-existing metadata items that must be kept these must be fetched first and then re-set on the new Metadata, e.g.


    Metadata.Builder current = instanceApi.getInZone("us-central1-a", "myInstance").getMetadata().toBuilder();
    current.addItem("newItem","newItemValue");
    instanceApi.setMetadataInZone("us-central1-a", "myInstance", current.build());
 

Parameters:
zone - The zone the instance is in
instanceName - The name of the instance
metadata - the metadata to set
fingerprint - The current fingerprint for the items
Returns:
an Operations resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field.

setTagsInZone

@Named(value="Instances:setTags")
@Nullable
Operation setTagsInZone(String zone,
                                       String instanceName,
                                       Set<String> items,
                                       String fingerprint)
Sets items for an instance

Parameters:
zone - The zone the instance is in
instanceName - the name of the instance
items - A set of items
fingerprint - The current fingerprint for the items
Returns:
an Operations resource. To check on the status of an operation, poll the Operations resource returned to you, and look for the status field.


Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.