...

Source file src/github.com/Azure/azure-sdk-for-go/services/classic/management/networksecuritygroup/entities.go

Documentation: github.com/Azure/azure-sdk-for-go/services/classic/management/networksecuritygroup

     1  // +build go1.7
     2  
     3  // Package networksecuritygroup implements operations for managing network security groups
     4  // using the Service Management REST API
     5  //
     6  // https://msdn.microsoft.com/en-us/library/azure/dn913824.aspx
     7  package networksecuritygroup
     8  
     9  // Copyright (c) Microsoft Corporation. All rights reserved.
    10  // Licensed under the MIT License. See License.txt in the project root for license information.
    11  
    12  import (
    13  	"encoding/xml"
    14  
    15  	"github.com/Azure/azure-sdk-for-go/services/classic/management"
    16  )
    17  
    18  // SecurityGroupClient is used to perform operations on network security groups
    19  type SecurityGroupClient struct {
    20  	client management.Client
    21  }
    22  
    23  // SecurityGroupRequest represents a network security group
    24  //
    25  // https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx
    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  // SecurityGroupResponse represents a network security group
    34  //
    35  // https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx
    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  // SecurityGroupList represents a list of security groups
    46  type SecurityGroupList []SecurityGroupResponse
    47  
    48  // SecurityGroupState represents a security group state
    49  type SecurityGroupState string
    50  
    51  // These constants represent the possible security group states
    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  // RuleRequest represents a single rule of a network security group
    61  //
    62  // https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx#bk_rules
    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  // RuleResponse represents a single rule of a network security group
    77  //
    78  // https://msdn.microsoft.com/en-us/library/azure/dn913821.aspx#bk_rules
    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  // RuleType represents a rule type
    95  type RuleType string
    96  
    97  // These constants represent the possible rule types
    98  const (
    99  	RuleTypeInbound  RuleType = "Inbound"
   100  	RuleTypeOutbound RuleType = "Outbound"
   101  )
   102  
   103  // RuleAction represents a rule action
   104  type RuleAction string
   105  
   106  // These constants represent the possible rule actions
   107  const (
   108  	RuleActionAllow RuleAction = "Allow"
   109  	RuleActionDeny  RuleAction = "Deny"
   110  )
   111  
   112  // RuleProtocol represents a rule protocol
   113  type RuleProtocol string
   114  
   115  // These constants represent the possible rule types
   116  const (
   117  	RuleProtocolTCP RuleProtocol = "TCP"
   118  	RuleProtocolUDP RuleProtocol = "UDP"
   119  	RuleProtocolAll RuleProtocol = "*"
   120  )
   121  

View as plain text