ddos

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringField = FieldType("str")
	IntField    = FieldType("int")
	BoolField   = FieldType("bool")
)

Variables

This section is empty.

Functions

func CreateProfile

func CreateProfile(c *gcorecloud.ServiceClient, opts CreateProfileOptsBuilder) (r tasks.Result)

CreateProfile accepts a CreateProfileOpts struct and creates a new profile using the values provided.

func DeleteProfile

func DeleteProfile(c *gcorecloud.ServiceClient, profileID int) (r tasks.Result)

DeleteProfile accepts a unique ID and deletes the DDoS protection profile associated with it.

func ExtractProfileIDFromTask

func ExtractProfileIDFromTask(task *tasks.Task) (string, error)

func ExtractProfileTemplatesInto

func ExtractProfileTemplatesInto(r pagination.Page, v interface{}) error

func ExtractProfilesInto

func ExtractProfilesInto(r pagination.Page, v interface{}) error

func ListProfileTemplates

func ListProfileTemplates(c *gcorecloud.ServiceClient) pagination.Pager

func UpdateProfile

func UpdateProfile(c *gcorecloud.ServiceClient, id int, opts UpdateProfileOptsBuilder) (r tasks.Result)

UpdateProfile accepts an UpdateProfileOpts struct and updates a profile with given ID using the values provided.

Types

type AccessStatus

type AccessStatus struct {
	HTTPCode     int    `json:"http_code"`
	IsAccessible bool   `json:"is_accessible"`
	Message      string `json:"message"`
}

AccessStatus represents DDoS Protection service access status

type ActivateProfileOpts

type ActivateProfileOpts struct {
	BGP    bool `json:"bgp"`
	Active bool `json:"active"`
}

func (ActivateProfileOpts) ToActivateProfileMap

func (opts ActivateProfileOpts) ToActivateProfileMap() (map[string]interface{}, error)

ToActivateProfileMap builds a request bode from ActivateProfileOptsBuilder.

type ActivateProfileOptsBuilder

type ActivateProfileOptsBuilder interface {
	ToActivateProfileMap() (map[string]interface{}, error)
}

type CheckRegionCoverageResult

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

CheckRegionCoverageResult represents the result of a get operation. Call its Extract method to interpret it as a region coverage by the DDoS Protection features.

func CheckRegionCoverage

func CheckRegionCoverage(c *gcorecloud.ServiceClient) (r CheckRegionCoverageResult)

CheckRegionCoverage retrieves region coverage by the DDoS protection features

func (CheckRegionCoverageResult) Extract

func (r CheckRegionCoverageResult) Extract() (*RegionCoverage, error)

Extract is a function that accepts a result and extracts an information if provided region can be covered by the Advanced DDoS protection features

func (CheckRegionCoverageResult) ExtractInto

func (r CheckRegionCoverageResult) ExtractInto(v interface{}) error

type CreateProfileOpts

type CreateProfileOpts struct {
	ProfileTemplate     int            `json:"profile_template" required:"true" validate:"required"`
	BaremetalInstanceID string         `json:"bm_instance_id" required:"true" validate:"required"`
	IPAddress           string         `json:"ip_address" required:"true" validate:"required,ip4_addr"`
	Fields              []ProfileField `json:"fields"`
}

func (CreateProfileOpts) ToProfileCreateMap

func (opts CreateProfileOpts) ToProfileCreateMap() (map[string]interface{}, error)

ToProfileCreateMap builds a request body from CreateProfileOpts.

type CreateProfileOptsBuilder

type CreateProfileOptsBuilder interface {
	ToProfileCreateMap() (map[string]interface{}, error)
}

CreateProfileOptsBuilder allows extensions to add additional parameters to the Create request.

type FieldType

type FieldType string

type GetAccessStatusResult

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

GetAccessStatusResult represents the result of a get operation. Call its Extract method to interpret it as a DDoS Protection access status

func GetAccessibility

func GetAccessibility(c *gcorecloud.ServiceClient) (r GetAccessStatusResult)

GetAccessibility retrieves DDoS protection service status

func (GetAccessStatusResult) Extract

func (s GetAccessStatusResult) Extract() (*AccessStatus, error)

Extract is a function that accepts a result and extracts a DDoS Protection access status resource

func (GetAccessStatusResult) ExtractInto

func (s GetAccessStatusResult) ExtractInto(v interface{}) error

type Options

type Options struct {
	Price  string `json:"price"`
	BGP    bool   `json:"bgp"`
	Active bool   `json:"active"`
}

Options represent options of active client DDoS protection profile

type Profile

type Profile struct {
	ID              int            `json:"id"`
	Options         Options        `json:"options"`
	IPAddress       string         `json:"ip_address"`
	Fields          []ProfileField `json:"fields"`
	ProfileTemplate int            `json:"profile_template"`
}

Profile represents active client DDoS protection profile

func ExtractProfiles

func ExtractProfiles(r pagination.Page) ([]Profile, error)

ExtractProfiles accepts a Page struct, specifically a ProfilesPage struct, and extracts the elements into a slice of instance structs. In other words, a generic collection is mapped into a relevant slice.

func ListAllProfiles

func ListAllProfiles(c *gcorecloud.ServiceClient) ([]Profile, error)

ListAllProfiles returns active clients DDoS protection profiles

type ProfileField

type ProfileField struct {
	ID          int       `json:"id,omitempty"`
	Value       string    `json:"value,omitempty" required:"true" validate:"required,max=500"`
	Description string    `json:"description,omitempty"`
	Name        string    `json:"name,omitempty"`
	Required    bool      `json:"required,omitempty"`
	FieldType   FieldType `json:"field_type,omitempty"`
	Default     *string   `json:"default,omitempty"`
	BaseField   int       `json:"base_field,omitempty" required:"true" validate:"required"`
}

ProfileField represent fields of active client DDoS protection profile

type ProfileTaskResult

type ProfileTaskResult struct {
	Profiles []string `json:"ddos_profiles"`
}

type ProfileTemplate

type ProfileTemplate struct {
	Fields      []TemplateField `json:"fields"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	ID          int             `json:"id"`
}

ProfileTemplate represents DDoS protection profile template

func ExtractProfileTemplates

func ExtractProfileTemplates(r pagination.Page) ([]ProfileTemplate, error)

ExtractProfileTemplates accepts a Page struct, specifically a ProfileTemplatesPage struct, and extracts the elements into a slice of instance structs. In other words, a generic collection is mapped into a relevant slice.

func ListAllProfileTemplates

func ListAllProfileTemplates(c *gcorecloud.ServiceClient) ([]ProfileTemplate, error)

ListAllProfileTemplates returns all DDoS protection profile templates

type ProfileTemplatesPage

type ProfileTemplatesPage struct {
	pagination.LinkedPageBase
}

ProfileTemplatesPage is the page returned by a pager when traversing over a collection of profile templates.

func (ProfileTemplatesPage) IsEmpty

func (r ProfileTemplatesPage) IsEmpty() (bool, error)

IsEmpty checks whether a ProfileTemplatesPage struct is empty.

func (ProfileTemplatesPage) NextPageURL

func (r ProfileTemplatesPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of profile templates has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type ProfilesPage

type ProfilesPage struct {
	pagination.LinkedPageBase
}

ProfilesPage is the page returned by a pager when traversing over a collection of profile templates.

func (ProfilesPage) IsEmpty

func (r ProfilesPage) IsEmpty() (bool, error)

IsEmpty checks whether a ProfilesPage struct is empty.

func (ProfilesPage) NextPageURL

func (r ProfilesPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of profiles has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type RegionCoverage

type RegionCoverage struct {
	IsCovered bool `json:"is_covered"`
}

RegionCoverage represents an information about coverage of provided region by the Advanced DDoS protection features

type TemplateField

type TemplateField struct {
	ID          int       `json:"id"`
	Description string    `json:"description"`
	Name        string    `json:"name"`
	Required    bool      `json:"required"`
	FieldType   FieldType `json:"field_type"`
	Default     *string   `json:"default,omitempty"`
}

TemplateField represents additional fields for protection profile template

type UpdateProfileOpts

type UpdateProfileOpts struct {
	ProfileTemplate     int            `json:"profile_template" required:"true" validate:"required"`
	BaremetalInstanceID string         `json:"bm_instance_id" required:"true" validate:"required"`
	IPAddress           string         `json:"ip_address" required:"true" validate:"required,ip4_addr"`
	Fields              []ProfileField `json:"fields"`
}

func (UpdateProfileOpts) ToProfileUpdateMap

func (opts UpdateProfileOpts) ToProfileUpdateMap() (map[string]interface{}, error)

ToProfileUpdateMap builds a request body from UpdateProfileOpts.

type UpdateProfileOptsBuilder

type UpdateProfileOptsBuilder interface {
	ToProfileUpdateMap() (map[string]interface{}, error)
}

UpdateProfileOptsBuilder allows extensions to add additional parameters to the Update request.

Directories

Path Synopsis
ddos unit tests
ddos unit tests

Jump to

Keyboard shortcuts

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