github.com/Pankov404/juju@v0.0.0-20150703034450-be266991dceb/provider/gce/google/export_test.go (about) 1 // Copyright 2014 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package google 5 6 import ( 7 "google.golang.org/api/compute/v1" 8 ) 9 10 var ( 11 NewRawConnection = &newRawConnection 12 13 NewInstanceRaw = newInstance 14 PackMetadata = packMetadata 15 UnpackMetadata = unpackMetadata 16 FormatMachineType = formatMachineType 17 FirewallSpec = firewallSpec 18 ExtractAddresses = extractAddresses 19 ) 20 21 func SetRawConn(conn *Connection, raw rawConnectionWrapper) { 22 conn.raw = raw 23 } 24 25 func ExposeRawService(conn *Connection) *compute.Service { 26 return conn.raw.(*rawConn).Service 27 } 28 29 func NewAttached(spec DiskSpec) *compute.AttachedDisk { 30 return spec.newAttached() 31 } 32 33 func NewAvailabilityZone(zone *compute.Zone) AvailabilityZone { 34 return AvailabilityZone{zone: zone} 35 } 36 37 func GetInstanceSpec(inst *Instance) *InstanceSpec { 38 return inst.spec 39 } 40 41 // TODO(ericsnow) Elimiinate this. 42 func SetInstanceSpec(inst *Instance, spec *InstanceSpec) { 43 inst.spec = spec 44 } 45 46 func NewNetInterface(spec NetworkSpec, name string) *compute.NetworkInterface { 47 return spec.newInterface(name) 48 } 49 50 func InstanceSpecRaw(spec InstanceSpec) *compute.Instance { 51 return spec.raw() 52 } 53 54 func ConnAddInstance(conn *Connection, inst *compute.Instance, mtype string, zones []string) error { 55 return conn.addInstance(inst, mtype, zones) 56 } 57 58 func ConnRemoveInstance(conn *Connection, id, zone string) error { 59 return conn.removeInstance(id, zone) 60 }