func (gce *GCEClient) GetAvailableZones() (*compute.ZoneList, error) {
	return gce.service.Zones.List(gce.projectID).Do()
}
GetAvailableZones returns all available zones for this project
package gce
import (
	"errors"
	"fmt"
	"net/http"
	"strings"
	"time"
	"github.com/golang/glog"
	"golang.org/x/net/context"
	"golang.org/x/oauth2/google"
	compute "google.golang.org/api/compute/v1"
	"google.golang.org/api/googleapi"
	"k8s.io/kubernetes/pkg/util/wait"
	"strconv"
)
const (
	gceAffinityTypeNone = "NONE"
	gceAffinityTypeClientIP = "CLIENT_IP"
	gceAffinityTypeClientIPProto = "CLIENT_IP_PROTO"
	operationPollInterval        = 3 * time.Second
	operationPollTimeoutDuration = 30 * time.Minute
	servicePort = "service-port"
)
var (
	ErrInstanceNotFound = errors.New("Instance not found")
)
type GCEClient struct {
	service    *compute.Service
	projectID  string
	networkURL string
}
func CreateGCECloud(project string, network string) (*GCEClient, error) {
	ctx := context.TODO()
	client, err := google.DefaultClient(ctx, compute.ComputeScope)
	if err != nil {
		return nil, err
	}
	svc, err := compute.New(client)
	if err != nil {
		return nil, err
	}
	return &GCEClient{
		service:    svc,
		projectID:  project,
		networkURL: makeNetworkURL(project, network),
	}, nil
}
func (gce *GCEClient) ListInstancesInZone(zone string) (*compute.InstanceList, error) {
	return gce.service.Instances.List(gce.projectID, zone).Do()
}
func (gce *GCEClient) CreateInstanceGroupForZone(name string, zone string, ports map[string]int64) error {
	namedPorts := make([]*compute.NamedPort, len(ports))
	for name, port := range ports {
		namedPorts = append(namedPorts, &compute.NamedPort{
			Name: name,
			Port: port,
		})
	}
	ig := &compute.InstanceGroup{
		Name:       name,
		NamedPorts: namedPorts,
		Network:    gce.networkURL}
	op, err := gce.service.InstanceGroups.Insert(gce.projectID, zone, ig).Do()
	if err != nil {
		return err
	}
	if err = gce.waitForZoneOp(op, zone); err != nil {
		return err
	}
	return nil
}
func (gce *GCEClient) DeleteInstanceGroupForZone(name string, zone string) error {
	op, err := gce.service.InstanceGroups.Delete(
		gce.projectID, zone, name).Do()
	if err != nil {
		return err
	}
	return gce.waitForZoneOp(op, zone)
}
func (gce *GCEClient) ListInstanceGroupsForZone(zone string) (*compute.InstanceGroupList, error) {
	return gce.service.InstanceGroups.List(gce.projectID, zone).Do()
}
func (gce *GCEClient) ListInstancesInInstanceGroupForZone(name string, zone string) (*compute.InstanceGroupsListInstances, error) {
	return gce.service.InstanceGroups.ListInstances(
		gce.projectID, zone, name,
		&compute.InstanceGroupsListInstancesRequest{}).Do()
}
func (gce *GCEClient) GetInstanceByNameAndZone(name string, zone string) (*compute.Instance, error) {
	name = canonicalizeInstanceName(name)
	res, err := gce.service.Instances.Get(gce.projectID, zone, name).Do()
	if err != nil {
		glog.Errorf("Failed to retrieve TargetInstance resource for instance: %s", name)
		if apiErr, ok := err.(*googleapi.Error); ok && apiErr.Code == http.StatusNotFound {
			return nil, ErrInstanceNotFound
		}
		return nil, err
	}
	return res, nil
}
func (gce *GCEClient) AddInstancesToInstanceGroup(name string, instanceNames []string, zone string) error {
	if len(instanceNames) == 0 {
		return nil
	}
	instances := []*compute.InstanceReference{}
	for _, ins := range instanceNames {
		instances = append(instances, &compute.InstanceReference{Instance: makeHostURL(gce.projectID, zone, ins)})
	}
	op, err := gce.service.InstanceGroups.AddInstances(
		gce.projectID, zone, name,
		&compute.InstanceGroupsAddInstancesRequest{
			Instances: instances,
		}).Do()
	if err != nil {
		return err
	}
	return gce.waitForZoneOp(op, zone)
}
func (gce *GCEClient) RemoveInstancesFromInstanceGroup(name string, instanceNames []string, zone string) error {
	if len(instanceNames) == 0 {
		return nil
	}
	instances := []*compute.InstanceReference{}
	for _, ins := range instanceNames {
		instanceLink := makeHostURL(gce.projectID, zone, ins)
		instances = append(instances, &compute.InstanceReference{Instance: instanceLink})
	}
	op, err := gce.service.InstanceGroups.RemoveInstances(
		gce.projectID, zone, name,
		&compute.InstanceGroupsRemoveInstancesRequest{
			Instances: instances,
		}).Do()
	if err != nil {
		if isHTTPErrorCode(err, http.StatusNotFound) {
			return nil
		}
		return err
	}
	return gce.waitForZoneOp(op, zone)
}
func (gce *GCEClient) SetPortToInstanceGroupForZone(name string, port int64, zone string) error {
	var namedPorts []*compute.NamedPort
	namedPorts = append(namedPorts, &compute.NamedPort{Name: servicePort, Port: port})
	op, err := gce.service.InstanceGroups.SetNamedPorts(
		gce.projectID, zone, name,
		&compute.InstanceGroupsSetNamedPortsRequest{
			NamedPorts: namedPorts}).Do()
	if err != nil {
		return err
	}
	if err = gce.waitForZoneOp(op, zone); err != nil {
		return err
	}
	return nil
}
func (gce *GCEClient) GetInstanceGroupForZone(name string, zone string) (*compute.InstanceGroup, error) {
	return gce.service.InstanceGroups.Get(gce.projectID, zone, name).Do()
}