forked from fifthecho/CloudStack-PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CloudStackListZones.ps1
127 lines (123 loc) · 7 KB
/
CloudStackListZones.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<#
.SYNOPSIS
A CloudStack/CloudPlatform Zone Listing Scriptlet.
.DESCRIPTION
List all Zones of a CloudStack Cloud.
.EXAMPLE
CloudStackListZones.ps1
#>
# Writen by Jeff Moody ([email protected])
#
# 2013/5/17 v1.0 created
Import-Module CloudStackClient
$parameters = Import-CloudStackConfig
if ($parameters -ne 1) {
$cloud = New-CloudStack -apiEndpoint $parameters[0] -apiPublicKey $parameters[1] -apiSecretKey $parameters[2]
$job = Get-CloudStack -cloudStack $cloud -command listZones
$zones = $job.listzonesresponse
foreach ($ZONE in $zones.zone) {
$ZONEID = $ZONE.id
$ZONENAME = $ZONE.name
Write-Host("Zone `"$ZONENAME`" is associated with Zone ID $ZONEID")
}
}
else {
Write-Error "Please configure the $env:userprofile\cloud-settings.txt file"
}
# SIG # Begin signature block
# MIIRpQYJKoZIhvcNAQcCoIIRljCCEZICAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUCgwbsx32+hvKSdRr9DvxCpWW
# J7Gggg3aMIIGcDCCBFigAwIBAgIBJDANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQG
# EwJJTDEWMB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