1
// Copyright 2013 Canonical Ltd. This software is licensed under the
2
// GNU Lesser General Public License version 3 (see the file COPYING).
4
// Test helpers to fake objects that go into, or come out of, the Azure API.
12
type endpointParams struct {
20
func makeEndpoint(params endpointParams) *InputEndpoint {
21
if params.setname == "" {
22
params.setname = MakeRandomString(10)
24
if params.name == "" {
25
params.name = MakeRandomString(10)
27
if params.protocol == "" {
28
params.protocol = MakeRandomString(10)
30
if params.localport == 0 {
31
params.localport = rand.Intn(65535)
34
params.port = rand.Intn(65535)
37
return &InputEndpoint{
38
LoadBalancedEndpointSetName: params.setname,
39
LocalPort: params.localport,
42
Protocol: params.protocol}
45
func makeLinuxProvisioningConfiguration() *ConfigurationSet {
46
hostname := MakeRandomString(10)
47
username := MakeRandomString(10)
48
password := MakeRandomString(10)
49
userdata := MakeRandomString(10)
50
disableSSH := BoolToString(MakeRandomBool())
51
return NewLinuxProvisioningConfigurationSet(hostname, username, password, userdata, disableSSH)
54
func makeOSVirtualHardDisk() *OSVirtualHardDisk {
55
HostCaching := BoolToString(MakeRandomBool())
56
DiskLabel := MakeRandomString(10)
57
DiskName := MakeRandomString(10)
58
MediaLink := MakeRandomString(10)
59
SourceImageName := MakeRandomString(10)
61
return &OSVirtualHardDisk{
62
HostCaching: HostCaching,
66
SourceImageName: SourceImageName}
69
func makeRole() *Role {
70
RoleSize := "ExtraSmall"
71
RoleName := MakeRandomString(10)
72
RoleType := "PersistentVMRole"
73
config := makeLinuxProvisioningConfiguration()
74
configset := []ConfigurationSet{*config}
80
ConfigurationSets: configset}
83
func makeDnsServer() *DnsServer {
84
name := MakeRandomString(10)
85
address := MakeRandomString(10)
92
func makeDeployment() *Deployment {
93
Name := MakeRandomString(10)
94
DeploymentSlot := "Staging"
95
Label := MakeRandomString(10)
96
VirtualNetworkName := MakeRandomString(10)
98
RoleList := []Role{*role}
99
Dns := []DnsServer{*makeDnsServer()}
105
DeploymentSlot: DeploymentSlot,
108
VirtualNetworkName: VirtualNetworkName,
113
func makeCreateStorageServiceInput() *CreateStorageServiceInput {
114
ServiceName := MakeRandomString(10)
115
Description := MakeRandomString(10)
116
Label := MakeRandomString(10)
117
AffinityGroup := MakeRandomString(10)
118
Location := MakeRandomString(10)
119
GeoReplicationEnabled := BoolToString(MakeRandomBool())
120
ExtendedProperties := []ExtendedProperty{{
121
Name: MakeRandomString(10),
122
Value: MakeRandomString(10)}}
124
return &CreateStorageServiceInput{
126
ServiceName: ServiceName,
127
Description: Description,
129
AffinityGroup: AffinityGroup,
131
GeoReplicationEnabled: GeoReplicationEnabled,
132
ExtendedProperties: ExtendedProperties}