...
1
2
3
4
5
6
7 package networksecuritygroup
8
9
10
11
12 import (
13 "encoding/xml"
14
15 "github.com/Azure/azure-sdk-for-go/services/classic/management"
16 )
17
18
19 type SecurityGroupClient struct {
20 client management.Client
21 }
22
23
24
25
26 type SecurityGroupRequest struct {
27 XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure NetworkSecurityGroup"`
28 Name string
29 Label string `xml:",omitempty"`
30 Location string `xml:",omitempty"`
31 }
32
33
34
35
36 type SecurityGroupResponse struct {
37 XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure NetworkSecurityGroup"`
38 Name string
39 Label string `xml:",omitempty"`
40 Location string `xml:",omitempty"`
41 State SecurityGroupState `xml:",omitempty"`
42 Rules []RuleResponse `xml:">Rule,omitempty"`
43 }
44
45
46 type SecurityGroupList []SecurityGroupResponse
47
48
49 type SecurityGroupState string
50
51
52 const (
53 SecurityGroupStateCreated SecurityGroupState = "Created"
54 SecurityGroupStateCreating SecurityGroupState = "Creating"
55 SecurityGroupStateUpdating SecurityGroupState = "Updating"
56 SecurityGroupStateDeleting SecurityGroupState = "Deleting"
57 SecurityGroupStateUnavailable SecurityGroupState = "Unavailable"
58 )
59
60
61
62
63 type RuleRequest struct {
64 XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Rule"`
65 Name string
66 Type RuleType
67 Priority int
68 Action RuleAction
69 SourceAddressPrefix string
70 SourcePortRange string
71 DestinationAddressPrefix string
72 DestinationPortRange string
73 Protocol RuleProtocol
74 }
75
76
77
78
79 type RuleResponse struct {
80 XMLName xml.Name `xml:"http://schemas.microsoft.com/windowsazure Rule"`
81 Name string
82 Type RuleType
83 Priority int
84 Action RuleAction
85 SourceAddressPrefix string
86 SourcePortRange string
87 DestinationAddressPrefix string
88 DestinationPortRange string
89 Protocol RuleProtocol
90 State string `xml:",omitempty"`
91 IsDefault bool `xml:",omitempty"`
92 }
93
94
95 type RuleType string
96
97
98 const (
99 RuleTypeInbound RuleType = "Inbound"
100 RuleTypeOutbound RuleType = "Outbound"
101 )
102
103
104 type RuleAction string
105
106
107 const (
108 RuleActionAllow RuleAction = "Allow"
109 RuleActionDeny RuleAction = "Deny"
110 )
111
112
113 type RuleProtocol string
114
115
116 const (
117 RuleProtocolTCP RuleProtocol = "TCP"
118 RuleProtocolUDP RuleProtocol = "UDP"
119 RuleProtocolAll RuleProtocol = "*"
120 )
121
View as plain text