incapsula

package
v0.0.0-...-23861d2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MPL-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provider

func Provider() terraform.ResourceProvider

Provider returns a terraform.ResourceProvider

Types

type AccountResponse

type AccountResponse struct {
	Account struct {
		Email        string `json:"email"`
		PlanID       string `json:"plan_id"`
		PlanName     string `json:"plan_name"`
		TrialEndDate string `json:"trial_end_date"`
		AccountID    int    `json:"account_id"`
		RefID        string `json:"ref_id"`
		UserName     string `json:"user_name"`
		AccountName  string `json:"account_name"`
		Logins       []struct {
			LoginID       float64 `json:"login_id"`
			Email         string  `json:"email"`
			EmailVerified bool    `json:"email_verified"`
		} `json:"logins"`
		SupportLevel                 string `json:"support_level"`
		SupportAllTLSVersions        bool   `json:"supprt_all_tls_versions"`
		WildcardSANForNewSites       string `json:"wildcard_san_for_new_sites"`
		NakedDomainSANForNewWWWSites bool   `json:"naked_domain_san_for_new_www_sites"`
	} `json:"account"`
	Email       string `json:"email"`
	PlanID      string `json:"plan_id"`
	PlanName    string `json:"plan_name"`
	AccountID   int    `json:"account_id"`
	UserName    string `json:"user_name"`
	AccountName string `json:"account_name"`
	RefID       string `json:"ref_id"`
	Logins      []struct {
		LoginID       float64 `json:"login_id"`
		Email         string  `json:"email"`
		EmailVerified bool    `json:"email_verified"`
	} `json:"logins"`
	SupportLevel                 string `json:"support_level"`
	SupportAllTLSVersions        bool   `json:"supprt_all_tls_versions"`
	WildcardSANForNewSites       string `json:"wildcard_san_for_new_sites"`
	NakedDomainSANForNewWWWSites bool   `json:"naked_domain_san_for_new_www_sites"`
	Res                          int    `json:"res"`
	ResMessage                   string `json:"res_message"`
	DebugInfo                    struct {
		IDInfo string `json:"id-info"`
	} `json:"debug_info"`
}

AccountResponse contains account id

type CertificateAddResponse

type CertificateAddResponse struct {
	Res        int    `json:"res"`
	ResMessage string `json:"res_message"`
}

CertificateAddResponse contains confirmation of successful upload of certificate

type CertificateEditResponse

type CertificateEditResponse struct {
	Res        int    `json:"res"`
	ResMessage string `json:"res_message"`
}

CertificateEditResponse contains confirmation of successful upload of certificate

type CertificateListResponse

type CertificateListResponse struct {
	Res int `json:"res"`
}

CertificateListResponse contains site object with details of custom certificate

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents an internal client that brokers calls to the Incapsula API

func NewClient

func NewClient(config *Config) *Client

NewClient creates a new client with the provided configuration

func (*Client) AddCertificate

func (c *Client) AddCertificate(siteID, certificate, privateKey, passphrase string) (*CertificateAddResponse, error)

AddCertificate adds a custom SSL certificate to a site in Incapsula

func (*Client) AddDataCenter

func (c *Client) AddDataCenter(siteID, name, serverAddress, isStandby, isContent string) (*DataCenterAddResponse, error)

AddDataCenter adds an incap rule to be managed by Incapsula

func (*Client) AddDataCenterServer

func (c *Client) AddDataCenterServer(dcID, serverAddress, isStandby string) (*DataCenterServerAddResponse, error)

AddDataCenterServer adds an incap data center server to be managed by Incapsula

func (*Client) AddIncapRule

func (c *Client) AddIncapRule(siteID string, rule *IncapRule) (*IncapRuleWithID, error)

AddIncapRule adds an incap rule to be managed by Incapsula

func (*Client) AddSecurityRuleException

func (c *Client) AddSecurityRuleException(siteID int, ruleID, clientAppTypes, clientApps, countries, continents, ips, urlPatterns, urls, userAgents, parameters string) (*SecurityRuleExceptionCreateResponse, error)

AddSecurityRuleException adds a security rule exception

func (*Client) AddSite

func (c *Client) AddSite(domain, accountID, refID, sendSiteSetupEmails, siteIP, forceSSL string) (*SiteAddResponse, error)

AddSite adds a site to be managed by Incapsula

func (*Client) ConfigureACLSecurityRule

func (c *Client) ConfigureACLSecurityRule(siteID int, ruleID, continents, countries, ips, urls, urlPatterns string) (*SiteStatusResponse, error)

ConfigureACLSecurityRule adds an ACL rule

func (*Client) ConfigureWAFSecurityRule

func (c *Client) ConfigureWAFSecurityRule(siteID int, ruleID, securityRuleAction, activationMode, ddosTrafficThreshold, blockBadBots, challengeSuspectedBots string) (*SiteStatusResponse, error)

ConfigureWAFSecurityRule adds an WAF rule

func (*Client) DeleteCertificate

func (c *Client) DeleteCertificate(siteID string) error

DeleteCertificate deletes a custom certificate for a specific site in Incapsula

func (*Client) DeleteDataCenter

func (c *Client) DeleteDataCenter(dcID string) error

DeleteDataCenter deletes a site currently managed by Incapsula

func (*Client) DeleteDataCenterServer

func (c *Client) DeleteDataCenterServer(serverID string) error

DeleteDataCenterServer deletes a data center server currently managed by Incapsula

func (*Client) DeleteIncapRule

func (c *Client) DeleteIncapRule(siteID string, ruleID int) error

DeleteIncapRule deletes a site currently managed by Incapsula

func (*Client) DeleteSecurityRuleException

func (c *Client) DeleteSecurityRuleException(siteID int, ruleID, whitelistID string) error

DeleteSecurityRuleException deletes a security rule exception

func (*Client) DeleteSite

func (c *Client) DeleteSite(domain string, siteID int) error

DeleteSite deletes a site currently managed by Incapsula

func (*Client) EditCertificate

func (c *Client) EditCertificate(siteID, certificate, privateKey, passphrase string) (*CertificateEditResponse, error)

EditCertificate updates the custom certifiacte on an Incapsula site

func (*Client) EditDataCenter

func (c *Client) EditDataCenter(dcID, name, isStandby, isContent, isEnabled string) (*DataCenterEditResponse, error)

EditDataCenter edits the Incapsula incap rule

func (*Client) EditDataCenterServer

func (c *Client) EditDataCenterServer(serverID, serverAddress, isStandby, isEnabled string) (*DataCenterServerEditResponse, error)

EditDataCenterServer edits the Incapsula data center server

func (*Client) EditSecurityRuleException

func (c *Client) EditSecurityRuleException(siteID int, ruleID, clientAppTypes, clientApps, countries, continents, ips, urlPatterns, urls, userAgents, parameters, whitelistID string) (*SiteStatusResponse, error)

EditSecurityRuleException edits a security rule exception

func (*Client) ListCertificates

func (c *Client) ListCertificates(siteID string) (*CertificateListResponse, error)

ListCertificates gets the list of custom certificates for a site

func (*Client) ListDataCenters

func (c *Client) ListDataCenters(siteID string) (*DataCenterListResponse, error)

ListDataCenters gets the Incapsula list of data centers

func (*Client) ListSecurityRuleExceptions

func (c *Client) ListSecurityRuleExceptions(siteID, ruleID string) (*SiteStatusResponse, error)

ListSecurityRuleExceptions gets the site status including the list of exceptions for security rules

func (*Client) ReadIncapRule

func (c *Client) ReadIncapRule(siteID string, ruleID int) (*IncapRuleWithID, int, error)

ReadIncapRule gets the specific Incap Rule

func (*Client) SiteStatus

func (c *Client) SiteStatus(domain string, siteID int) (*SiteStatusResponse, error)

SiteStatus gets the Incapsula managed site's status

func (*Client) UpdateIncapRule

func (c *Client) UpdateIncapRule(siteID string, ruleID int, rule *IncapRule) (*IncapRuleWithID, error)

UpdateIncapRule updates the Incapsula Incap Rule

func (*Client) UpdateSite

func (c *Client) UpdateSite(siteID, param, value string) (*SiteUpdateResponse, error)

UpdateSite will update the specific param/value on the site resource

func (*Client) Verify

func (c *Client) Verify() (*AccountResponse, error)

Verify checks the API credentials

type Config

type Config struct {
	// API Identifier
	APIID string

	// API Key
	APIKey string

	// Base URL (no trailing slash)
	BaseURL string

	// IncapRule Base URL (no trailing slash)
	IncapRuleBaseURL string
}

Config represents the configuration required for the Incapsula Client

func (*Config) Client

func (c *Config) Client() (interface{}, error)

Client configures and returns a fully initialized Incapsula Client

type DataCenterAddResponse

type DataCenterAddResponse struct {
	Res          interface{} `json:"res"`
	DataCenterID string      `json:"datacenter_id"`
}

DataCenterAddResponse contains id of data center

type DataCenterEditResponse

type DataCenterEditResponse struct {
	Res        interface{} `json:"res"`
	ResMessage string      `json:"res_message"`
}

DataCenterEditResponse contains edit response message

type DataCenterListResponse

type DataCenterListResponse struct {
	Res interface{} `json:"res"`
	DCs []struct {
		ID      string `json:"id"`
		Enabled string `json:"enabled"`
		Servers []struct {
			ID        string `json:"id"`
			Enabled   string `json:"enabled"`
			Address   string `json:"address"`
			IsStandBy string `json:"isStandby"`
		} `json:"servers"`
		Name        string `json:"name"`
		ContentOnly string `json:"contentOnly"`
		IsActive    string `json:"isActive"`
	} `json:"DCs"`
}

DataCenterListResponse contains list of data centers and servers

type DataCenterServerAddResponse

type DataCenterServerAddResponse struct {
	Res      interface{} `json:"res"`
	ServerID string      `json:"server_id"`
}

DataCenterServerAddResponse contains id of server

type DataCenterServerEditResponse

type DataCenterServerEditResponse struct {
	Res          interface{} `json:"res"`
	DataCenterID string      `json:"datacenter_id"`
}

DataCenterServerEditResponse contains data center id

type DeleteSecurityRuleExceptionResponse

type DeleteSecurityRuleExceptionResponse struct {
	Res int `json:"res"`
}

DeleteSecurityRuleExceptionResponse contains the response code for deleting a security exception

type IncapRule

type IncapRule struct {
	Name                string `json:"name"`
	Action              string `json:"action"`
	Filter              string `json:"filter"`
	ResponseCode        int    `json:"response_code,omitempty"`
	AddMissing          bool   `json:"add_missing,omitempty"`
	From                string `json:"from,omitempty"`
	To                  string `json:"to,omitempty"`
	RewriteName         string `json:"rewrite_name,omitempty"`
	DCID                int    `json:"dc_id,omitempty"`
	RateContext         string `json:"rate_context,omitempty"`
	RateInterval        int    `json:"rate_interval,omitempty"`
	ErrorType           string `json:"error_type,omitempty"`
	ErrorResponseFormat string `json:"error_response_format,omitempty"`
	ErrorResponseData   string `json:"error_response_data,omitempty"`
}

IncapRule is a struct that encompasses all the properties of an IncapRule

type IncapRuleWithID

type IncapRuleWithID struct {
	IncapRule
	RuleID int `json:"rule_id"`
}

IncapRuleWithID contains the IncapRule as well as the rule identifier

type SecurityRuleExceptionCreateResponse

type SecurityRuleExceptionCreateResponse struct {
	Res         string `json:"res"`
	ExceptionID string `json:"exception_id"`
	Status      string `json:"status"`
}

SecurityRuleExceptionCreateResponse provides exception_id of rule exception

type SiteAddResponse

type SiteAddResponse struct {
	SiteID int `json:"site_id"`
	Res    int `json:"res"`
}

SiteAddResponse contains the relevant site information when adding an Incapsula managed site

type SiteStatusResponse

type SiteStatusResponse struct {
	SiteID            int      `json:"site_id"`
	Status            string   `json:"status"`
	Domain            string   `json:"domain"`
	RefID             string   `json:"ref_id,omitempty"`
	AccountID         int      `json:"account_id"`
	AccelerationLevel string   `json:"acceleration_level"`
	SiteCreationDate  int64    `json:"site_creation_date"`
	Ips               []string `json:"ips"`
	DNS               []struct {
		DNSRecordName string   `json:"dns_record_name"`
		SetTypeTo     string   `json:"set_type_to"`
		SetDataTo     []string `json:"set_data_to"`
	} `json:"dns"`
	OriginalDNS []struct {
		DNSRecordName string   `json:"dns_record_name"`
		SetTypeTo     string   `json:"set_type_to"`
		SetDataTo     []string `json:"set_data_to"`
	} `json:"original_dns"`
	Warnings                     []interface{} `json:"warnings"`
	Active                       string        `json:"active"`
	SupportAllTLSVersions        bool          `json:"support_all_tls_versions"`
	WildcardSanForNewSites       bool          `json:"wildcard_san_for_new_sites"`
	NakedDomainSanForNewWwwSites bool          `json:"naked_domain_san_for_new_www_sites"`
	AdditionalErrors             []interface{} `json:"additionalErrors"`
	DisplayName                  string        `json:"display_name"`
	Security                     struct {
		Waf struct {
			Rules []struct {
				Action                 string `json:"action,omitempty"`
				ActionText             string `json:"action_text,omitempty"`
				ID                     string `json:"id"`
				Name                   string `json:"name"`
				BlockBadBots           bool   `json:"block_bad_bots,omitempty"`
				ChallengeSuspectedBots bool   `json:"challenge_suspected_bots,omitempty"`
				ActivationMode         string `json:"activation_mode,omitempty"`
				ActivationModeText     string `json:"activation_mode_text,omitempty"`
				DdosTrafficThreshold   int    `json:"ddos_traffic_threshold,omitempty"`
				Exceptions             []struct {
					Values []struct {
						ID   string   `json:"id,omitempty"`
						Name string   `json:"name,omitempty"`
						Ips  []string `json:"ips,omitempty"`
						Urls []struct {
							Value   string `json:"value,omitempty"`
							Pattern string `json:"pattern,omitempty"`
						} `json:"urls,omitempty"`
						Geo struct {
							Countries  []string `json:"countries,omitempty"`
							Continents []string `json:"continents,omitempty"`
						} `json:"geo,omitempty"`
						ClientApps     []string `json:"client_apps,omitempty"`
						ClientAppTypes []string `json:"client_app_types,omitempty"`
						Parameters     []string `json:"parameters,omitempty"`
						UserAgents     []string `json:"user_agents,omitempty"`
					} `json:"values,omitempty"`
					ID int `json:"id,omitempty"`
				} `json:"exceptions,omitempty"`
			} `json:"rules"`
		} `json:"waf"`
		Acls struct {
			Rules []struct {
				Ips  []string `json:"ips,omitempty"`
				ID   string   `json:"id"`
				Name string   `json:"name"`
				Geo  struct {
					Countries  []string `json:"countries"`
					Continents []string `json:"continents"`
				} `json:"geo,omitempty"`
				Urls []struct {
					Value   string `json:"value"`
					Pattern string `json:"pattern"`
				} `json:"urls,omitempty"`
				Exceptions []struct {
					Values []struct {
						ID   string   `json:"id"`
						Name string   `json:"name"`
						Ips  []string `json:"ips,omitempty"`
						Urls []struct {
							Value   string `json:"value"`
							Pattern string `json:"pattern"`
						} `json:"urls,omitempty"`
						Geo struct {
							Countries  []string `json:"countries"`
							Continents []string `json:"continents"`
						} `json:"geo,omitempty"`
						ClientApps     []string `json:"client_apps,omitempty"`
						ClientAppTypes []string `json:"client_app_types,omitempty"`
						Parameters     []string `json:"parameters,omitempty"`
						UserAgents     []string `json:"user_agents,omitempty"`
					} `json:"values"`
					ID int `json:"id"`
				} `json:"exceptions"`
			} `json:"rules"`
		} `json:"acls"`
	} `json:"security"`
	SealLocation struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"sealLocation"`
	Ssl struct {
		OriginServer struct {
			Detected        bool   `json:"detected"`
			DetectionStatus string `json:"detectionStatus"`
		} `json:"origin_server"`
		GeneratedCertificate struct {
			San []interface{} `json:"san"`
		} `json:"generated_certificate"`
	} `json:"ssl"`
	SiteDualFactorSettings struct {
		SpecificUsers                []interface{} `json:"specificUsers"`
		Enabled                      bool          `json:"enabled"`
		CustomAreas                  []interface{} `json:"customAreas"`
		CustomAreasExceptions        []interface{} `json:"customAreasExceptions"`
		AllowAllUsers                bool          `json:"allowAllUsers"`
		ShouldSuggestApplicatons     bool          `json:"shouldSuggestApplicatons"`
		AllowedMedia                 []string      `json:"allowedMedia"`
		ShouldSendLoginNotifications bool          `json:"shouldSendLoginNotifications"`
		Version                      int           `json:"version"`
	} `json:"siteDualFactorSettings"`
	LoginProtect struct {
		Enabled               bool          `json:"enabled"`
		SpecificUsersList     []interface{} `json:"specific_users_list"`
		SendLpNotifications   bool          `json:"send_lp_notifications"`
		AllowAllUsers         bool          `json:"allow_all_users"`
		AuthenticationMethods []string      `json:"authentication_methods"`
		Urls                  []interface{} `json:"urls"`
		URLPatterns           []interface{} `json:"url_patterns"`
	} `json:"login_protect"`
	PerformanceConfiguration struct {
		AdvancedCachingRules struct {
			NeverCacheResources  []interface{} `json:"never_cache_resources"`
			AlwaysCacheResources []interface{} `json:"always_cache_resources"`
		} `json:"advanced_caching_rules"`
		AccelerationLevel         string        `json:"acceleration_level"`
		AsyncValidation           bool          `json:"async_validation"`
		MinifyJavascript          bool          `json:"minify_javascript"`
		MinifyCSS                 bool          `json:"minify_css"`
		MinifyStaticHTML          bool          `json:"minify_static_html"`
		CompressJpeg              bool          `json:"compress_jpeg"`
		CompressJepg              bool          `json:"compress_jepg"`
		ProgressiveImageRendering bool          `json:"progressive_image_rendering"`
		AggressiveCompression     bool          `json:"aggressive_compression"`
		CompressPng               bool          `json:"compress_png"`
		OnTheFlyCompression       bool          `json:"on_the_fly_compression"`
		TCPPrePooling             bool          `json:"tcp_pre_pooling"`
		ComplyNoCache             bool          `json:"comply_no_cache"`
		ComplyVary                bool          `json:"comply_vary"`
		UseShortestCaching        bool          `json:"use_shortest_caching"`
		PerferLastModified        bool          `json:"perfer_last_modified"`
		PreferLastModified        bool          `json:"prefer_last_modified"`
		DisableClientSideCaching  bool          `json:"disable_client_side_caching"`
		Cache300X                 bool          `json:"cache300x"`
		CacheHeaders              []interface{} `json:"cache_headers"`
	} `json:"performance_configuration"`
	ExtendedDdos int         `json:"extended_ddos"`
	ExceptionID  string      `json:"exception_id,omitempty"`
	Res          interface{} `json:"res"`
	ResMessage   string      `json:"res_message"`
	DebugInfo    struct {
		IDInfo string `json:"id-info"`
	} `json:"debug_info"`
}

SiteStatusResponse contains managed site information

type SiteUpdateResponse

type SiteUpdateResponse struct {
	SiteID int `json:"site_id"`
	Res    int `json:"res"`
}

SiteUpdateResponse contains the relevant site information when updating an Incapsula managed site

Jump to

Keyboard shortcuts

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