zia

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIDs

func GetIDs[K Zid](obj []K) map[string]int

GetIDs is a generic function that receives an arrray object and return a map with the name as key and ID as value

func KeyGen

func KeyGen(BaseURL string, admin string, pass string, apiKey string) ([]*http.Cookie, error)

KeyGen function gets the authentication parameter and returns the JSESSIONID which is the cookie that authenticates the requests

Types

type AllowedUrls

type AllowedUrls struct {
	Urls []string `json:"whitelistUrls"`
}

AllowedUrls parses responses for Allowed urls

func (*AllowedUrls) GetName

func (c *AllowedUrls) GetName() string

func (c AllowedUrls) GetName() returns all the urls in a allowlist

func (*AllowedUrls) GetUrls

func (c *AllowedUrls) GetUrls(f string) []string

func (c Allowed) returns all the urls in a allowlist

func (AllowedUrls) PushItems

func (c AllowedUrls) PushItems(client *Client) error

PushItems pushes all the urls in a allowlist

func (*AllowedUrls) SetUrls

func (c *AllowedUrls) SetUrls(f string, u []string)

SetUrls sets all the urls in a allowlist

func (AllowedUrls) String added in v0.1.36

func (p AllowedUrls) String() string

String prints the struct in json pretty format

type AppGroup

type AppGroup struct {
	ID                  int      `json:"id"`
	Name                string   `json:"name,omitempty"`
	NetworkApplications []string `json:"networkApplications"`
	Description         string   `json:"description,omitempty"`
}

AppGroup parses network application groups

func (AppGroup) GetID

func (u AppGroup) GetID() (string, int)

GetID returns name, id

type BlockedUrls

type BlockedUrls struct {
	Urls []string `json:"blacklistUrls"`
}

BlockedUrls parses responses for blocked urls

func (*BlockedUrls) GetName

func (c *BlockedUrls) GetName() string

func (c BlockedUrls) GetName() returns all the urls in a blocklist

func (*BlockedUrls) GetUrls

func (c *BlockedUrls) GetUrls(f string) []string

func (c BlockedUrls) returns all the urls in a blocklist

func (BlockedUrls) PushItems

func (c BlockedUrls) PushItems(client *Client) error

PushItems pushes all the urls in a blocklist

func (*BlockedUrls) SetUrls

func (c *BlockedUrls) SetUrls(f string, u []string)

func (c BlockedUrls) sets all the urls in a blocklist

func (BlockedUrls) String added in v0.1.36

func (p BlockedUrls) String() string

String prints the struct in json pretty format

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
	RetryMax   int
	Log        *slog.Logger
}

Client contains the base url, http client and max number of retries per requests

func NewClient

func NewClient(cloud string, admin string, pass string, apiKey string) (*Client, error)

NewClient returns a client with the auth cookie, default http timeouts and max retries per requests cloud options: zscaler, zscalertwo, zscloud, etc. logger is set to info unless an env variable SLOG is set to DEBUG and st.dout

func NewClientLogger added in v0.1.39

func NewClientLogger(cloud, admin, pass, apiKey, level string, w io.Writer) (*Client, error)

New client logger creates a new cliente with a custom slog logger

func (*Client) Activate

func (c *Client) Activate() error

Activate activates all changes

func (*Client) AddDLPDictionary

func (c *Client) AddDLPDictionary(obj DLPDictionary) (int, error)

AddDLPDictionary adds a DLP dictionary and returns the id if created or error

func (*Client) AddDLPEngine added in v0.1.33

func (c *Client) AddDLPEngine(obj DLPEngine) (int, error)

AddDLPEngine adds a DLP engine and returns the id if created or error An additional provisioning ticket needs to be requested for this to work

func (*Client) AddDLPNotificationTemplate

func (c *Client) AddDLPNotificationTemplate(entry DLPNotificationTemplate) (int, error)

AddDLPNotificationTemplates adds a DLP notification template

func (*Client) AddDLPRule

func (c *Client) AddDLPRule(item DLPRule) (int, error)

AddDLPRule adds a URL filtering category

func (*Client) AddFwRule

func (c *Client) AddFwRule(rule FwRule) (int, error)

AddFwRule adds a firewall filtering rules

func (*Client) AddIPDstGroup

func (c *Client) AddIPDstGroup(obj IPDstGroup) (int, error)

AddIPDstGroups adds a firewall filtering rules

func (*Client) AddIPSrcGroup

func (c *Client) AddIPSrcGroup(obj IPSrcGroup) (int, error)

AddIPSrcGroup adds a firewall filtering rules

func (*Client) AddLabel

func (c *Client) AddLabel(obj Label) (int, error)

AddLabel adds a network service and returns the new service ID

func (*Client) AddLocation

func (c *Client) AddLocation(obj Location) (int, error)

AddLocation adds a new location or sublocation and returns the new object ID

func (*Client) AddService

func (c *Client) AddService(obj Service) (int, error)

AddService adds a network service and returns the new service ID

func (*Client) AddServiceGroup

func (c *Client) AddServiceGroup(obj ServiceGroup) (int, error)

AddServiceGroup adds a network service group

func (*Client) AddUrlCat

func (c *Client) AddUrlCat(category UrlCat) (string, error)

AddUrlCat adds a URL filtering category

func (*Client) AddUrlRule

func (c *Client) AddUrlRule(rule UrlRule) (int, error)

AddUrlRule adds a URL filtering rules

func (*Client) AddUser added in v0.1.23

func (c *Client) AddUser(user User) (int, error)

AddUser adds a new user and returns the new object ID

func (*Client) DeleteDLPDictionary added in v0.1.32

func (c *Client) DeleteDLPDictionary(id int) error

DeleteDLPDictionary deletes a DLP dictionary

func (*Client) DeleteDLPEngine added in v0.1.35

func (c *Client) DeleteDLPEngine(id int) error

DeleteDLPEngine deletes dlpEngines

func (*Client) DeleteDLPNotificationTemplate added in v0.1.35

func (c *Client) DeleteDLPNotificationTemplate(id int) error

DeleteDLPNotificationTemplate deletes dlpNotificationTemplates

func (*Client) DeleteDLPRule added in v0.1.32

func (c *Client) DeleteDLPRule(id int) error

DeleteDLPRule deleteds the dlp rules

func (*Client) DeleteFwRule added in v0.1.32

func (c *Client) DeleteFwRule(id int) error

DeleteFwRule deletes a firewall filtering rule

func (*Client) DeleteIPDstGroups added in v0.1.35

func (c *Client) DeleteIPDstGroups(id int) error

DeleteIPDstGroups deletes ipDestinationGroups

func (*Client) DeleteIPSrcGroups added in v0.1.35

func (c *Client) DeleteIPSrcGroups(id int) error

DeleteIPSrcGroups deletes ipSourceGroups

func (*Client) DeleteLabel added in v0.1.35

func (c *Client) DeleteLabel(id int) error

DeleteLabel deletes ruleLabels

func (*Client) DeleteService added in v0.1.35

func (c *Client) DeleteService(id int) error

DeleteService deletes networkServices

func (*Client) DeleteServiceGroup added in v0.1.35

func (c *Client) DeleteServiceGroup(id int) error

DeleteServiceGroup deletes networkServiceGroups

func (*Client) DeleteUrlCat added in v0.1.32

func (c *Client) DeleteUrlCat(id string) error

DeleteUrlCat deleteds the UrlCat

func (*Client) DeleteUrlRule added in v0.1.32

func (c *Client) DeleteUrlRule(id int) error

UpdateUrlRule updates the user info using the provided user object

func (*Client) GetAllowedUrls

func (c *Client) GetAllowedUrls() (AllowedUrls, error)

GetAllowedUrls gets a list of blocked URLs in Advanced Threat policy

func (*Client) GetAppGroups

func (c *Client) GetAppGroups() ([]AppGroup, error)

GetAppGroups gets a list of network application groups

func (*Client) GetAuditors

func (c *Client) GetAuditors() ([]User, error)

GetService gets a list of network service groups

func (*Client) GetBlockedUrls

func (c *Client) GetBlockedUrls() (BlockedUrls, error)

GetBlockedUrls gets a list of blocked URLs in Advanced Threat policy

func (*Client) GetDLPDictionaries

func (c *Client) GetDLPDictionaries() ([]DLPDictionary, error)

GetDLPDictionaries get all the DLP dictionaries

func (*Client) GetDLPEngines

func (c *Client) GetDLPEngines() ([]DLPEngine, error)

GetDLPEngines get all the DLP engines

func (*Client) GetDLPNotificationTemplates

func (c *Client) GetDLPNotificationTemplates() ([]DLPNotificationTemplate, error)

GetDLPNotificationTemplates get all the DLP notification templates

func (*Client) GetDLPRules

func (c *Client) GetDLPRules() ([]DLPRule, error)

GetDLPEngines get all the DLP engines

func (*Client) GetDeparments

func (c *Client) GetDeparments() ([]Department, error)

GetLocationGroups gets all departments

func (*Client) GetFwRules

func (c *Client) GetFwRules() ([]FwRule, error)

GetFwRules gets a list of firewall filtering rules

func (*Client) GetGroups

func (c *Client) GetGroups() ([]UserGroup, error)

GetGroups gets all user groups

func (*Client) GetICAPServers

func (c *Client) GetICAPServers() ([]ICAPServer, error)

GetDLPEngines get all the DLP engines

func (*Client) GetIPDstGroups

func (c *Client) GetIPDstGroups() ([]IPDstGroup, error)

GetIPDstGroups gets a list of firewall filtering rules

func (*Client) GetIPSrcGroups

func (c *Client) GetIPSrcGroups() ([]IPSrcGroup, error)

GetIPSrcGroups gets a list of firewall filtering rules

func (*Client) GetLabels

func (c *Client) GetLabels() ([]Label, error)

GetLabels gets all labels

func (*Client) GetLocationGroups

func (c *Client) GetLocationGroups() ([]LocationGroup, error)

GetLocationGroups gets all location groups

func (*Client) GetLocations

func (c *Client) GetLocations() ([]Location, error)

GetLocations gets all locations

func (*Client) GetServiceGroups

func (c *Client) GetServiceGroups() ([]ServiceGroup, error)

GetServiceGroups gets a list of network service groups

func (*Client) GetServices

func (c *Client) GetServices() ([]Service, error)

GetService gets a list of network service groups

func (*Client) GetSublocations

func (c *Client) GetSublocations(id int) ([]Location, error)

GetSublocations gets a list of sublocations from the received location id

func (*Client) GetTldCats added in v0.1.40

func (c *Client) GetTldCats() ([]UrlCat, error)

func (*Client) GetUrlCats

func (c *Client) GetUrlCats() ([]UrlCat, error)

GetUrlCats gets a list of all URL filtering category

func (*Client) GetUrlRules

func (c *Client) GetUrlRules() ([]UrlRule, error)

GetUrlRules gets a list of URL filtering rules

func (*Client) GetUser added in v0.1.25

func (c *Client) GetUser(id int) (User, error)

GetUser return the ZIA user

func (*Client) GetUsers

func (c *Client) GetUsers() ([]User, error)

GetUsers return all the ZIA users

func (*Client) GetUsersFilter added in v0.1.25

func (c *Client) GetUsersFilter(filter UserFilter) ([]User, error)

GetUsersFilter return all the ZIA users matching the filter

func (*Client) GetUsersPaged

func (c *Client) GetUsersPaged(page int, pageSize int) ([]User, error)

GetUsersPaged allows you to request between 100 and 1000 items

func (*Client) RepAllowedUrls

func (c *Client) RepAllowedUrls(urls AllowedUrls) error

RepAllowedUrls replaces current existing allowed list

func (*Client) RepBlockedUrls

func (c *Client) RepBlockedUrls(urls BlockedUrls) error

RepBlockedUrls replaces current existing blocked list

func (*Client) SetRetryMax

func (c *Client) SetRetryMax(r int)

SetRetryMax adds a URL filtering rules

func (*Client) UpdateDLPDictionary

func (c *Client) UpdateDLPDictionary(obj DLPDictionary) error

UpdateDLPDictionary updates a dlp dictionary

func (*Client) UpdateDLPEngine added in v0.1.33

func (c *Client) UpdateDLPEngine(obj DLPEngine) error

UpdateDLPEngine updates a dlp engine An additional provisioning ticket needs to be requested for this to work

func (*Client) UpdateDLPRule added in v0.1.32

func (c *Client) UpdateDLPRule(obj DLPRule) error

UpdateDLPRule updates a dlp rule

func (*Client) UpdateFwRule added in v0.1.32

func (c *Client) UpdateFwRule(obj FwRule) error

UpdateFwRule updates a firewall filtering rule

func (*Client) UpdateLocation

func (c *Client) UpdateLocation(obj Location) error

Edit updates a new location or sublocation and returns the new object ID

func (*Client) UpdateUrlCat

func (c *Client) UpdateUrlCat(category UrlCat) error

UpdateUrlCat updates a URL filtering category

func (*Client) UpdateUrlRule added in v0.1.23

func (c *Client) UpdateUrlRule(rule UrlRule) error

UpdateUrlRule updates the user info using the provided user object

func (*Client) UpdateUser

func (c *Client) UpdateUser(user User) error

UpdateUser updates the user info using the provided user object

func (*Client) UrlLookup

func (c *Client) UrlLookup(urls []string) ([]UrlLookup, error)

UrlLookup return the url categories for requested URLs. up to 100 urls per request and 400 requests per hour according to zscaler limits

type DLPDictionary

type DLPDictionary struct {
	ID                      int          `json:"id,omitempty"`
	Name                    string       `json:"name,omitempty"`
	Description             string       `json:"description,omitempty"`
	ConfidenceThreshold     string       `json:"confidenceThreshold,omitempty"`
	Phrases                 []Phrase     `json:"phrases,omitempty"`
	CustomPhraseMatchType   string       `json:"customPhraseMatchType,omitempty"`
	Patterns                []Pattern    `json:"patterns,omitempty"`
	DictionaryType          string       `json:"dictionaryType,omitempty"`
	ExactDataMatchDetails   []EDMDetails `json:"exactDataMatchDetails,omitempty"`
	IdmProfileMatchAccuracy []IDMProfile `json:"idmProfileMatchAccuracy,omitempty"`
	Proximity               int          `json:"proximity,omitempty"`
	Custom                  bool         `json:"custom,omitempty"`
	ProximityLengthEnabled  bool         `json:"proximityLengthEnabled,omitempty"`
}

DLPDictionary holds the DLP dictionaries from ZIA

func (DLPDictionary) Delete added in v0.1.35

func (u DLPDictionary) Delete(c *Client) error

Delete deletes an object

func (DLPDictionary) GetID

func (u DLPDictionary) GetID() (string, int)

GetID return the name a string and the ID as int

func (DLPDictionary) String added in v0.1.36

func (p DLPDictionary) String() string

String prints the struct in json pretty format

type DLPEngine

type DLPEngine struct {
	ID                   int    `json:"id,omitempty"`
	Name                 string `json:"name,omitempty"`
	PredefinedEngineName string `json:"predefinedEngineName,omitempty"`
	EngineExpression     string `json:"engineExpression,omitempty"`
	CustomDlpEngine      bool   `json:"customDlpEngine,omitempty"`
	Description          string `json:"description,omitempty"`
}

DLPEngine hols dlp engine details

func (DLPEngine) Delete added in v0.1.35

func (u DLPEngine) Delete(c *Client) error

Delete deletes an object

func (DLPEngine) GetDictionaries added in v0.1.33

func (u DLPEngine) GetDictionaries() []int

GetDictionaries returns dictionary IDs used on an engine

func (DLPEngine) GetID

func (u DLPEngine) GetID() (string, int)

GetID return the name a string and the ID as int

func (DLPEngine) String added in v0.1.36

func (p DLPEngine) String() string

String prints the struct in json pretty format

type DLPNotificationTemplate

type DLPNotificationTemplate struct {
	ID               int    `json:"id,omitempty"`
	Name             string `json:"name,omitempty"`
	Subject          string `json:"subject,omitempty"`
	AttachContent    bool   `json:"attachContent,omitempty"`
	PlainTextMessage string `json:"plainTextMessage,omitempty"`
	HTMLMessage      string `json:"htmlMessage,omitempty"`
}

DLPNotificationTemplate hols dlp notification template details

func (DLPNotificationTemplate) GetID

func (u DLPNotificationTemplate) GetID() (string, int)

GetID return the name a string and the ID as int

func (DLPNotificationTemplate) String added in v0.1.36

func (p DLPNotificationTemplate) String() string

String prints the struct in json pretty format

type DLPRule

type DLPRule struct {
	ID                       int       `json:"id,omitempty"`
	Order                    int       `json:"order,omitempty"`
	Protocols                []string  `json:"protocols,omitempty"`
	Rank                     int       `json:"rank,omitempty"`
	Description              string    `json:"description,omitempty"`
	Locations                []NameID  `json:"locations,omitempty"`
	LocationGroups           []NameID  `json:"locationGroups,omitempty"`
	Groups                   []NameID  `json:"groups,omitempty"`
	Departments              []NameID  `json:"departments,omitempty"`
	Users                    []NameID  `json:"users,omitempty"`
	URLCategories            []NameID  `json:"urlCategories,omitempty"`
	DlpEngines               []NameID  `json:"dlpEngines,omitempty"`
	FileTypes                []string  `json:"fileTypes,omitempty"`
	CloudApplications        []string  `json:"cloudApplications,omitempty"`
	MinSize                  int       `json:"minSize,omitempty"`
	Action                   string    `json:"action,omitempty"`
	State                    string    `json:"state,omitempty"`
	TimeWindows              []NameID  `json:"timeWindows,omitempty"`
	Auditor                  *NameID   `json:"auditor,omitempty"`
	ExternalAuditorEmail     string    `json:"externalAuditorEmail,omitempty"`
	NotificationTemplate     *NameID   `json:"notificationTemplate,omitempty"`
	MatchOnly                bool      `json:"matchOnly,omitempty"`
	LastModifiedTime         int       `json:"lastModifiedTime,omitempty"`
	LastModifiedBy           *NameID   `json:"lastModifiedBy,omitempty"`
	IcapServer               *NameID   `json:"icapServer,omitempty"`
	WithoutContentInspection bool      `json:"withoutContentInspection"`
	Name                     string    `json:"name,omitempty"`
	Labels                   []NameID  `json:"labels,omitempty"`
	OcrEnabled               bool      `json:"ocrEnabled,omitempty"`
	ExcludedGroups           []NameID  `json:"excludedGroups,omitempty"`
	ExcludedDepartments      []NameID  `json:"excludedDepartments,omitempty"`
	ExcludedUsers            []NameID  `json:"excludedUsers,omitempty"`
	ZscalerIncidentReciever  bool      `json:"zscalerIncidentReciever,omitempty"`
	Severity                 string    `json:"severity,omitempty"`
	SubRules                 []DLPRule `json:"subRules,omitempty"`
	ParentRule               int       `json:"parentRule,omitempty"`
}

DLPRule holds a DLP rule information

func (DLPRule) Delete added in v0.1.35

func (u DLPRule) Delete(c *Client) error

Delete deletes an object

func (DLPRule) String added in v0.1.36

func (p DLPRule) String() string

String prints the struct in json pretty format

type Department

type Department struct {
	ID       int    `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	IdpID    int    `json:"idpId,omitempty"`
	Comments string `json:"comments,omitempty"`
	Deleted  bool   `json:"deleted,omitempty"`
}

Department parses user departments

func (Department) GetID

func (u Department) GetID() (string, int)

GetID return the name a string and the ID as int

func (Department) String added in v0.1.36

func (p Department) String() string

String prints the struct in json pretty format

type EDMDetails

type EDMDetails struct {
	DictionaryEdmMappingID int    `json:"dictionaryEdmMappingId,omitempty"`
	SchemaID               int    `json:"schemaId,omitempty"`
	PrimaryField           int    `json:"primaryField,omitempty"`
	SecondaryFields        []int  `json:"secondaryFields,omitempty"`
	SecondaryFieldMatchOn  string `json:"secondaryFieldMatchOn,omitempty"`
}

EDMDetails holds EDM details from DLP dictionary

type FwRule

type FwRule struct {
	ID                  int      `json:"id"`
	Name                string   `json:"name"`
	Order               int      `json:"order,omitempty"`
	Rank                int      `json:"rank,omitempty"`
	Locations           []NameID `json:"locations,omitempty"`
	LocationGroups      []NameID `json:"locationGroups,omitempty"`
	Departments         []NameID `json:"departments,omitempty"`
	Groups              []NameID `json:"groups,omitempty"`
	Users               []NameID `json:"users,omitempty"`
	TimeWindows         []NameID `json:"timeWindows,omitempty"`
	Action              string   `json:"action,omitempty"`
	State               string   `json:"state,omitempty"`
	Description         string   `json:"description,omitempty"`
	LastModifiedTime    int      `json:"lastModifiedTime,omitempty"`
	LastModifiedBy      NameID   `json:"lastModifiedBy,omitempty"`
	SrcIps              []string `json:"srcIps,omitempty"`
	SrcIPGroups         []NameID `json:"srcIpGroups,omitempty"`
	DestAddresses       []string `json:"destAddresses,omitempty"`
	DestIPCategories    []string `json:"destIpCategories,omitempty"`
	DestCountries       []string `json:"destCountries,omitempty"`
	DestIPGroups        []NameID `json:"destIpGroups,omitempty"`
	NwServices          []NameID `json:"nwServices,omitempty"`
	NwServiceGroups     []NameID `json:"nwServiceGroups,omitempty"`
	NwApplications      []string `json:"nwApplications,omitempty"`
	NwApplicationGroups []NameID `json:"nwApplicationGroups,omitempty"`
	AppServices         []NameID `json:"appServices,omitempty"`
	AppServiceGroups    []NameID `json:"appServiceGroups,omitempty"`
	Labels              []NameID `json:"labels,omitempty"`
	DefaultRule         bool     `json:"defaultRule,omitempty"`
	Predefined          bool     `json:"predefined,omitempty"`
}

FwRule parses firewall rules

func (FwRule) Delete added in v0.1.35

func (u FwRule) Delete(c *Client) error

Delete deletes an object

func (FwRule) String added in v0.1.36

func (p FwRule) String() string

String prints the struct in json pretty format

type ICAPServer

type ICAPServer struct {
	ID     int    `json:"id,omitempty"`
	Name   string `json:"name,omitempty"`
	URL    string `json:"url,omitempty"`
	Status string `json:"status,omitempty"`
}

ICAPServer holds an icap server detail

func (ICAPServer) GetID

func (u ICAPServer) GetID() (string, int)

GetID return the name a string and the ID as int

func (ICAPServer) String added in v0.1.36

func (p ICAPServer) String() string

String prints the struct in json pretty format

type IDMProfile

type IDMProfile struct {
	AdpIdmProfile struct {
		ID         int `json:"id,omitempty"`
		Extensions struct {
			AdditionalProp1 string `json:"additionalProp1,omitempty"`
			AdditionalProp2 string `json:"additionalProp2,omitempty"`
			AdditionalProp3 string `json:"additionalProp3,omitempty"`
		} `json:"extensions,omitempty"`
	} `json:"adpIdmProfile,omitempty"`
	MatchAccuracy string `json:"matchAccuracy,omitempty"`
}

IDMProfile holds IDM details from DLP dictionary

type IPDstGroup

type IPDstGroup struct {
	ID           int      `json:"id"`
	Name         string   `json:"name"`
	Type         string   `json:"type"` //Available values : DSTN_IP, DSTN_FQDN, DSTN_DOMAIN, DSTN_OTHER
	Addresses    []string `json:"addresses,omitempty"`
	Description  string   `json:"description,omitempty"`
	IPCategories []string `json:"ipCategories,omitempty"`
	Countries    []string `json:"countries,omitempty"`
}

IPDstGroup parses responses for IP destination groups

func (IPDstGroup) Delete added in v0.1.35

func (u IPDstGroup) Delete(c *Client) error

Delete deletes an object

func (IPDstGroup) String added in v0.1.36

func (p IPDstGroup) String() string

String prints the struct in json pretty format

type IPSrcGroup

type IPSrcGroup struct {
	ID          int      `json:"id"`
	Name        string   `json:"name"`
	IPAddresses []string `json:"ipAddresses"`
	Description string   `json:"description,omitempty"`
}

IPSrcGroup parses responses for IP source groups

func (IPSrcGroup) Delete added in v0.1.35

func (u IPSrcGroup) Delete(c *Client) error

Delete deletes an object

func (IPSrcGroup) String added in v0.1.36

func (p IPSrcGroup) String() string

String prints the struct in json pretty format

type Label

type Label struct {
	ID                  int     `json:"id,omitempty"`
	Name                string  `json:"name,omitempty"`
	Description         string  `json:"description,omitempty"`
	LastModifiedTime    int     `json:"lastModifiedTime,omitempty"`
	LastModifiedBy      *NameID `json:"lastModifiedBy,omitempty"`
	CreatedBy           *NameID `json:"createdBy,omitempty"`
	ReferencedRuleCount int     `json:"referencedRuleCount,omitempty"`
}

func (Label) Delete added in v0.1.35

func (u Label) Delete(c *Client) error

Delete deletes an object

func (Label) GetID

func (u Label) GetID() (string, int)

GetID returns the name as string and the ID as int

func (Label) String added in v0.1.36

func (p Label) String() string

String prints the struct in json pretty format

type Location

type Location struct {
	ID                                  int           `json:"id,omitempty"`
	Name                                string        `json:"name"`
	ParentID                            int           `json:"parentId,omitempty"`
	UpBandwidth                         int           `json:"upBandwidth,omitempty"`
	DnBandwidth                         int           `json:"dnBandwidth,omitempty"`
	Country                             string        `json:"country,omitempty"`
	Tz                                  string        `json:"tz,omitempty"`
	IPAddresses                         []string      `json:"ipAddresses,omitempty"`
	Ports                               []int         `json:"ports,omitempty"`
	VpnCredentials                      []VpnLocation `json:"vpnCredentials,omitempty"`
	AuthRequired                        bool          `json:"authRequired,omitempty"`
	SslScanEnabled                      bool          `json:"sslScanEnabled,omitempty"`
	ZappSSLScanEnabled                  bool          `json:"zappSSLScanEnabled,omitempty"`
	XffForwardEnabled                   bool          `json:"xffForwardEnabled,omitempty"`
	SurrogateIP                         bool          `json:"surrogateIP,omitempty"`
	IdleTimeInMinutes                   int           `json:"idleTimeInMinutes,omitempty"`
	DisplayTimeUnit                     string        `json:"displayTimeUnit,omitempty"`
	SurrogateIPEnforcedForKnownBrowsers bool          `json:"surrogateIPEnforcedForKnownBrowsers,omitempty"`
	SurrogateRefreshTimeInMinutes       int           `json:"surrogateRefreshTimeInMinutes,omitempty"`
	SurrogateRefreshTimeUnit            string        `json:"surrogateRefreshTimeUnit,omitempty"`
	OfwEnabled                          bool          `json:"ofwEnabled,omitempty"`
	IpsControl                          bool          `json:"ipsControl,omitempty"`
	AupEnabled                          bool          `json:"aupEnabled,omitempty"`
	CautionEnabled                      bool          `json:"cautionEnabled,omitempty"`
	AupBlockInternetUntilAccepted       bool          `json:"aupBlockInternetUntilAccepted,omitempty"`
	AupForceSslInspection               bool          `json:"aupForceSslInspection,omitempty"`
	AupTimeoutInDays                    int           `json:"aupTimeoutInDays,omitempty"`
	Profile                             string        `json:"profile,omitempty"`
	Description                         string        `json:"description,omitempty"`
}

Location parses locations

func (Location) GetID

func (u Location) GetID() (string, int)

GetID return the name a string and the ID as int

func (Location) String added in v0.1.36

func (p Location) String() string

String prints the struct in json pretty format

type LocationGroup

type LocationGroup struct {
	ID                           int    `json:"id"`
	Name                         string `json:"name"`
	Deleted                      bool   `json:"deleted,omitempty"`
	GroupType                    string `json:"groupType"`
	DynamicLocationGroupCriteria struct {
		Name struct {
			MatchString string `json:"matchString"`
			MatchType   string `json:"matchType"`
		} `json:"name"`
		Countries []string `json:"countries"`
		City      struct {
			MatchString string `json:"matchString"`
			MatchType   string `json:"matchType"`
		} `json:"city"`
		ManagedBy              []NameID `json:"managedBy"`
		EnforceAuthentication  bool     `json:"enforceAuthentication"`
		EnforceAup             bool     `json:"enforceAup"`
		EnforceFirewallControl bool     `json:"enforceFirewallControl"`
		EnableXffForwarding    bool     `json:"enableXffForwarding"`
		EnableCaution          bool     `json:"enableCaution"`
		EnableBandwidthControl bool     `json:"enableBandwidthControl"`
		Profiles               []string `json:"profiles"`
	} `json:"dynamicLocationGroupCriteria"`
	Locations   []NameID `json:"locations"`
	Comments    string   `json:"comments"`
	LastModUser NameID   `json:"lastModUser"`
	LastModTime int      `json:"lastModTime"`
	Predefined  bool     `json:"predefined"`
}

LocationGroup parses location groups

func (LocationGroup) GetID

func (u LocationGroup) GetID() (string, int)

GetID return the name a string and the ID as int

func (LocationGroup) String added in v0.1.36

func (p LocationGroup) String() string

String prints the struct in json pretty format

type NameID

type NameID struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	Uuid string `json:"uuid,omitempty"`
}

NameID is a helper for json entries with name and ID

type Pattern

type Pattern struct {
	Action  string `json:"action,omitempty"`
	Pattern string `json:"pattern,omitempty"`
}

Pattern holds DLP dictionary Patterns

type Phrase

type Phrase struct {
	Action string `json:"action,omitempty"`
	Phrase string `json:"phrase,omitempty"`
}

Phrases holds DLP dictionary phrases

type Service

type Service struct {
	ID            int        `json:"id"`
	Name          string     `json:"name"`
	Tag           string     `json:"tag,omitempty"`
	SrcTCPPorts   []StartEnd `json:"srcTcpPorts,omitempty"`
	DestTCPPorts  []StartEnd `json:"destTcpPorts,omitempty"`
	SrcUDPPorts   []StartEnd `json:"srcUdpPorts,omitempty"`
	DestUDPPorts  []StartEnd `json:"destUdpPorts,omitempty"`
	Type          string     `json:"type,omitempty"` //Types are CUSTOM, STANDARD AND PREDEFINED. The last 2 are default ones, STANDARD seems to be used for non port based services
	Description   string     `json:"description,omitempty"`
	IsNameL10NTag bool       `json:"isNameL10nTag,omitempty"`
}

Service parses responses for network services

func (Service) Delete added in v0.1.35

func (u Service) Delete(c *Client) error

Delete deletes an object

func (Service) GetID

func (u Service) GetID() (string, int)

GetID return the name a string and the ID as int

func (Service) String added in v0.1.36

func (p Service) String() string

String prints the struct in json pretty format

type ServiceGroup

type ServiceGroup struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Services    []Service `json:"services"`
	Description string    `json:"description,omitempty"`
}

ServiceGroup parses responses for network servicesgroups

func (ServiceGroup) Delete added in v0.1.35

func (u ServiceGroup) Delete(c *Client) error

Delete deletes an object

func (ServiceGroup) GetID

func (u ServiceGroup) GetID() (string, int)

GetID return the name a string and the ID as int

func (ServiceGroup) String added in v0.1.36

func (p ServiceGroup) String() string

String prints the struct in json pretty format

type StartEnd

type StartEnd struct {
	Start *int `json:"start"`
	End   *int `json:"end"`
}

StartEnd json helper for ranges

type UrlCat

type UrlCat struct {
	ID                              string   `json:"id,omitempty"` // This goes from CUSTOM_00 to CUSTOM_256
	ConfiguredName                  string   `json:"configuredName"`
	Keywords                        []string `json:"keywords,omitempty"`
	KeywordsRetainingParentCategory []string `json:"keywordsRetainingParentCategory,omitempty"`
	Urls                            []string `json:"urls,omitempty"`
	DbCategorizedUrls               []string `json:"dbCategorizedUrls,omitempty"`
	IPRanges                        []string `json:"ipRanges,omitempty"`
	IPRangesRetainingParentCategory []string `json:"ipRangesRetainingParentCategory,omitempty"`
	CustomCategory                  bool     `json:"customCategory,omitempty"` //set to true if custom
	SuperCategory                   string   `json:"superCategory"`            //Use USER_DEFINED for custom category creation
	Scopes                          []struct {
		ScopeGroupMemberEntities []struct {
			ID         int    `json:"id"`
			Name       string `json:"name"`
			Extensions struct {
				AdditionalProp1 string `json:"additionalProp1"`
				AdditionalProp2 string `json:"additionalProp2"`
				AdditionalProp3 string `json:"additionalProp3"`
			} `json:"extensions"`
		} `json:"scopeGroupMemberEntities"`
		Type          string `json:"Type"`
		ScopeEntities []struct {
			ID         int    `json:"id"`
			Name       string `json:"name"`
			Extensions struct {
				AdditionalProp1 string `json:"additionalProp1"`
				AdditionalProp2 string `json:"additionalProp2"`
				AdditionalProp3 string `json:"additionalProp3"`
			} `json:"extensions"`
		} `json:"ScopeEntities"`
	} `json:"scopes,omitempty"`
	Editable         bool   `json:"editable,omitempty"`
	Description      string `json:"description,omitempty"`
	Type             string `json:"type,omitempty"`
	URLKeywordCounts *struct {
		TotalURLCount            int `json:"totalUrlCount"`
		RetainParentURLCount     int `json:"retainParentUrlCount"`
		TotalKeywordCount        int `json:"totalKeywordCount"`
		RetainParentKeywordCount int `json:"retainParentKeywordCount"`
	} `json:"urlKeywordCounts,omitempty"`
	Val                                  int `json:"val,omitempty"`
	CustomUrlsCount                      int `json:"customUrlsCount,omitempty"`
	UrlsRetainingParentCategoryCount     int `json:"urlsRetainingParentCategoryCount,omitempty"`
	CustomIPRangesCount                  int `json:"customIpRangesCount,omitempty"`
	IPRangesRetainingParentCategoryCount int `json:"ipRangesRetainingParentCategoryCount,omitempty"`
}

UrlCat parses responses for urls categories

func (UrlCat) Delete added in v0.1.35

func (u UrlCat) Delete(c *Client) error

Delete deletes an object

func (UrlCat) GetID

func (u UrlCat) GetID() (string, int)

GetID returns name, id

func (*UrlCat) GetName

func (c *UrlCat) GetName() string

func (c UrlCat) GetName() returns all the urls in a UrlCat

func (*UrlCat) GetUrls

func (c *UrlCat) GetUrls(f string) []string

SetUrls sets all the urls in a allowlist

func (UrlCat) PushItems

func (c UrlCat) PushItems(client *Client) error

PushItems pushes all the urls in a allowlist

func (*UrlCat) SetUrls

func (c *UrlCat) SetUrls(f string, u []string)

SetUrls sets all the urls in a allowlist

func (UrlCat) String added in v0.1.36

func (p UrlCat) String() string

String prints the struct in json pretty format

type UrlLookup

type UrlLookup struct {
	URL         string   `json:"url"`
	URLCat      []string `json:"urlClassifications"`
	URLCatSec   []string `json:"urlClassificationsWithSecurityAlert"`
	Error       string   `json:"error,omitempty"`
	Application string   `json:"application"`
}

UrlLookup parses responses for received url categories

func (UrlLookup) String added in v0.1.36

func (p UrlLookup) String() string

String prints the struct in json pretty format

type UrlRule

type UrlRule struct {
	ID                     int      `json:"id"`
	Name                   string   `json:"name"`
	Order                  int      `json:"order,omitempty"`
	Protocols              []string `json:"protocols,omitempty"`
	Locations              []NameID `json:"locations,omitempty"`
	Groups                 []NameID `json:"groups,omitempty"`
	Departments            []NameID `json:"departments,omitempty"`
	Users                  []NameID `json:"users,omitempty"`
	URLCategories          []string `json:"urlCategories,omitempty"`
	State                  string   `json:"state,omitempty"` //"ENABLED" or "DISABLED"
	TimeWindows            []NameID `json:"timeWindows,omitempty"`
	SourceIpGroups         []NameID `json:"sourceIpGroups,omitempty"`
	Rank                   int      `json:"rank"`
	RequestMethods         []string `json:"requestMethods,omitempty"`
	EndUserNotificationURL string   `json:"endUserNotificationUrl,omitempty"`
	OverrideUsers          []NameID `json:"overrideUsers,omitempty"`
	OverrideGroups         []NameID `json:"overrideGroups,omitempty"`
	BlockOverride          bool     `json:"blockOverride,omitempty"`
	TimeQuota              int      `json:"timeQuota,omitempty"`
	SizeQuota              int      `json:"sizeQuota,omitempty"`
	Description            string   `json:"description,omitempty"`
	LocationGroups         []NameID `json:"locationGroups,omitempty"`
	Labels                 []NameID `json:"labels,omitempty"`
	ValidityStartTime      int      `json:"validityStartTime,omitempty"`
	ValidityEndTime        int      `json:"validityEndTime,omitempty"`
	ValidityTimeZoneID     string   `json:"validityTimeZoneId,omitempty"`
	LastModifiedTime       int      `json:"lastModifiedTime,omitempty"`
	LastModifiedBy         *NameID  `json:"lastModifiedBy,omitempty"`
	EnforceTimeValidity    bool     `json:"enforceTimeValidity,omitempty"`
	Action                 string   `json:"action,omitempty"`
	Ciparule               bool     `json:"ciparule,omitempty"`
}

UrlRule parses responses for urls policies

func (UrlRule) Delete added in v0.1.35

func (u UrlRule) Delete(c *Client) error

Delete deletes an object

func (UrlRule) String added in v0.1.36

func (p UrlRule) String() string

String prints the struct in json pretty format

type User

type User struct {
	ID            int         `json:"id,omitempty"`
	Name          string      `json:"name"`
	Email         string      `json:"email"`
	Groups        []UserGroup `json:"groups,omitempty"`
	Department    Department  `json:"department,omitempty"`
	Comments      string      `json:"comments,omitempty"`
	TempAuthEmail string      `json:"tempAuthEmail,omitempty"`
	Password      string      `json:"password,omitempty"`
	AdminUser     bool        `json:"adminUser,omitempty"`
	Type          string      `json:"type,omitempty"`
}

Users parses Users

func (User) GetID

func (u User) GetID() (string, int)

GetID return the name a string and the ID as int

func (User) String added in v0.1.36

func (p User) String() string

String prints the struct in json pretty format

type UserFilter added in v0.1.25

type UserFilter struct {
	Name  string
	Dept  string
	Group string
}

UserFilter filter user searches The name search parameter performs a partial match. The dept and group parameters perform a 'starts with' match.

type UserGroup

type UserGroup struct {
	ID       int    `json:"id,omitempty"`
	Name     string `json:"name"`
	IdpID    int    `json:"idpId,omitempty"`
	Comments string `json:"comments,omitempty"`
}

UserGroup parses UserGroup

func (UserGroup) GetID

func (u UserGroup) GetID() (string, int)

GetID return the name a string and the ID as int

func (UserGroup) String added in v0.1.36

func (p UserGroup) String() string

String prints the struct in json pretty format

type VpnLocation

type VpnLocation struct {
	Type         string `json:"type"`
	Fqdn         string `json:"fqdn"`
	PreSharedKey string `json:"preSharedKey"`
	Comments     string `json:"comments"`
}

func (VpnLocation) String added in v0.1.36

func (p VpnLocation) String() string

String prints the struct in json pretty format

type ZDelete added in v0.1.35

type ZDelete interface {
	Delete(*Client) error
}

ZDelete interfaces for objects with delete function

type ZIAError

type ZIAError struct {
	//this is the Error
	Err string
	//Code this is the http status code
	Code int
}

ZIAError is the error

func (*ZIAError) Error

func (e *ZIAError) Error() string

type Zid

type Zid interface {
	GetID() (string, int)
}

Zid is the interface for tyopes that can return ID, so most of them

type Zurl

type Zurl interface {
	GetUrls(string) []string
	SetUrls(string, []string)
	PushItems(client *Client) error
	GetName() string
}

Zurl is an interface that allows you to interact with 3 different types of url objects: allowlist, blocklist and url objects.

Jump to

Keyboard shortcuts

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