Documentation
¶
Index ¶
- Constants
- Variables
- type API
- func (api *API) CreateCacheSetting(setting *CacheSetting, subDomainName string) (*CacheSetting, error)
- func (api *API) CreateDNSRecord(record *DNSRecord, domainName string) (*DNSRecord, error)
- func (api *API) CreateDomain(domain *Domain) (*Domain, error)
- func (api *API) CreateIPFilter(filter *IPFilter, subDomainName string) (*IPFilter, error)
- func (api *API) CreateRateLimit(ratelimit *RateLimit) (*RateLimit, error)
- func (api *API) CreateRedirect(redirect *Redirect, subDomainName string) (*Redirect, error)
- func (api *API) CreateSSLCertificate(cert *SSLCertificate, domainName string) (*SSLCertificate, error)
- func (api *API) CreateWAFRule(rule *WAFRule) (*WAFRule, error)
- func (api *API) DeleteCacheSetting(setting *CacheSetting, subDomainName string) (*CacheSetting, error)
- func (api *API) DeleteDNSRecord(record *DNSRecord, domainName string) (*DNSRecord, error)
- func (api *API) DeleteDomain(domain *Domain) (*Domain, error)
- func (api *API) DeleteIPFilter(filter *IPFilter, subDomainName string) (*IPFilter, error)
- func (api *API) DeleteRateLimit(ratelimit *RateLimit) (*RateLimit, error)
- func (api *API) DeleteRedirect(redirect *Redirect, subDomainName string) (*Redirect, error)
- func (api *API) DeleteSSLCertificate(cert *SSLCertificate, domainName string) (*SSLCertificate, error)
- func (api *API) DeleteWAFRule(rule *WAFRule) (*WAFRule, error)
- func (api *API) FetchWAFRule(id int, params map[string]string) (*WAFRule, error)
- func (api *API) ListCacheSettings(subDomainName string, params map[string]string) ([]CacheSetting, error)
- func (api *API) ListDNSRecords(domainName string, params map[string]string) ([]DNSRecord, error)
- func (api *API) ListDomains(params map[string]string) ([]Domain, error)
- func (api *API) ListIPFilters(subDomainName string, params map[string]string) ([]IPFilter, error)
- func (api *API) ListIPRanges(params map[string]string) ([]IPRange, error)
- func (api *API) ListRateLimits(rateLimitType string, params map[string]string) ([]RateLimit, error)
- func (api *API) ListRedirects(subDomainName string, params map[string]string) ([]Redirect, error)
- func (api *API) ListSSLCertificates(domainName string, params map[string]string) ([]SSLCertificate, error)
- func (api *API) ListSettings(subDomainName string, params map[string]string) (*Settings, error)
- func (api *API) ListWAFActions() ([]WAFAction, error)
- func (api *API) ListWAFConditions() ([]WAFCondition, error)
- func (api *API) ListWAFRules(ruleType string, params map[string]string) ([]WAFRule, error)
- func (api *API) SetLanguage(language string) error
- func (api *API) SetUserAgent(userAgent string)
- func (api *API) UpdateCacheSetting(setting *CacheSetting, subDomainName string) (*CacheSetting, error)
- func (api *API) UpdateDNSRecord(record *DNSRecord, domainName string) (*DNSRecord, error)
- func (api *API) UpdateDomain(domain *Domain) (*Domain, error)
- func (api *API) UpdateIPFilter(filter *IPFilter, subDomainName string) (*IPFilter, error)
- func (api *API) UpdateRateLimit(ratelimit *RateLimit) (*RateLimit, error)
- func (api *API) UpdateRedirect(redirect *Redirect, subDomainName string) (*Redirect, error)
- func (api *API) UpdateSSLCertificate(cert *SSLCertificate, domainName string) (*SSLCertificate, error)
- func (api *API) UpdateSettings(settings *Settings, subDomainName string) (*Settings, error)
- func (api *API) UpdateWAFRule(rule *WAFRule) (*WAFRule, error)
- type APIMethod
- type CacheSetting
- type Certificate
- type DNSRecord
- type Domain
- type IPFilter
- type IPRange
- type RateLimit
- type Redirect
- type Response
- type SSLCertificate
- type SSLIntermediate
- type Settings
- type UpstreamOptions
- type Violation
- type WAFAction
- type WAFCondition
- type WAFRule
Constants ¶
const ( ParamPage = "page" ParamPageSize = "pageSize" ParamSearch = "search" )
const ( // APIBaseURL ... APIBaseURL = "https://api.myracloud.com/%s/rapi/%s" // DefaultAPILanguage ... DefaultAPILanguage = "en" // DefaultAPIUserAgent ... DefaultAPIUserAgent = "myrasec-go" )
Variables ¶
var APILanguages = map[string]bool{ "en": true, "de": true, }
APILanguages ...
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { BaseURL string Language string UserAgent string // contains filtered or unexported fields }
API holds the configuration for the current API client.
func (*API) CreateCacheSetting ¶
func (api *API) CreateCacheSetting(setting *CacheSetting, subDomainName string) (*CacheSetting, error)
CreateCacheSetting creates a new cache setting for the passed subdomain (name) using the MYRA API
func (*API) CreateDNSRecord ¶
CreateDNSRecord creates a new DNS record using the MYRA API
func (*API) CreateDomain ¶
CreateDomain creates a new domain using the MYRA API
func (*API) CreateIPFilter ¶
CreateIPFilter creates a new ip filter for the passed subdomain (name) using the MYRA API
func (*API) CreateRateLimit ¶
CreateRateLimit creates a new rate limit setting for the passed subdomain (name) using the MYRA API
func (*API) CreateRedirect ¶
CreateRedirect creates a new redirect for the passed subdomain (name) using the MYRA API
func (*API) CreateSSLCertificate ¶ added in v1.7.0
func (api *API) CreateSSLCertificate(cert *SSLCertificate, domainName string) (*SSLCertificate, error)
CreateSSLCertificate creates a new SSL certificates on the passed domain (name) using the MYRA API
func (*API) CreateWAFRule ¶ added in v1.3.0
CreateWAFRule creates a new WAF rule
func (*API) DeleteCacheSetting ¶
func (api *API) DeleteCacheSetting(setting *CacheSetting, subDomainName string) (*CacheSetting, error)
DeleteCacheSetting deletes the passed cache setting using the MYRA API
func (*API) DeleteDNSRecord ¶
DeleteDNSRecord deletes the passed DNS record using the MYRA API
func (*API) DeleteDomain ¶
DeleteDomain deletes the passed domain using the MYRA API
func (*API) DeleteIPFilter ¶
DeleteIPFilter deletes the passed ip filter using the MYRA API
func (*API) DeleteRateLimit ¶
DeleteRateLimit deletes the passed rate limit setting using the MYRA API
func (*API) DeleteRedirect ¶
DeleteRedirect deletes the passed redirect using the MYRA API
func (*API) DeleteSSLCertificate ¶ added in v1.7.0
func (api *API) DeleteSSLCertificate(cert *SSLCertificate, domainName string) (*SSLCertificate, error)
DeleteSSLCertificate "deletes" the passed SSL certificate by removing the assigned subdomains from the certificate using the MYRA API
func (*API) DeleteWAFRule ¶ added in v1.3.0
DeleteWAFRule deletes the passed WAF rule
func (*API) FetchWAFRule ¶ added in v1.3.0
FetchWAFRule returns a single WAF rule for the given ID
func (*API) ListCacheSettings ¶
func (api *API) ListCacheSettings(subDomainName string, params map[string]string) ([]CacheSetting, error)
ListCacheSettings returns a slice containing all visible cache settings for a subdomain
func (*API) ListDNSRecords ¶
ListDNSRecords returns a slice containing all visible DNS records for a domain
func (*API) ListDomains ¶
ListDomains returns a slice containing all visible domains
func (*API) ListIPFilters ¶
ListIPFilters returns a slice containing all visible ip filters for a subdomain
func (*API) ListIPRanges ¶ added in v1.5.0
ListIPRanges returns a slice containing all ip ranges
func (*API) ListRateLimits ¶
ListRateLimits returns a slice containing all visible rate limit settings Valid rateLimitType values are "dns" or "tag"
Rate limit settings can be filtered using the params map ¶
Avalilable filters/query parameters:
search (string) - filter by the specified search query
Additional valid filters/query parameters for ruleType = "dns":
subDomainName (string) - filter rate limit settings for this subdomain (name) reference (int) - filter rate limit settings for this domain (ID)
Additional valid filters/query parameters for ruleType = "tag":
reference (int) - filter rate limit settings for this tag (ID)
func (*API) ListRedirects ¶
ListRedirects returns a slice containing all visible redirects for a subdomain
func (*API) ListSSLCertificates ¶ added in v1.7.0
func (api *API) ListSSLCertificates(domainName string, params map[string]string) ([]SSLCertificate, error)
ListSSLCertificates returns a slice containing all visible SSL certificates for a domain
func (*API) ListSettings ¶
ListSettings returns a Setting struct containing the settings for the passed subdomain
func (*API) ListWAFActions ¶ added in v1.3.0
ListWAFActions returns a list of available WAF actions
func (*API) ListWAFConditions ¶ added in v1.3.0
func (api *API) ListWAFConditions() ([]WAFCondition, error)
ListWAFConditions returns a list of available WAF conditions
func (*API) ListWAFRules ¶ added in v1.3.0
ListWAFRules returns a list of WAF rules. Valid ruleType values are "domain", "tag" or "template"
Rules can be filtered using the params map ¶
Avalilable filters/query parameters:
search (string) - filter by the specified search query
Additional valid filters/query parameters for ruleType = "domanin":
domainName (string) - filter WAF rules for this domain (name) domain (int) - filter WAF rules for this domain (ID) subDomain (string) - filter WAF rules for this subdomain (name)
Additional valid filters/query parameters for ruleType = "tag":
tagId (int) - filter WAF rules for this tag (ID)
func (*API) SetLanguage ¶
SetLanguage changes the API language.
func (*API) SetUserAgent ¶
SetUserAgent sets the User-Agent for the API.
func (*API) UpdateCacheSetting ¶
func (api *API) UpdateCacheSetting(setting *CacheSetting, subDomainName string) (*CacheSetting, error)
UpdateCacheSetting updates the passed cache setting using the MYRA API
func (*API) UpdateDNSRecord ¶
UpdateDNSRecord updates the passed DNS record using the MYRA API
func (*API) UpdateDomain ¶
UpdateDomain updates the passed domain using the MYRA API
func (*API) UpdateIPFilter ¶
UpdateIPFilter updates the passed ip filter using the MYRA API
func (*API) UpdateRateLimit ¶
UpdateRateLimit updates the passed rate limit setting using the MYRA API
func (*API) UpdateRedirect ¶
UpdateRedirect updates the passed redirect using the MYRA API
func (*API) UpdateSSLCertificate ¶ added in v1.7.0
func (api *API) UpdateSSLCertificate(cert *SSLCertificate, domainName string) (*SSLCertificate, error)
UpdateSSLCertificate updates the passed SSL certificate using the MYRA API
func (*API) UpdateSettings ¶
UpdateSettings updates the passed settings using the MYRA API
type APIMethod ¶
type APIMethod struct { Name string Action string Method string Result interface{} ResponseDecodeFunc func(resp *http.Response, definition APIMethod) (interface{}, error) }
APIMethod represents API call definitions used in the methods map
type CacheSetting ¶
type CacheSetting struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` Type string `json:"type"` Path string `json:"path"` TTL int `json:"ttl"` NotFoundTTL int `json:"notFoundTtl"` Sort int `json:"sort,omitempty"` Enabled bool `json:"enabled"` Enforce bool `json:"enforce"` }
CacheSetting ...
type Certificate ¶ added in v1.7.0
type Certificate struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` Subject string `json:"subject"` Algorithm string `json:"algorithm"` ValidFrom *types.DateTime `json:"validFrom"` ValidTo *types.DateTime `json:"validTo"` Fingerprint string `json:"fingerprint"` SerialNumber string `json:"serialNumber"` Cert string `json:"cert,omitempty"` }
type DNSRecord ¶
type DNSRecord struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` Name string `json:"name"` Value string `json:"value"` RecordType string `json:"recordType"` AlternativeCNAME string `json:"alternativeCname,omitempty"` Comment string `json:"comment,omitempty"` Active bool `json:"active"` Enabled bool `json:"enabled"` TTL int `json:"ttl"` Priority int `json:"priority,omitempty"` Port int `json:"port,omitempty"` UpstreamOptions *UpstreamOptions `json:"upstreamOptions,omitempty"` }
DNSRecord ...
type Domain ¶
type Domain struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` Name string `json:"name"` AutoUpdate bool `json:"autoUpdate"` AutoDNS bool `json:"autoDns"` Paused bool `json:"paused"` PausedUntil *types.DateTime `json:"pausedUntil,omitempty"` }
Domain ...
type IPFilter ¶
type IPFilter struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` ExpireDate *types.DateTime `json:"expireDate,omitempty"` Value string `json:"value"` Type string `json:"type"` Comment string `json:"comment,omitempty"` Enabled bool `json:"enabled"` }
IPFilter ...
type IPRange ¶ added in v1.5.0
type IPRange struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` ValidFrom *types.DateTime `json:"validFrom,omitempty"` ValidTo *types.DateTime `json:"validTo,omitempty"` Network string `json:"network"` Comment string `json:"comment,omitempty"` Enabled bool `json:"enabled"` }
IPRange ...
type RateLimit ¶
type RateLimit struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` Burst int `json:"burst"` Network string `json:"network"` SubDomainName string `json:"subDomainName"` Timeframe int `json:"timeframe"` Type string `json:"type"` Value int `json:"value"` }
RateLimit ...
type Redirect ¶
type Redirect struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` Type string `json:"type"` SubDomainName string `json:"subDomainName"` Source string `json:"source"` Destination string `json:"destination"` Comment string `json:"comment,omitempty"` MatchingType string `json:"matchingType"` Sort int `json:"sort,omitempty"` Enabled bool `json:"enabled"` ExpertMode bool `json:"expertMode"` }
Redirect ...
type Response ¶
type Response struct { Error bool `json:"error,omitempty"` ViolationList []*Violation `json:"violationList,omitempty"` TargetObject []interface{} `json:"targetObject,omitempty"` List []interface{} `json:"list,omitempty"` Page int `json:"page,omitempty"` Count int `json:"count,omitempty"` PageSize int `json:"pageSize,omitempty"` }
Response defines a response, returned by the MYRA API
type SSLCertificate ¶ added in v1.7.0
type SSLCertificate struct { *Certificate SubjectAlternatives []string `json:"subjectAlternatives"` Intermediates []SSLIntermediate `json:"intermediates,omitempty"` Wildcard bool `json:"wildcard"` ExtendedValidation bool `json:"extendedValidation"` Subdomains []string `json:"subdomains,omitempty"` Key string `json:"key,omitempty"` CertRefreshForced bool `json:"certRefreshForced,omitempty"` CertToRefresh int `json:"certToRefresh,omitempty"` }
type SSLIntermediate ¶ added in v1.7.0
type SSLIntermediate struct { *Certificate Issuer string `json:"issuer"` }
type Settings ¶
type Settings struct { AccessLog bool `json:"access_log"` AntibotPostFlood bool `json:"antibot_post_flood"` AntibotPostFloodThreshold int `json:"antibot_post_flood_threshold,omitempty"` AntibotProofOfWork bool `json:"antibot_proof_of_work"` AntibotProofOfWorkThreshold int `json:"antibot_proof_of_work_threshold,omitempty"` BalancingMethod string `json:"balancing_method,omitempty"` BlockNotWhitelisted bool `json:"block_not_whitelisted"` BlockTorNetwork bool `json:"block_tor_network"` CacheEnabled bool `json:"cache_enabled"` CacheRevalidate bool `json:"cache_revalidate"` CDN bool `json:"cdn"` ClientMaxBodySize int `json:"client_max_body_size,omitempty"` DiffieHellmanExchange int `json:"diffie_hellman_exchange,omitempty"` EnableOriginSNI bool `json:"enable_origin_sni"` ForwardedForReplacement string `json:"forwarded_for_replacement,omitempty"` HSTS bool `json:"hsts"` HSTSIncludeSubdomains bool `json:"hsts_include_subdomains"` HSTSMaxAge int `json:"hsts_max_age,omitempty"` HSTSPreload bool `json:"hsts_preload"` HTTPOriginPort int `json:"http_origin_port,omitempty"` IgnoreNoCache bool `json:"ignore_nocache"` ImageOptimization bool `json:"image_optimization"` IPv6Active bool `json:"ipv6_active"` LimitAllowedHTTPMethod []string `json:"limit_allowed_http_method,omitempty"` LimitTLSVersion []string `json:"limit_tls_version,omitempty"` LogFormat string `json:"log_format,omitempty"` MonitoringAlertThreshold int `json:"monitoring_alert_threshold,omitempty"` MonitoringContactEMail string `json:"monitoring_contact_email,omitempty"` MonitoringSendAlert bool `json:"monitoring_send_alert"` MyraSSLHeader bool `json:"myra_ssl_header"` NextUpstream []string `json:"next_upstream,omitempty"` OnlyHTTPS bool `json:"only_https"` OriginConnectionHeader string `json:"origin_connection_header,omitempty"` ProxyCacheBypass string `json:"proxy_cache_bypass,omitempty"` ProxyCacheStale []string `json:"proxy_cache_stale,omitempty"` ProxyConnectTimeout int `json:"proxy_connect_timeout,omitempty"` ProxyReadTimeout int `json:"proxy_read_timeout,omitempty"` RequestLimitBlock string `json:"request_limit_block,omitempty"` RequestLimitLevel int `json:"request_limit_level,omitempty"` RequestLimitReport bool `json:"request_limit_report"` RequestLimitReportEMail string `json:"request_limit_report_email,omitempty"` Rewrite bool `json:"rewrite"` SourceProtocol string `json:"source_protocol,omitempty"` Spdy bool `json:"spdy"` SSLOriginPort int `json:"ssl_origin_port,omitempty"` WAFEnable bool `json:"waf_enable"` WAFLevelsEnable []string `json:"waf_levels_enable,omitempty"` WAFPolicy string `json:"waf_policy,omitempty"` }
Settings ...
type UpstreamOptions ¶
type UpstreamOptions struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` Backup bool `json:"backup"` Down bool `json:"down"` FailTimeout int `json:"failTimeout"` MaxFails int `json:"maxFails"` Weight int `json:"weight"` }
UpstreamOptions ...
type Violation ¶
type Violation struct { Path string `json:"path,omitempty"` Message string `json:"message,omitempty"` }
Violation defines a violation VO, returned by the MYRA API
type WAFAction ¶ added in v1.3.0
type WAFAction struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` ForceCustomValues bool `json:"forceCustomValues"` AvailablePhases int `json:"availablePhases"` Name string `json:"name"` Type string `json:"type"` CustomKey string `json:"customKey"` Value string `json:"value"` }
WAFAction ...
type WAFCondition ¶ added in v1.3.0
type WAFCondition struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` ForceCustomValues bool `json:"forceCustomValues"` AvailablePhases int `json:"availablePhases"` Alias string `json:"alias"` Category string `json:"category"` MatchingType string `json:"matchingType"` Name string `json:"name"` Key string `json:"key"` Value string `json:"value"` }
WAFCondition ...
type WAFRule ¶ added in v1.3.0
type WAFRule struct { ID int `json:"id,omitempty"` Created *types.DateTime `json:"created,omitempty"` Modified *types.DateTime `json:"modified,omitempty"` ExpireDate *types.DateTime `json:"expireDate,omitempty"` Name string `json:"name"` Description string `json:"description"` Direction string `json:"direction"` LogIdentifier string `json:"logIdentifier"` RuleType string `json:"ruleType"` SubDomainName string `json:"subDomainName"` Sort int `json:"sort"` Sync bool `json:"sync"` Template bool `json:"template"` ProcessNext bool `json:"processNext"` Enabled bool `json:"enabled"` Actions []*WAFAction `json:"actions"` Conditions []*WAFCondition `json:"conditions"` }
WAFRule ...