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)
}
DeleteInstanceGroupForZone deletes an instance group for the given zone.
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
}