-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeployParameters.go
56 lines (45 loc) · 1.26 KB
/
DeployParameters.go
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
package main
import (
"encoding/json"
)
const schema = "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#"
const contentVersion = "1.0.0.0"
type DeployParemeters struct {
Schema string `json:"$schema"`
ContentVersion string `json:"contentVersion"`
Parameters Parameters `json:"parameters"`
}
type Parameters struct {
AccountName `json:"accountName"`
AccessPolicies `json:"accessPolicies"`
}
type AccountName struct {
Value string `json:"value"`
}
type AccessPolicies struct {
Value [] AccessPoliciesValue `json:"value"`
}
type AccessPoliciesValue struct {
ObjectId string `json:"objectId"`
}
func (data *DeployParemeters) Fill(accountName *string, accessPolicies *[]string) DeployParemeters {
accessPoliciesValues := make([]AccessPoliciesValue, len(*accessPolicies))
for i := 0 ; i < len(*accessPolicies); i++ {
accessPoliciesValues[i] = AccessPoliciesValue{ObjectId: (*accessPolicies)[i]}
}
return DeployParemeters{
Schema: schema,
ContentVersion: contentVersion,
Parameters: Parameters{
AccountName{
Value: *accountName,
},
AccessPolicies{
Value: accessPoliciesValues,
},
},
}
}
func (deployParemeters *DeployParemeters) Marshal() ([]uint8, error) {
return json.MarshalIndent(deployParemeters, "", " ")
}