api

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RulestackNotExists      = "Rulestack does not exist"
	PANORAMA_RULESTACK_NAME = "panorama-rulestack" // FIXME: use dg as rulestack name after integration with proxy
	LocalScope              = "Local"
	GlobalScope             = "Global"
	RsCommitStatusPending   = "Pending"
	RsCommitStatusSuccess   = "Success"
	RsCommitStatusFailed    = "Failed"
	FwStatusCommitting      = "Committing"
	FwStatusFailure         = "Failed"
	FwStatusSuccess         = "Success"
	FwStatusValidating      = "Validating"
	RuleStackTypeSCM        = "scm"
	RuleStackTypePanorama   = "panorama"
)

Variables

Functions

func IsErrorMessage added in v0.1.4

func IsErrorMessage(path []string, body []byte, statusCode int) error

func SetLogger added in v1.0.0

func SetLogger(logger *zap.SugaredLogger)

Types

type ApiClient added in v1.0.0

type ApiClient struct {
	XSLPath string
	// contains filtered or unexported fields
}

func NewAPIClient added in v1.0.0

func NewAPIClient(client Client, ctx context.Context, maxGortns int, XSLPath string, mock bool) *ApiClient

sdk consumers instantiate APIClient using NewAPIClient() and invoke APIs under api directory

func (*ApiClient) AddTagsForFirewall added in v1.0.0

func (c *ApiClient) AddTagsForFirewall(ctx context.Context, input firewall.AddTagsInput) error

func (*ApiClient) AddTagsRuleStack added in v1.0.0

func (c *ApiClient) AddTagsRuleStack(ctx context.Context, input stack.AddTagsInput) error

func (*ApiClient) ApplyTagsRuleStack added in v1.0.0

func (c *ApiClient) ApplyTagsRuleStack(ctx context.Context, input stack.AddTagsInput) error

func (*ApiClient) AssociateGlobalRuleStack added in v1.0.0

func (c *ApiClient) AssociateGlobalRuleStack(ctx context.Context, input firewall.AssociateInput) (firewall.AssociateOutput, error)

func (*ApiClient) CommitRuleStack added in v1.0.0

func (c *ApiClient) CommitRuleStack(ctx context.Context, input stack.SimpleInput) error

func (*ApiClient) CommitStatusRuleStack added in v1.0.0

func (c *ApiClient) CommitStatusRuleStack(ctx context.Context, input stack.SimpleInput) (stack.CommitStatus, error)

func (*ApiClient) CreateAccount added in v1.0.5

func (c *ApiClient) CreateAccount(ctx context.Context, input account.CreateInput) (account.CreateOutput, error)

func (*ApiClient) CreateCertificate added in v1.0.0

func (c *ApiClient) CreateCertificate(ctx context.Context, input certificate.Info) error

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) CreateFeed added in v1.0.0

func (c *ApiClient) CreateFeed(ctx context.Context, f feed.Info) error

func (*ApiClient) CreateFirewall added in v1.0.0

func (c *ApiClient) CreateFirewall(ctx context.Context, input firewall.Info) (firewall.CreateOutput, error)

func (*ApiClient) CreateFqdn added in v1.0.0

func (c *ApiClient) CreateFqdn(ctx context.Context, f fqdn.Info) error

func (*ApiClient) CreatePrefixList added in v1.0.0

func (c *ApiClient) CreatePrefixList(ctx context.Context, f prefix.Info) error

func (*ApiClient) CreateRuleStack added in v1.0.0

func (c *ApiClient) CreateRuleStack(ctx context.Context, input stack.Info) error

func (*ApiClient) CreateSecurityRule added in v1.0.0

func (c *ApiClient) CreateSecurityRule(ctx context.Context, f security.Info) error

func (*ApiClient) CreateUrlCustomCategory added in v1.0.0

func (c *ApiClient) CreateUrlCustomCategory(ctx context.Context, f url.Info) error

func (*ApiClient) DeleteAccount added in v1.0.5

func (c *ApiClient) DeleteAccount(ctx context.Context, input account.DeleteInput) error

func (*ApiClient) DeleteCertificate added in v1.0.0

func (c *ApiClient) DeleteCertificate(ctx context.Context, cert certificate.DeleteInput) error

func (*ApiClient) DeleteFeed added in v1.0.0

func (c *ApiClient) DeleteFeed(ctx context.Context, f feed.DeleteInput) error

func (*ApiClient) DeleteFirewall added in v1.0.0

func (c *ApiClient) DeleteFirewall(ctx context.Context, input firewall.DeleteInput) error

func (*ApiClient) DeleteFqdn added in v1.0.0

func (c *ApiClient) DeleteFqdn(ctx context.Context, f fqdn.DeleteInput) error

func (*ApiClient) DeletePrefixList added in v1.0.0

func (c *ApiClient) DeletePrefixList(ctx context.Context, f prefix.DeleteInput) error

func (*ApiClient) DeleteRuleStack added in v1.0.0

func (c *ApiClient) DeleteRuleStack(ctx context.Context, input stack.SimpleInput) error

func (*ApiClient) DeleteSecurityRule added in v1.0.0

func (c *ApiClient) DeleteSecurityRule(ctx context.Context, f security.DeleteInput) error

func (*ApiClient) DeleteUrlCustomCategory added in v1.0.0

func (c *ApiClient) DeleteUrlCustomCategory(ctx context.Context, f url.DeleteInput) error

func (*ApiClient) DescribeUrlCategoryActionOverride added in v1.0.0

func (c *ApiClient) DescribeUrlCategoryActionOverride(ctx context.Context, input predefinedurl.GetOverrideInput) (predefinedurl.GetOverrideOutput, error)

func (*ApiClient) DisAssociateGlobalRuleStack added in v1.0.0

func (c *ApiClient) DisAssociateGlobalRuleStack(ctx context.Context, input firewall.DisAssociateInput) (firewall.DisAssociateOutput, error)

func (*ApiClient) ExportRuleStackXML added in v1.0.0

func (c *ApiClient) ExportRuleStackXML(ctx context.Context, input stack.ReadInput) (stack.ExportRulestackXmlOutput, error)

func (*ApiClient) GetMPRegion added in v1.0.5

func (c *ApiClient) GetMPRegion(ctx context2.Context) string

func (*ApiClient) GetProfile added in v1.0.7

func (c *ApiClient) GetProfile(ctx context2.Context) string

func (*ApiClient) GetResourceTimeout added in v1.0.1

func (c *ApiClient) GetResourceTimeout(ctx context2.Context) int

func (*ApiClient) IsSyncModeEnabled added in v1.0.0

func (c *ApiClient) IsSyncModeEnabled(ctx context2.Context) bool

func (*ApiClient) ListAccounts added in v1.0.5

func (c *ApiClient) ListAccounts(ctx context.Context, a account.ListInput) (account.ListOutput, error)

func (*ApiClient) ListAppID added in v1.0.0

func (c *ApiClient) ListAppID(ctx context.Context, a appid.ListInput) (appid.ListOutput, error)

func (*ApiClient) ListCertificate added in v1.0.0

func (c *ApiClient) ListCertificate(ctx context.Context, a certificate.ListInput) (certificate.ListOutput, error)

func (*ApiClient) ListCountry added in v1.0.0

func (c *ApiClient) ListCountry(ctx context.Context, a country.ListInput) (country.ListOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ListFeed added in v1.0.0

func (c *ApiClient) ListFeed(ctx context.Context, f feed.ListInput) (feed.ListOutput, error)

func (*ApiClient) ListFirewall added in v1.0.0

func (c *ApiClient) ListFirewall(ctx context.Context, a firewall.ListInput) (firewall.ListOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ListFqdn added in v1.0.0

func (c *ApiClient) ListFqdn(ctx context.Context, a fqdn.ListInput) (fqdn.ListOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ListPrefixList added in v1.0.0

func (c *ApiClient) ListPrefixList(ctx context.Context, a prefix.ListInput) (prefix.ListOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ListSecurityRule added in v1.0.0

func (c *ApiClient) ListSecurityRule(ctx context.Context, f security.ListInput) (security.ListOutput, error)

func (*ApiClient) ListTagsForFirewall added in v1.0.0

func (c *ApiClient) ListTagsForFirewall(ctx context.Context, input firewall.ListTagsInput) (firewall.ListTagsOutput, error)

func (*ApiClient) ListTagsRuleStack added in v1.0.0

func (c *ApiClient) ListTagsRuleStack(ctx context.Context, input stack.ListTagsInput) (stack.ListTagsOutput, error)

func (*ApiClient) ListUrlCategoriesActionOverride added in v1.0.0

func (c *ApiClient) ListUrlCategoriesActionOverride(ctx context.Context, input predefinedurl.ListOverridesInput) (predefinedurl.ListOverridesOutput, error)

func (*ApiClient) ListUrlCustomCategory added in v1.0.0

func (c *ApiClient) ListUrlCustomCategory(ctx context.Context, a url.ListInput) (url.ListOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ListUrlPredefinedCategories added in v1.0.0

func (c *ApiClient) ListUrlPredefinedCategories(ctx context.Context, input predefinedurl.ListInput) (predefinedurl.ListOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ModifyFirewall added in v1.0.0

func (c *ApiClient) ModifyFirewall(ctx context.Context, input firewall.Info) (bool, error)

func (*ApiClient) PollCommitRulestack added in v1.0.0

func (c *ApiClient) PollCommitRulestack(ctx context.Context, input stack.SimpleInput) (stack.CommitStatus, error)

func (*ApiClient) ReadAccount added in v1.0.5

func (c *ApiClient) ReadAccount(ctx context.Context, input account.ReadInput) (account.ReadOutput, error)

func (*ApiClient) ReadAppID added in v1.0.0

func (c *ApiClient) ReadAppID(ctx context.Context, a appid.ReadInput) (appid.ReadOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ReadCertificate added in v1.0.0

func (c *ApiClient) ReadCertificate(ctx context.Context, input certificate.ReadInput) (certificate.ReadOutput, error)

func (*ApiClient) ReadFeed added in v1.0.0

func (c *ApiClient) ReadFeed(ctx context.Context, f feed.ReadInput) (feed.ReadOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ReadFirewall added in v1.0.0

func (c *ApiClient) ReadFirewall(ctx context.Context, input firewall.ReadInput) (firewall.ReadOutput, error)

func (*ApiClient) ReadFirewallLogProfile added in v1.0.0

func (c *ApiClient) ReadFirewallLogProfile(ctx context.Context, f logprofile.ReadInput) (logprofile.ReadOutput, error)

Cloud vendor agnostic interface APIs to program NGFW

func (*ApiClient) ReadFqdn added in v1.0.0

func (c *ApiClient) ReadFqdn(ctx context.Context, f fqdn.ReadInput) (fqdn.ReadOutput, error)

func (*ApiClient) ReadPrefixList added in v1.0.0

func (c *ApiClient) ReadPrefixList(ctx context.Context, a prefix.ReadInput) (prefix.ReadOutput, error)

func (*ApiClient) ReadRuleStack added in v1.0.0

func (c *ApiClient) ReadRuleStack(ctx context.Context, input stack.ReadInput) (stack.ReadOutput, error)

func (*ApiClient) ReadSecurityRule added in v1.0.0

func (c *ApiClient) ReadSecurityRule(ctx context.Context, f security.ReadInput) (security.ReadOutput, error)

func (*ApiClient) ReadUrlCustomCategory added in v1.0.0

func (c *ApiClient) ReadUrlCustomCategory(ctx context.Context, a url.ReadInput) (url.ReadOutput, error)

func (*ApiClient) RemoveTagsForFirewall added in v1.0.0

func (c *ApiClient) RemoveTagsForFirewall(ctx context.Context, input firewall.RemoveTagsInput) error

func (*ApiClient) RemoveTagsRuleStack added in v1.0.0

func (c *ApiClient) RemoveTagsRuleStack(ctx context.Context, input stack.RemoveTagsInput) error

func (*ApiClient) SaveRuleStackXML added in v1.0.0

func (c *ApiClient) SaveRuleStackXML(ctx context.Context, input stack.SaveRulestackXmlInput) error

func (*ApiClient) SetEndpoint added in v1.0.0

func (c *ApiClient) SetEndpoint(ctx context2.Context, input EndPointInput) error

func (*ApiClient) UpdateCertificate added in v1.0.0

func (c *ApiClient) UpdateCertificate(ctx context.Context, input certificate.Info) error

func (*ApiClient) UpdateFeed added in v1.0.0

func (c *ApiClient) UpdateFeed(ctx context.Context, f feed.Info) error

func (*ApiClient) UpdateFirewallContentVersion added in v1.0.0

func (c *ApiClient) UpdateFirewallContentVersion(ctx context.Context, input firewall.UpdateContentVersionInput) error

func (*ApiClient) UpdateFirewallDescription added in v1.0.0

func (c *ApiClient) UpdateFirewallDescription(ctx context.Context, input firewall.UpdateDescriptionInput) error

func (*ApiClient) UpdateFirewallLogProfile added in v1.0.0

func (c *ApiClient) UpdateFirewallLogProfile(ctx context.Context, input logprofile.Info) error

func (*ApiClient) UpdateFirewallRulestack added in v1.0.0

func (c *ApiClient) UpdateFirewallRulestack(ctx context.Context, input firewall.UpdateRulestackInput) error

func (*ApiClient) UpdateFirewallSubnetMappings added in v1.0.0

func (c *ApiClient) UpdateFirewallSubnetMappings(ctx context.Context, input firewall.UpdateSubnetMappingsInput) error

func (*ApiClient) UpdateFqdn added in v1.0.0

func (c *ApiClient) UpdateFqdn(ctx context.Context, f fqdn.Info) error

func (*ApiClient) UpdatePrefixList added in v1.0.0

func (c *ApiClient) UpdatePrefixList(ctx context.Context, f prefix.Info) error

func (*ApiClient) UpdateRuleStack added in v1.0.0

func (c *ApiClient) UpdateRuleStack(ctx context.Context, input stack.Info) error

func (*ApiClient) UpdateSecurityRule added in v1.0.0

func (c *ApiClient) UpdateSecurityRule(ctx context.Context, f security.Info) error

func (*ApiClient) UpdateUrlCategoryActionOverride added in v1.0.0

func (c *ApiClient) UpdateUrlCategoryActionOverride(ctx context.Context, input predefinedurl.OverrideInput) error

func (*ApiClient) UpdateUrlCustomCategory added in v1.0.0

func (c *ApiClient) UpdateUrlCustomCategory(ctx context.Context, f url.Info) error

func (*ApiClient) ValidateRuleStack added in v1.0.0

func (c *ApiClient) ValidateRuleStack(ctx context.Context, input stack.SimpleInput) error

type Client

type Client interface {
	ListFeed(ctx context.Context, input feed.ListInput) (feed.ListOutput, error)
	CreateFeed(ctx context.Context, input feed.Info) error
	ReadFeed(ctx context.Context, input feed.ReadInput) (feed.ReadOutput, error)
	UpdateFeed(ctx context.Context, input feed.Info) error
	DeleteFeed(ctx context.Context, input feed.DeleteInput) error

	ListSecurityRule(ctx context.Context, input security.ListInput) (security.ListOutput, error)
	CreateSecurityRule(ctx context.Context, input security.Info) error
	ReadSecurityRule(ctx context.Context, input security.ReadInput) (security.ReadOutput, error)
	UpdateSecurityRule(ctx context.Context, input security.Info) error
	DeleteSecurityRule(ctx context.Context, input security.DeleteInput) error

	ListRuleStack(ctx context.Context, input stack.ListInput) (stack.ListOutput, error)
	CreateRuleStack(ctx context.Context, input stack.Info) error
	ReadRuleStack(ctx context.Context, input stack.ReadInput) (stack.ReadOutput, error)
	ExportRuleStackXML(ctx context.Context, input stack.ReadInput) (stack.ExportRulestackXmlOutput, error)
	SaveRuleStackXML(ctx context.Context, input stack.SaveRulestackXmlInput) error
	UpdateRuleStack(ctx context.Context, input stack.Info) error
	DeleteRuleStack(ctx context.Context, input stack.SimpleInput) error
	CommitRuleStack(ctx context.Context, input stack.SimpleInput) error
	PollCommitRuleStack(ctx context.Context, input stack.SimpleInput) (stack.CommitStatus, error)
	CommitStatusRuleStack(ctx context.Context, input stack.SimpleInput) (stack.CommitStatus, error)
	RevertRuleStack(ctx context.Context, input stack.SimpleInput) error
	ValidateRuleStack(ctx context.Context, input stack.SimpleInput) error
	ListTagsRuleStack(ctx context.Context, input stack.ListTagsInput) (stack.ListTagsOutput, error)
	AddTagsRuleStack(ctx context.Context, input stack.AddTagsInput) error
	RemoveTagsRuleStack(ctx context.Context, input stack.RemoveTagsInput) error
	ApplyTagsRuleStack(ctx context.Context, input stack.AddTagsInput) error

	ListAppID(ctx context.Context, input appid.ListInput) (appid.ListOutput, error)
	ReadAppID(ctx context.Context, input appid.ReadInput) (appid.ReadOutput, error)
	ReadApplication(ctx context.Context, version, app string) (appid.ReadApplicationOutput, error)

	ListCertificate(ctx context.Context, input certificate.ListInput) (certificate.ListOutput, error)
	CreateCertificate(ctx context.Context, input certificate.Info) error
	ReadCertificate(ctx context.Context, input certificate.ReadInput) (certificate.ReadOutput, error)
	UpdateCertificate(ctx context.Context, input certificate.Info) error
	DeleteCertificate(ctx context.Context, input certificate.DeleteInput) error

	ListCountry(ctx context.Context, input country.ListInput) (country.ListOutput, error)

	ListFqdn(ctx context.Context, input fqdn.ListInput) (fqdn.ListOutput, error)
	CreateFqdn(ctx context.Context, input fqdn.Info) error
	ReadFqdn(ctx context.Context, input fqdn.ReadInput) (fqdn.ReadOutput, error)
	UpdateFqdn(ctx context.Context, input fqdn.Info) error
	DeleteFqdn(ctx context.Context, input fqdn.DeleteInput) error

	ReadFirewallLogprofile(ctx context.Context, input logprofile.ReadInput) (logprofile.ReadOutput, error)
	UpdateFirewallLogprofile(ctx context.Context, input logprofile.Info) error

	ListUrlPredefinedCategories(ctx context.Context, input predefinedurl.ListInput) (predefinedurl.ListOutput, error)
	ListUrlCategoriesActionOverride(ctx context.Context, input predefinedurl.ListOverridesInput) (predefinedurl.ListOverridesOutput, error)
	DescribeUrlCategoryActionOverride(ctx context.Context, input predefinedurl.GetOverrideInput) (predefinedurl.GetOverrideOutput, error)
	UpdateUrlCategoryActionOverride(ctx context.Context, input predefinedurl.OverrideInput) error

	ListPrefixList(ctx context.Context, input prefix.ListInput) (prefix.ListOutput, error)
	CreatePrefixList(ctx context.Context, input prefix.Info) error
	ReadPrefixList(ctx context.Context, input prefix.ReadInput) (prefix.ReadOutput, error)
	UpdatePrefixList(ctx context.Context, input prefix.Info) error
	DeletePrefixList(ctx context.Context, input prefix.DeleteInput) error

	ListUrlCustomCategory(ctx context.Context, input url.ListInput) (url.ListOutput, error)
	CreateUrlCustomCategory(ctx context.Context, input url.Info) error
	ReadUrlCustomCategory(ctx context.Context, input url.ReadInput) (url.ReadOutput, error)
	UpdateUrlCustomCategory(ctx context.Context, input url.Info) error
	DeleteUrlCustomCategory(ctx context.Context, input url.DeleteInput) error

	ListFirewall(ctx context.Context, input firewall.ListInput) (firewall.ListOutput, error)
	CreateFirewall(ctx context.Context, input firewall.Info) (firewall.CreateOutput, error)
	ModifyFirewall(ctx context.Context, input firewall.Info) (bool, error)
	ReadFirewall(ctx context.Context, input firewall.ReadInput) (firewall.ReadOutput, error)
	UpdateFirewallDescription(ctx context.Context, input firewall.UpdateDescriptionInput) error
	UpdateFirewallContentVersion(ctx context.Context, input firewall.UpdateContentVersionInput) error
	UpdateFirewallSubnetMappings(ctx context.Context, input firewall.UpdateSubnetMappingsInput) error
	UpdateFirewallRulestack(ctx context.Context, input firewall.UpdateRulestackInput) error
	ListTagsForFirewall(ctx context.Context, input firewall.ListTagsInput) (firewall.ListTagsOutput, error)
	RemoveTagsForFirewall(ctx context.Context, input firewall.RemoveTagsInput) error
	AddTagsForFirewall(ctx context.Context, input firewall.AddTagsInput) error
	DeleteFirewall(ctx context.Context, input firewall.DeleteInput) error
	AssociateGlobalRuleStack(ctx context.Context, input firewall.AssociateInput) (firewall.AssociateOutput, error)
	DisAssociateGlobalRuleStack(ctx context.Context, input firewall.DisAssociateInput) (firewall.DisAssociateOutput, error)
	SetEndpoint(ctx context.Context, input EndPointInput) error
	GetCloudNGFWServiceToken(ctx context.Context, info stack.AuthInput) (stack.AuthOutput, error)
	CreateAccount(ctx context.Context, input account.CreateInput) (account.CreateOutput, error)
	ReadAccount(ctx context.Context, input account.ReadInput) (account.ReadOutput, error)
	ListAccounts(ctx context.Context, input account.ListInput) (account.ListOutput, error)
	DeleteAccount(ctx context.Context, input account.DeleteInput) error
	IsSyncModeEnabled(ctx context.Context) bool
	GetResourceTimeout(ctx context.Context) int
	GetMPRegion(ctx context.Context) string
	GetProfile(ctx context.Context) string
}

vendor specific ngfw clients(AWS, Azure) implement apiClient under ngfw directory

type EndPointInput added in v1.0.0

type EndPointInput struct {
	ApiEndpoint     string
	ApiAuthEndpoint string
}

type Failure

type Failure interface {
	Failed() *Status
}

Failure is an interface that returns an api.Status (which implements Error) if there was an error in an API call.

type Response

type Response struct {
	Status Status `json:"ResponseStatus"`
}

Response is a generic response container.

This is useful if you don't care about the response from the API, as long as there wasn't any errors.

func (Response) Failed

func (o Response) Failed() *Status

type Status

type Status struct {
	Code   int    `json:"ErrorCode"`
	Reason string `json:"Reason"`
}

Status is a container for the status of API calls.

This contains the error code and the reason.

func NewUnknownPathError

func NewUnknownPathError(v []string) *Status

func (Status) Error

func (s Status) Error() string

func (Status) Failed

func (s Status) Failed() *Status

func (Status) ObjectNotFound

func (s Status) ObjectNotFound() bool

Jump to

Keyboard shortcuts

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