~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/provider/gce/google/export_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 NewDetached(spec DiskSpec) (*compute.Disk, error) {
 
34
        return spec.newDetached()
 
35
}
 
36
 
 
37
func NewAvailabilityZone(zone *compute.Zone) AvailabilityZone {
 
38
        return AvailabilityZone{zone: zone}
 
39
}
 
40
 
 
41
func GetInstanceSpec(inst *Instance) *InstanceSpec {
 
42
        return inst.spec
 
43
}
 
44
 
 
45
// TODO(ericsnow) Elimiinate this.
 
46
func SetInstanceSpec(inst *Instance, spec *InstanceSpec) {
 
47
        inst.spec = spec
 
48
}
 
49
 
 
50
func NewNetInterface(spec NetworkSpec, name string) *compute.NetworkInterface {
 
51
        return spec.newInterface(name)
 
52
}
 
53
 
 
54
func InstanceSpecRaw(spec InstanceSpec) *compute.Instance {
 
55
        return spec.raw()
 
56
}
 
57
 
 
58
func ConnAddInstance(conn *Connection, inst *compute.Instance, mtype string, zones []string) error {
 
59
        return conn.addInstance(inst, mtype, zones)
 
60
}
 
61
 
 
62
func ConnRemoveInstance(conn *Connection, id, zone string) error {
 
63
        return conn.removeInstance(id, zone)
 
64
}