myrasec

package module
v2.33.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 18 Imported by: 4

README

myrasec-go

Go Report Card Go Reference tests

A Go library for interacting with Myra Security API.

Note: This library is under active development. Upcoming changes may break existing functionality. Consider this library as unstable.

Example usage

package main

import (
	"log"
	"os"

	myrasec "github.com/Myra-Security-GmbH/myrasec-go/v2"
)

func main() {
	api, err := myrasec.New(os.Getenv("MYRA_API_KEY"), os.Getenv("MYRA_API_SECRET"))
	if err != nil {
		log.Fatal(err)
	}

	domains, err := api.ListDomains(map[string]string{"pageSize": "100"})
	if err != nil {
		log.Fatal(err)
	}

	for _, d := range domains {
		log.Println(d.Name)
	}
}

Documentation

Documentation

Index

Constants

View Source
const (
	RecordTypeA     = "A"
	RecordTypeAAAA  = "AAAA"
	RecordTypeCNAME = "CNAME"
)
View Source
const (
	ParamPage     = "page"
	ParamPageSize = "pageSize"
	ParamSearch   = "search"
)
View Source
const (
	// APIBaseURL ...
	APIBaseURL = "https://apiv2.myracloud.com/%s"
	// DefaultAPILanguage ...
	DefaultAPILanguage = "en"
	// DefaultAPIUserAgent ...
	DefaultAPIUserAgent = "myrasec-go"
	// DefaultCachingTTL ...
	DefaultCachingTTL = 10
	// DefaultRetryCount ...
	DefaultRetryCount = 1
	// DefaultRetrySleep ...
	DefaultRetrySleep = 0
	// ErrorMsgRateLimitReached ...
	ErrorMsgRateLimitReached = "rate limit reached - too many requests"
)

Variables

View Source
var APILanguages = map[string]bool{
	"en": true,
	"de": true,
}

APILanguages ...

Functions

func BuildCacheKey added in v2.16.0

func BuildCacheKey(req *http.Request) string

BuildCacheKey

func BuildSHA256 added in v2.14.0

func BuildSHA256(str string) string

BuildSHA256 builds the SHA256 for the passed string

func EnsureTrailingDot added in v2.26.0

func EnsureTrailingDot(subdomain string) string

EnsureTrailingDot ensures and returns the passed subdomain with a trailing dot

func IsGeneralDomainName added in v2.26.0

func IsGeneralDomainName(name string) bool

IsGeneralDomainName checks if the passed name starts with ALL- or ALL:

func RemoveTrailingDot added in v2.26.0

func RemoveTrailingDot(subdomain string) string

RemoveTrailingDot removes and returns the trailing dot from the passed subdomain name

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 New

func New(key, secret string) (*API, error)

New returns a new MYRA API Client

func (*API) ClearCache added in v2.18.0

func (api *API) ClearCache(cacheClear *CacheClear, domainId int) (*CacheClear, error)

ClearCache ...

func (*API) CreateBucket added in v2.21.0

func (api *API) CreateBucket(domainName string) (*Bucket, error)

CreateBucket creates a new Bucket for the given domain

func (*API) CreateCacheSetting

func (api *API) CreateCacheSetting(setting *CacheSetting, domainId int, subDomainName string) (*CacheSetting, error)

CreateCacheSetting creates a new cache setting for the passed subdomain (name) using the MYRA API

func (*API) CreateDNSRecord

func (api *API) CreateDNSRecord(record *DNSRecord, domainId int) (*DNSRecord, error)

CreateDNSRecord creates a new DNS record using the MYRA API

func (*API) CreateDomain

func (api *API) CreateDomain(domain *Domain) (*Domain, error)

CreateDomain creates a new domain using the MYRA API

func (*API) CreateErrorPage added in v2.8.0

func (api *API) CreateErrorPage(errorPage *ErrorPage, domainId int) (*ErrorPage, error)

CreateErrorPage creates a new error page using the MYRA API

func (*API) CreateIPFilter

func (api *API) CreateIPFilter(filter *IPFilter, domainId int, subDomainName string) (*IPFilter, error)

CreateIPFilter creates a new ip filter for the passed subdomain (name) using the MYRA API

func (*API) CreateMaintenance added in v2.12.0

func (api *API) CreateMaintenance(maintenance *Maintenance, domainId int, subDomainName string) (*Maintenance, error)

CreateMaintenance creates a new maintenance page for the passed subdomain (name) using the MYRA API

func (*API) CreateMaintenanceTemplate added in v2.19.0

func (api *API) CreateMaintenanceTemplate(template *MaintenanceTemplate, domainId int) (*MaintenanceTemplate, error)

CreateMaintenanceTemplate creates a new maintenance template for the passed domain (id) using the MYRA API

func (*API) CreateRateLimit

func (api *API) CreateRateLimit(ratelimit *RateLimit, domainId int, subDomainName string) (*RateLimit, error)

CreateRateLimit creates a new rate limit setting for the passed subdomain (name) using the MYRA API

func (*API) CreateRedirect

func (api *API) CreateRedirect(redirect *Redirect, domainId int, subDomainName string) (*Redirect, error)

CreateRedirect creates a new redirect for the passed subdomain (name) using the MYRA API

func (*API) CreateSSLCertificate

func (api *API) CreateSSLCertificate(cert *SSLCertificate, domainId int) (*SSLCertificate, error)

CreateSSLCertificate creates a new SSL certificates on the passed domain (ID) using the MYRA API

func (*API) CreateTag added in v2.20.0

func (api *API) CreateTag(tag *Tag) (*Tag, error)

CreateTag creates a new tag using the MYRA API

func (*API) CreateTagCacheSetting added in v2.20.0

func (api *API) CreateTagCacheSetting(setting *CacheSetting, tagId int) (*CacheSetting, error)

CreateTagCacheSetting creates a new cache setting for the passed subdomain (name) using the MYRA API

func (*API) CreateTagRateLimit added in v2.20.0

func (api *API) CreateTagRateLimit(rateLimit *TagRateLimit, tagId int) (*TagRateLimit, error)

CreateTagRateLimit creates a new rate limit for passed tag

func (*API) CreateTagWAFRule added in v2.20.0

func (api *API) CreateTagWAFRule(rule *TagWAFRule, tagId int) (*TagWAFRule, error)

CreateTagWAFRule creates a new tag using the MYRA API

func (*API) CreateWAFRule

func (api *API) CreateWAFRule(rule *WAFRule, domainId int, subDomainName string) (*WAFRule, error)

CreateWAFRule creates a new WAF rule

func (*API) DeleteBucket added in v2.21.0

func (api *API) DeleteBucket(bucket *Bucket, domainName string) (*Bucket, error)

DeleteBucket removes a bucket

func (*API) DeleteCacheSetting

func (api *API) DeleteCacheSetting(setting *CacheSetting, domainId int, subDomainName string) (*CacheSetting, error)

DeleteCacheSetting deletes the passed cache setting using the MYRA API

func (*API) DeleteDNSRecord

func (api *API) DeleteDNSRecord(record *DNSRecord, domainId int) (*DNSRecord, error)

DeleteDNSRecord deletes the passed DNS record using the MYRA API

func (*API) DeleteDomain

func (api *API) DeleteDomain(domain *Domain) (*Domain, error)

DeleteDomain deletes the passed domain using the MYRA API

func (*API) DeleteErrorPage added in v2.8.0

func (api *API) DeleteErrorPage(errorPage *ErrorPage, domainId int) (*ErrorPage, error)

DeleteErrorPage deletes the passed error page using the MYRA API

func (*API) DeleteIPFilter

func (api *API) DeleteIPFilter(filter *IPFilter, domainId int, subDomainName string) (*IPFilter, error)

DeleteIPFilter deletes the passed ip filter using the MYRA API

func (*API) DeleteMaintenance added in v2.12.0

func (api *API) DeleteMaintenance(maintenance *Maintenance, domainId int, subDomainName string) (*Maintenance, error)

DeleteMaintenance deletes the passed maintenance page using the MYRA API

func (*API) DeleteMaintenanceTemplate added in v2.19.0

func (api *API) DeleteMaintenanceTemplate(template *MaintenanceTemplate, domainId int) (*MaintenanceTemplate, error)

DeleteMaintenanceTemplate deletes the passed maintenance template using the MYRA API

func (*API) DeleteRateLimit

func (api *API) DeleteRateLimit(ratelimit *RateLimit, domainId int, subDomainName string) (*RateLimit, error)

DeleteRateLimit deletes the passed rate limit setting using the MYRA API

func (*API) DeleteRedirect

func (api *API) DeleteRedirect(redirect *Redirect, domainId int, subDomainName string) (*Redirect, error)

DeleteRedirect deletes the passed redirect using the MYRA API

func (*API) DeleteSSLCertificate

func (api *API) DeleteSSLCertificate(cert *SSLCertificate, domainId int) (*SSLCertificate, error)

DeleteSSLCertificate "deletes" the passed SSL certificate by removing the assigned subdomains from the certificate using the MYRA API

func (*API) DeleteTag added in v2.20.0

func (api *API) DeleteTag(tag *Tag) (*Tag, error)

DeleteTag deletes the passed tag using the MYRA API

func (*API) DeleteTagCacheSetting added in v2.20.0

func (api *API) DeleteTagCacheSetting(setting *CacheSetting, tagId int) (*CacheSetting, error)

DeleteTagCacheSetting deletes the passed cache setting using the MYRA API

func (*API) DeleteTagRateLimit added in v2.20.0

func (api *API) DeleteTagRateLimit(rateLimit *TagRateLimit, tagId int) (*TagRateLimit, error)

DeleteTagRateLimit deletes a new rate limit for passed tag

func (*API) DeleteTagWAFRule added in v2.20.0

func (api *API) DeleteTagWAFRule(rule *TagWAFRule) (*TagWAFRule, error)

DeleteTagWAFRule deletes the passed tag using the MYRA API

func (*API) DeleteWAFRule

func (api *API) DeleteWAFRule(rule *WAFRule) (*WAFRule, error)

DeleteWAFRule deletes the passed WAF rule

func (*API) DisableCaching added in v2.14.0

func (api *API) DisableCaching()

DisableCaching disables the caching of the response NOTE: The caching feature is still in development and may not work as expected.

func (*API) EnableCaching added in v2.14.0

func (api *API) EnableCaching()

EnableCaching enables the caching of the response. Note: Only GET requests are cached. NOTE: The caching feature is still in development and may not work as expected.

func (*API) FetchDomain added in v2.26.0

func (api *API) FetchDomain(domain string) (*Domain, error)

FetchDomain returns the Domain for the passed domain (name)

func (*API) FetchDomainForSubdomainName added in v2.26.0

func (api *API) FetchDomainForSubdomainName(subdomain string) (*Domain, error)

FetchDomainForSubdomainName returns the Domain for the passed subdomain (name)

func (*API) FetchWAFRule

func (api *API) FetchWAFRule(id int, params map[string]string) (*WAFRule, error)

FetchWAFRule returns a single WAF rule for the given ID

func (*API) GetBucketStatistics added in v2.21.0

func (api *API) GetBucketStatistics(domainName string, bucketName string) (*BucketStatistics, error)

GetBucketStatistics returns statistics for a specific bucket.

func (*API) GetBucketStatus added in v2.21.0

func (api *API) GetBucketStatus(domainName string, bucketName string) (*BucketStatus, error)

GetBucketStatus allows you to get a status for your newly created bucket.

func (*API) GetDNSRecord added in v2.6.0

func (api *API) GetDNSRecord(domainId int, id int) (*DNSRecord, error)

GetDNSRecord returns a single DNS record with/for the given identifier

func (*API) GetDomain added in v2.6.0

func (api *API) GetDomain(id int) (*Domain, error)

GetDomain returns a single domain with/for the given identifier

func (*API) GetErrorPage added in v2.8.0

func (api *API) GetErrorPage(domainId int, pageId int) (*ErrorPage, error)

GetErrorPage returns a single error page with/for the given identifier

func (*API) GetIPFilter added in v2.6.0

func (api *API) GetIPFilter(domainId int, subDomainName string, id int) (*IPFilter, error)

GetIPFilter returns a single ip filter with/for the given identifier

func (*API) GetRedirect added in v2.6.0

func (api *API) GetRedirect(domainId int, subDomainName string, id int) (*Redirect, error)

GetRedirect returns a single redirect with/for the given identifier

func (*API) GetSSLCertificate added in v2.6.0

func (api *API) GetSSLCertificate(domainId int, id int) (*SSLCertificate, error)

GetSSLCertificate returns a single SSL certificate with/for the given identifier

func (*API) GetTag added in v2.20.0

func (api *API) GetTag(id int) (*Tag, error)

GetTag returns a single tag for the given identifier

func (*API) GetTagWAFRule added in v2.20.0

func (api *API) GetTagWAFRule(tagId int, ruleId int) (*TagWAFRule, error)

GetTagWAFRule returns a single tag for the given identifier

func (*API) LinkBucket added in v2.21.0

func (api *API) LinkBucket(link *BucketLink, domainName string) (*BucketLink, error)

LinkBucket links a sub domain to a bucket

func (*API) ListAllSubdomains added in v2.5.0

func (api *API) ListAllSubdomains(params map[string]string) ([]VHost, error)

ListAllSubdomains ...

func (*API) ListAllSubdomainsForDomain added in v2.5.0

func (api *API) ListAllSubdomainsForDomain(domainId int, params map[string]string) ([]VHost, error)

ListAllSubdomainsForDomain ...

func (*API) ListBuckets added in v2.21.0

func (api *API) ListBuckets(domainName string) ([]Bucket, error)

ListBuckets returns a list of all created buckets for the given domain.

func (*API) ListCacheSettings

func (api *API) ListCacheSettings(domainId int, subDomainName string, params map[string]string) ([]CacheSetting, error)

ListCacheSettings returns a slice containing all visible cache settings for a subdomain

func (*API) ListDNSRecords

func (api *API) ListDNSRecords(domainId int, params map[string]string) ([]DNSRecord, error)

ListDNSRecords returns a slice containing all visible DNS records for a domain

func (*API) ListDomains

func (api *API) ListDomains(params map[string]string) ([]Domain, error)

ListDomains returns a slice containing all visible domains

func (*API) ListErrorPages added in v2.8.0

func (api *API) ListErrorPages(domainId int, params map[string]string) ([]ErrorPage, error)

ListErrorPages returns a slice containing all error pages

func (*API) ListFiles added in v2.21.0

func (api *API) ListFiles(fileQuery *FileQuery, domainName string) (string, []File, error)

ListFiles returns a list of files or directories as specified in the *FileQuery parameter

func (*API) ListIPFilters

func (api *API) ListIPFilters(domainId int, subDomainName string, params map[string]string) ([]IPFilter, error)

ListIPFilters returns a slice containing all visible ip filters for a subdomain

func (*API) ListIPRanges

func (api *API) ListIPRanges(params map[string]string) ([]IPRange, error)

ListIPRanges returns a slice containing all ip ranges

func (*API) ListMaintenanceTemplates added in v2.19.0

func (api *API) ListMaintenanceTemplates(domainId int, params map[string]string) ([]MaintenanceTemplate, error)

ListMaintenanceTemplates returns a slice containing all maintenance templates for a domain

func (*API) ListMaintenances added in v2.12.0

func (api *API) ListMaintenances(domainId int, subDomainName string, params map[string]string) ([]Maintenance, error)

ListMaintenances returns a slice containing all maintenance pages for a subdomain

func (*API) ListRateLimits

func (api *API) ListRateLimits(domainId int, subDomainName string, params map[string]string) ([]RateLimit, error)

ListRateLimits returns a slice containing all visible rate limit settings

func (*API) ListRedirects

func (api *API) ListRedirects(domainId int, subDomainName string, params map[string]string) ([]Redirect, error)

ListRedirects returns a slice containing all visible redirects for a subdomain

func (*API) ListSSLCertificates

func (api *API) ListSSLCertificates(domainId int, params map[string]string) ([]SSLCertificate, error)

ListSSLCertificates returns a slice containing all visible SSL certificates for a domain

func (*API) ListSettings

func (api *API) ListSettings(domainId int, subDomainName string, params map[string]string) (*Settings, error)

ListSettings returns a Setting struct containing the settings for the passed subdomain

func (*API) ListSettingsFull added in v2.30.0

func (api *API) ListSettingsFull(domainId int, subDomainName string, params map[string]string) (interface{}, error)

ListSettingsFull returns a Setting struct containing the full hierarchie of the settings

func (*API) ListSslConfigurations added in v2.33.0

func (api *API) ListSslConfigurations() ([]SslConfiguration, error)

func (*API) ListTagCacheSettings added in v2.20.0

func (api *API) ListTagCacheSettings(tagId int, params map[string]string) ([]CacheSetting, error)

ListTagCacheSettings returns a slice containing all visible cache settings for a subdomain

func (*API) ListTagRateLimits added in v2.20.0

func (api *API) ListTagRateLimits(tagId int, params map[string]string) ([]TagRateLimit, error)

ListTagRateLimits returns a slice containing all visible rate limits for a tag

func (*API) ListTagSettings added in v2.20.0

func (api *API) ListTagSettings(tagId int) (*Settings, error)

ListTagSettings returns a Setting struct containing the settings for the passed tag

func (*API) ListTagSettingsMap added in v2.30.2

func (api *API) ListTagSettingsMap(tagId int) (interface{}, error)

func (*API) ListTagWAFRules added in v2.20.0

func (api *API) ListTagWAFRules(tagId int, params map[string]string) ([]TagWAFRule, error)

ListTagWAFRules returns a slice containing all visible tags

func (*API) ListTags added in v2.20.0

func (api *API) ListTags(params map[string]string) ([]Tag, error)

ListTags returns a slice containing all visible tags

func (*API) ListWAFActions

func (api *API) ListWAFActions() ([]WAFAction, error)

ListWAFActions returns a list of available WAF actions

func (*API) ListWAFConditions

func (api *API) ListWAFConditions() ([]WAFCondition, error)

ListWAFConditions returns a list of available WAF conditions

func (*API) ListWAFRules

func (api *API) ListWAFRules(domainId int, params map[string]string) ([]WAFRule, error)

ListWAFRules returns a list of WAF rules.

func (*API) PruneCache added in v2.16.0

func (api *API) PruneCache()

PruneCache

func (*API) QueryStatistics added in v2.23.0

func (api *API) QueryStatistics(query *StatisticQuery) (*Statistics, error)

QueryStatistics function is used to fetch statistical data

func (*API) RemoveFiles added in v2.21.0

func (api *API) RemoveFiles(fileQuery *FileQuery, domainName string) error

RemoveFiles removes the file or directoy as specified in the *FileQuery param

func (*API) RemoveFromCache added in v2.16.0

func (api *API) RemoveFromCache(s string)

RemoveFromCache removes a single element from the cache

func (*API) SetCachingTTL added in v2.14.0

func (api *API) SetCachingTTL(ttl int)

SetCachingTTL sets a ttl value for the caching. You have to first call the EnableCaching function to enable the caching. NOTE: The caching feature is still in development and may not work as expected.

func (*API) SetLanguage

func (api *API) SetLanguage(language string) error

SetLanguage changes the API language.

func (*API) SetMaxRetries added in v2.17.0

func (api *API) SetMaxRetries(n int)

SetMaxRetries sets the maxRetries value in the API struct. In case of a non-successfull request, it will try (in total) n times.

func (*API) SetProxy added in v2.25.0

func (api *API) SetProxy(proxyURL string) error

SetProxy allows to set a custom proxyURL for the api client.

func (*API) SetRetrySleep added in v2.17.0

func (api *API) SetRetrySleep(n int)

SetRetrySleep sets a sleep value. It will wait for n-seconds to do the request again in case of retry operation.

func (*API) SetUserAgent

func (api *API) SetUserAgent(userAgent string)

SetUserAgent sets the User-Agent for the API.

func (*API) UnlinkBucket added in v2.21.0

func (api *API) UnlinkBucket(link *BucketLink, domainName string) (*BucketLink, error)

UnlinkBucket unlinks a sub domain from a bucket

func (*API) UpdateCacheSetting

func (api *API) UpdateCacheSetting(setting *CacheSetting, domainId int, subDomainName string) (*CacheSetting, error)

UpdateCacheSetting updates the passed cache setting using the MYRA API

func (*API) UpdateDNSRecord

func (api *API) UpdateDNSRecord(record *DNSRecord, domainId int) (*DNSRecord, error)

UpdateDNSRecord updates the passed DNS record using the MYRA API

func (*API) UpdateDomain

func (api *API) UpdateDomain(domain *Domain) (*Domain, error)

UpdateDomain updates the passed domain using the MYRA API

func (*API) UpdateErrorPage added in v2.8.0

func (api *API) UpdateErrorPage(errorPage *ErrorPage, domainId int) (*ErrorPage, error)

UpdateErrorPage updates the passed error page using the MYRA API

func (*API) UpdateIPFilter

func (api *API) UpdateIPFilter(filter *IPFilter, domainId int, subDomainName string) (*IPFilter, error)

UpdateIPFilter updates the passed ip filter using the MYRA API

func (*API) UpdateMaintenance added in v2.12.0

func (api *API) UpdateMaintenance(maintenance *Maintenance, domainId int, subDomainName string) (*Maintenance, error)

UpdateMaintenance updates the passed maintenance page using the MYRA API

func (*API) UpdateMaintenanceTemplate added in v2.19.0

func (api *API) UpdateMaintenanceTemplate(template *MaintenanceTemplate, domainId int) (*MaintenanceTemplate, error)

UpdateMaintenanceTemplate updates the passed maintenance template using the MYRA API

func (*API) UpdateRateLimit

func (api *API) UpdateRateLimit(ratelimit *RateLimit, domainId int, subDomainName string) (*RateLimit, error)

UpdateRateLimit updates the passed rate limit setting using the MYRA API

func (*API) UpdateRedirect

func (api *API) UpdateRedirect(redirect *Redirect, domainId int, subDomainName string) (*Redirect, error)

UpdateRedirect updates the passed redirect using the MYRA API

func (*API) UpdateSSLCertificate

func (api *API) UpdateSSLCertificate(cert *SSLCertificate, domainId int) (*SSLCertificate, error)

UpdateSSLCertificate updates the passed SSL certificate using the MYRA API

func (*API) UpdateSettings

func (api *API) UpdateSettings(settings *Settings, domainId int, subDomainName string) (*Settings, error)

UpdateSettings updates the passed settings using the MYRA API Deprecated: this method uses myra-api settings in a wrong way, please use UpdateSettingsPartial instead

func (*API) UpdateSettingsPartial added in v2.29.0

func (api *API) UpdateSettingsPartial(settings map[string]interface{}, domainId int, subDomainName string) (interface{}, error)

UpdateSettingsPartial updates the passed settings using the MYRA API

func (*API) UpdateTag added in v2.20.0

func (api *API) UpdateTag(tag *Tag) (*Tag, error)

UpdateTag updates the passed tag using the MYRA API

func (*API) UpdateTagCacheSetting added in v2.20.0

func (api *API) UpdateTagCacheSetting(setting *CacheSetting, tagId int) (*CacheSetting, error)

UpdateTagCacheSetting updates the passed cache setting using the MYRA API

func (*API) UpdateTagRateLimit added in v2.20.0

func (api *API) UpdateTagRateLimit(rateLimit *TagRateLimit, tagId int) (*TagRateLimit, error)

UpdateTagRateLimit updates a new rate limit for passed tag

func (*API) UpdateTagSettings added in v2.20.0

func (api *API) UpdateTagSettings(settings *Settings, tagId int) (*Settings, error)

UpdateTagSettings updates the passed settings using the MYRA API

func (*API) UpdateTagSettingsPartial added in v2.29.0

func (api *API) UpdateTagSettingsPartial(settings map[string]interface{}, tagId int) (interface{}, error)

UpdateTagSettings updates the passed settings using the MYRA API

func (*API) UpdateTagWAFRule added in v2.20.0

func (api *API) UpdateTagWAFRule(rule *TagWAFRule) (*TagWAFRule, error)

UpdateTagWAFRule updates the passed tag using the MYRA API

func (*API) UpdateWAFRule

func (api *API) UpdateWAFRule(rule *WAFRule, domainId int, subDomainName string) (*WAFRule, error)

UpdateWAFRule updates the passed WAF rule

func (*API) UploadArchive added in v2.21.0

func (api *API) UploadArchive(file *os.File, domainName string, bucketName string, path string) error

UploadArchive uploads an archive to the CDN. The uploaded archive is extracted to the given filepath.

func (*API) UploadFile added in v2.21.0

func (api *API) UploadFile(file *os.File, domainName string, bucketName string, path string) error

UploadFile uploads a file to the CDN

type APIMethod

type APIMethod struct {
	BaseURL            string
	Name               string
	Action             string
	Method             string
	Result             interface{}
	AdditionalHeaders  map[string]string
	ResponseDecodeFunc func(resp *http.Response, definition APIMethod) (interface{}, error)
}

APIMethod represents API call definitions used in the methods map

type Bucket added in v2.21.0

type Bucket struct {
	Name          string   `json:"bucket"`
	LinkedDomains []string `json:"linkedDomains"`
}

Bucket ...

type BucketLink struct {
	Bucket        string `json:"bucket"`
	SubDomainName string `json:"subDomainName"`
}

BucketLink ...

type BucketStatistics added in v2.21.0

type BucketStatistics struct {
	Files       int   `json:"files"`
	Folders     int   `json:"folders"`
	StorageSize int64 `json:"storageSize"`
	ContentSize int64 `json:"contentSize"`
}

BucketStatistics ...

type BucketStatus added in v2.21.0

type BucketStatus struct {
	Status     string `json:"status"`
	StatusCode int    `json:"statusCode"`
}

BucketStatus ...

type CacheClear added in v2.18.0

type CacheClear struct {
	FQDN      string `json:"fqdn,omitempty"`
	Resource  string `json:"resource"`
	Recursive bool   `json:"recursive"`
}

CacheClear ...

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

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"`
}

Certificate strict ...

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 ...

func (DNSRecord) CanBeProtected added in v2.27.0

func (rec DNSRecord) CanBeProtected() bool

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"`
	Reversed    bool            `json:"reversed"`
}

Domain ...

type ErrorPage added in v2.8.0

type ErrorPage struct {
	ID            int             `json:"id,omitempty"`
	Created       *types.DateTime `json:"created,omitempty"`
	Modified      *types.DateTime `json:"modified,omitempty"`
	ErrorCode     int             `json:"errorCode,omitempty"`
	Content       string          `json:"content,omitempty"`
	SubDomainName string          `json:"subDomainName,omitempty"`
}

ErrorPage

type File added in v2.21.0

type File struct {
	Type        int             `json:"type"`
	Path        string          `json:"path"`
	Basename    string          `json:"basename"`
	Size        int             `json:"size"`
	Hash        string          `json:"hash"`
	Modified    *types.DateTime `json:"modified"`
	ContentType string          `json:"contentType"`
}

File ...

type FileQuery added in v2.21.0

type FileQuery struct {
	Bucket string `json:"bucket,omitempty"`
	Path   string `json:"path,omitempty"`
	Limit  int    `json:"limit,omitempty"`
	Type   int    `json:"type,omitempty"`
	Cursor string `json:"cursor,omitempty"`
}

FileQuery ...

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"`
	SubDomainName string          `json:"subDomainName"`
}

IPFilter ...

type IPRange

type IPRange struct {
	ID        int             `json:"id,omitempty"`
	Created   *types.DateTime `json:"created,omitempty"`
	Modified  *types.DateTime `json:"modified,omitempty"`
	Network   string          `json:"network"`
	ValidFrom *types.DateTime `json:"validFrom,omitempty"`
	ValidTo   *types.DateTime `json:"validTo,omitempty"`
	Enabled   bool            `json:"enabled"`
	Comment   string          `json:"comment,omitempty"`
}

IPRange ...

type Maintenance added in v2.12.0

type Maintenance struct {
	ID          int             `json:"id,omitempty"`
	Created     *types.DateTime `json:"created,omitempty"`
	Modified    *types.DateTime `json:"modified,omitempty"`
	Start       *types.DateTime `json:"start,omitempty"`
	End         *types.DateTime `json:"end,omitempty"`
	Active      bool            `json:"active"`
	Content     string          `json:"content"`
	ContentFrom string          `json:"contentFrom,omitempty"`
	FQDN        string          `json:"fqdn"`
}

Maintenance ...

type MaintenanceTemplate added in v2.19.0

type MaintenanceTemplate struct {
	ID       int             `json:"id,omitempty"`
	Created  *types.DateTime `json:"created,omitempty"`
	Modified *types.DateTime `json:"modified,omitempty"`
	Name     string          `json:"name"`
	Content  string          `json:"content"`
}

MaintenanceTemplate ...

type RateLimit

type RateLimit struct {
	ID            int             `json:"id,omitempty"`
	Created       *types.DateTime `json:"created,omitempty"`
	Modified      *types.DateTime `json:"modified,omitempty"`
	Network       string          `json:"network"`
	SubDomainName string          `json:"subDomainName"`
	Type          string          `json:"type"`
	Burst         int             `json:"burst"`
	Timeframe     int             `json:"timeframe"`
	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"`
	MatchingType  string          `json:"matchingType"`
	Comment       string          `json:"comment,omitempty"`
	Sort          int             `json:"sort,omitempty"`
	Enabled       bool            `json:"enabled"`
	ExpertMode    bool            `json:"expertMode,omitempty"`
}

Redirect ...

type Response

type Response struct {
	Error         bool          `json:"error,omitempty"`
	ViolationList []*Violation  `json:"violationList,omitempty"`
	ErrorMessage  string        `json:"errorMessage,omitempty"`
	WarningList   []*Warning    `json:"warningList,omitempty"`
	TargetObject  []interface{} `json:"targetObject,omitempty"`
	Data          []interface{} `json:"data,omitempty"`
	List          []interface{} `json:"list,omitempty"`
	Result        []interface{} `json:"result,omitempty"`
	Page          int           `json:"page,omitempty"`
	Count         int           `json:"count,omitempty"`
	PageSize      int           `json:"pageSize,omitempty"`
	Domain        []interface{} `json:"domain,omitempty"`
}

Response defines a response, returned by the MYRA API

type SSLCertificate

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"`
	CertToRefresh        int               `json:"certToRefresh,omitempty"`
	SslConfigurationName string            `json:"sslConfigurationName,omitempty"`
}

SSLCertificate struct ...

type SSLIntermediate

type SSLIntermediate struct {
	*Certificate
	Issuer string `json:"issuer"`
}

SSLIntermediate struct ...

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"`
	CookieName                  string   `json:"cookie_name,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"`
	MyraSSLCertificate          []string `json:"myra_ssl_certificate"`
	MyraSSLCertificateKey       []string `json:"myra_ssl_certificate_key"`
	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"`
	ProxyHostHeader             *string  `json:"host_header"`
}

Settings ...

type SslConfiguration added in v2.33.0

type SslConfiguration struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	Ciphers   string `json:"ciphers"`
	Protocols string `json:"protocols"`
}

type StatisticQuery added in v2.23.0

type StatisticQuery struct {
	AggregationInterval string                       `json:"aggregationInterval"`
	DataSources         map[string]map[string]string `json:"dataSources"`
	StartDate           *types.DateTime              `json:"startDate"`
	EndDate             *types.DateTime              `json:"endDate"`
	FQDN                []string                     `json:"fqdn"`
	Type                string                       `json:"type"`
}

StatisticQuery struct is used to specify the query for the statistical data

type Statistics added in v2.23.0

type Statistics struct {
	Query  *StatisticQuery        `json:"query"`
	Result map[string]interface{} `json:"result,omitempty"`
}

Statistics struct contains the statistical data (Result)

type Tag added in v2.20.0

type Tag struct {
	ID           int             `json:"id,omitempty"`
	Created      *types.DateTime `json:"created,omitempty"`
	Modified     *types.DateTime `json:"modified,omitempty"`
	Name         string          `json:"name"`
	Type         string          `json:"type"`
	Organization int             `json:"organization"`
	Assignments  []TagAssignment `json:"assignments"`
}

Tag ...

type TagAssignment added in v2.20.0

type TagAssignment struct {
	ID            int             `json:"id,omitempty"`
	Created       *types.DateTime `json:"created,omitempty"`
	Modified      *types.DateTime `json:"modified,omitempty"`
	Type          string          `json:"type"`
	Title         string          `json:"title"`
	SubDomainName string          `json:"subDomainName"`
}

TagAssignment ...

type TagRateLimit added in v2.20.0

type TagRateLimit struct {
	ID        int             `json:"id,omitempty"`
	Created   *types.DateTime `json:"created,omitempty"`
	Modified  *types.DateTime `json:"modified,omitempty"`
	Network   string          `json:"network"`
	TagId     int             `json:"tagId"`
	Type      string          `json:"type"`
	Burst     int             `json:"burst"`
	Timeframe int             `json:"timeframe"`
	Value     int             `json:"value"`
}

TagRateLimit ...

type TagWAFRule added in v2.20.0

type TagWAFRule 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"`
	Sort          int             `json:"sort"`
	Sync          bool            `json:"sync"`
	ProcessNext   bool            `json:"processNext"`
	Enabled       bool            `json:"enabled"`
	Actions       []*WAFAction    `json:"actions"`
	Conditions    []*WAFCondition `json:"conditions"`
	TagId         int             `json:"tagId"`
}

TagWAFRule ...

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 string          `json:"failTimeout"`
	MaxFails    int             `json:"maxFails"`
	Weight      int             `json:"weight"`
}

UpstreamOptions ...

type VHost added in v2.5.0

type VHost struct {
	ID         int    `json:"id,omitempty"`
	Label      string `json:"label,omitempty"`
	Value      string `json:"value,omitempty"`
	DomainName string `json:"domainName,omitempty"`
	Access     bool   `json:"access"`
	Paused     bool   `json:"paused"`
}

VHost ...

type Violation

type Violation struct {
	Path    string `json:"propertypath,omitempty"`
	Message string `json:"message,omitempty"`
}

Violation defines a violation VO, returned by the MYRA API

type WAFAction

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

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

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 ...

type Warning

type Warning struct {
	Path    string `json:"path,omitempty"`
	Message string `json:"message,omitempty"`
}

Warning defines a warning VO, returned by the MYRA API

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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