nsx_client

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2024 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConnectivity

func CheckConnectivity(api string) (err error)

Types

type Client

type Client struct {
	HttpClient *http.Client
	BaseUrl    string
	Header     http.Header
	XsrfToken  string
	// contains filtered or unexported fields
}

func SetupClient

func SetupClient(nsxApi, nsxUsername, nsxPassword string, skipVerify, debug bool, log Logger) (*Client, error)

func (*Client) GetSectionRules

func (c *Client) GetSectionRules(sectionId string, debug bool, log Logger) ([]Rule, error)

func (*Client) GetSectionStats

func (c *Client) GetSectionStats(sectionId string, debug bool, log Logger) (SectionStats, error)

func (*Client) GetSgSections

func (c *Client) GetSgSections(debug bool, log Logger) ([]Section, error)

type Destinations

type Destinations struct {
	TargetDisplayName string `json:"target_display_name"`
	IsValid           bool   `json:"is_valid"`
	TargetType        string `json:"target_type"`
	TargetID          string `json:"target_id"`
}

type Logger added in v0.1.1

type Logger interface {
	Fatalf(format string, args ...interface{})
	Printf(format string, args ...interface{})
}

Logger is used for outputting log-cache results and errors

type Rule

type Rule struct {
	ID                   string         `json:"id"`
	DisplayName          string         `json:"display_name"`
	Notes                string         `json:"notes"`
	DestinationsExcluded bool           `json:"destinations_excluded"`
	Destinations         []Destinations `json:"destinations,omitempty"`
	Services             []Services     `json:"services,omitempty"`
	IPProtocol           string         `json:"ip_protocol"`
	RuleTag              string         `json:"rule_tag"`
	Logged               bool           `json:"logged"`
	Action               string         `json:"action"`
	SourcesExcluded      bool           `json:"sources_excluded"`
	Disabled             bool           `json:"disabled"`
	Direction            string         `json:"direction"`
	Revision             int            `json:"_revision"`
}

type RuleStats

type RuleStats struct {
	RuleID                    string `json:"rule_id"`
	PacketCount               int    `json:"packet_count"`
	ByteCount                 int    `json:"byte_count"`
	SessionCount              int    `json:"session_count"`
	HitCount                  int    `json:"hit_count"`
	L7AcceptCount             int    `json:"l7_accept_count"`
	L7RejectCount             int    `json:"l7_reject_count"`
	L7RejectWithResponseCount int    `json:"l7_reject_with_response_count"`
	PopularityIndex           int    `json:"popularity_index"`
	MaxPopularityIndex        int    `json:"max_popularity_index"`
	MaxSessionCount           int    `json:"max_session_count"`
	TotalSessionCount         int    `json:"total_session_count"`
	Schema                    string `json:"_schema"`
}

type RulesResponse

type RulesResponse struct {
	Cursor      string `json:"cursor"`
	SortBy      string `json:"sort_by"`
	ResultCount int    `json:"result_count"`
	Results     []Rule `json:"results"`
}

type Section

type Section struct {
	LastModifiedTime int64  `json:"_last_modified_time"`
	DisplayName      string `json:"display_name"`
	Tags             []Tags `json:"tags"`
	CreateTime       int64  `json:"_create_time"`
	ID               string `json:"id"`
}

type SectionResponse

type SectionResponse struct {
	Results     []Section `json:"results"`
	ResultCount int       `json:"result_count"`
	Cursor      string    `json:"cursor"`
}

type SectionStats

type SectionStats struct {
	Results []RuleStats `json:"results"`
}

type Service

type Service struct {
	ResourceType      string   `json:"resource_type"`
	IcmpType          int      `json:"icmp_type"`
	Protocol          string   `json:"protocol"`
	L4Protocol        string   `json:"l4_protocol"`
	IcmpCode          int      `json:"icmp_code"`
	Destination_ports []string `json:"destination_ports"`
}

type Services

type Services struct {
	Service Service `json:"service"`
}

type Tags

type Tags struct {
	Scope string `json:"scope"`
	Tag   string `json:"tag"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL