github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/iec/v1/firewalls/results.go (about)

     1  package firewalls
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  	"github.com/huaweicloud/golangsdk/openstack/iec/v1/common"
     6  )
     7  
     8  type commonResult struct {
     9  	golangsdk.Result
    10  }
    11  
    12  type RespFirewallRulesEntity struct {
    13  	ID          string `json:"id,omitempty"`
    14  	Name        string `json:"name,omitempty"`
    15  	Description string `json:"description,omitempty"`
    16  	Enabled     bool   `json:"enabled,omitempty"`
    17  	Action      string `json:"action,omitempty"`
    18  	Protocol    string `json:"protocol,omitempty"`
    19  	IPVersion   int    `json:"ip_version,omitempty"`
    20  	DstIPAddr   string `json:"destination_ip_address,omitempty"`
    21  	DstPort     string `json:"destination_port,omitempty"`
    22  	SrcIPAddr   string `json:"source_ip_address,omitempty"`
    23  	SrcPort     string `json:"source_port,omitempty"`
    24  	OperateType string `json:"operate_type,omitempty"`
    25  }
    26  
    27  type RespPolicyEntity struct {
    28  	ID            string                    `json:"id"`
    29  	Name          string                    `json:"name,omitempty"`
    30  	Description   string                    `json:"description,omitempty"`
    31  	Audited       bool                      `json:"audited,omitempty"`
    32  	Shared        bool                      `json:"shared,omitempty"`
    33  	FirewallRules []RespFirewallRulesEntity `json:"firewall_rules,omitempty"`
    34  }
    35  
    36  type Firewall struct {
    37  	ID                 string           `json:"id"`
    38  	DomainID           string           `json:"domain_id"`
    39  	Name               string           `json:"name"`
    40  	Description        string           `json:"description"`
    41  	AdminStateUp       bool             `json:"admin_state_up"`
    42  	Status             string           `json:"status"`
    43  	IngressFWPolicy    RespPolicyEntity `json:"ingress_firewall_policy"`
    44  	EgressFWPolicy     RespPolicyEntity `json:"egress_firewall_policy"`
    45  	IngressFWRuleCount int64            `json:"ingress_firewall_rule_count,omitempty"`
    46  	EgressFWRuleCount  int64            `json:"egress_firewall_rule_count,omitempty"`
    47  	Subnets            []common.Subnet  `json:"subnets,omitempty"`
    48  }
    49  
    50  type UpdateFirewallResp struct {
    51  	ID     string `json:"id"`
    52  	Status string `json:"status"`
    53  }
    54  
    55  type CreateResult struct {
    56  	commonResult
    57  }
    58  
    59  func (r CreateResult) Extract() (*Firewall, error) {
    60  	var entity Firewall
    61  	err := r.ExtractIntoStructPtr(&entity, "firewall")
    62  	return &entity, err
    63  }
    64  
    65  type DeleteResult struct {
    66  	golangsdk.ErrResult
    67  }
    68  
    69  type GetResult struct {
    70  	commonResult
    71  }
    72  
    73  func (r GetResult) Extract() (*Firewall, error) {
    74  	var entity Firewall
    75  	err := r.ExtractIntoStructPtr(&entity, "firewall")
    76  	return &entity, err
    77  }
    78  
    79  type UpdateResult struct {
    80  	commonResult
    81  }
    82  
    83  func (r UpdateResult) Extract() (*UpdateFirewallResp, error) {
    84  	var entity UpdateFirewallResp
    85  	err := r.ExtractIntoStructPtr(&entity, "firewall")
    86  	return &entity, err
    87  }
    88  
    89  type UpdateRuleResult struct {
    90  	commonResult
    91  }
    92  
    93  func (r UpdateRuleResult) Extract() (*Firewall, error) {
    94  	var entity Firewall
    95  	err := r.ExtractIntoStructPtr(&entity, "firewall")
    96  	return &entity, err
    97  }
    98  
    99  // Firewalls firewall列表对象
   100  type Firewalls struct {
   101  	Firewalls []Firewall `json:"firewalls"`
   102  	Count     int        `json:"count"`
   103  }
   104  
   105  type ListResult struct {
   106  	commonResult
   107  }
   108  
   109  func (r ListResult) Extract() (*Firewalls, error) {
   110  	var entity Firewalls
   111  	err := r.ExtractIntoStructPtr(&entity, "")
   112  	return &entity, err
   113  }