Documentation ¶
Index ¶
- Constants
- func ActivateProfile(c *gcorecloud.ServiceClient, id int, opts ActivateProfileOptsBuilder) (r tasks.Result)
- func CreateProfile(c *gcorecloud.ServiceClient, opts CreateProfileOptsBuilder) (r tasks.Result)
- func DeleteProfile(c *gcorecloud.ServiceClient, profileID int) (r tasks.Result)
- func ExtractProfileIDFromTask(task *tasks.Task) (string, error)
- func ExtractProfileTemplatesInto(r pagination.Page, v interface{}) error
- func ExtractProfilesInto(r pagination.Page, v interface{}) error
- func ListProfileTemplates(c *gcorecloud.ServiceClient) pagination.Pager
- func ListProfiles(c *gcorecloud.ServiceClient) pagination.Pager
- func UpdateProfile(c *gcorecloud.ServiceClient, id int, opts UpdateProfileOptsBuilder) (r tasks.Result)
- type AccessStatus
- type ActivateProfileOpts
- type ActivateProfileOptsBuilder
- type CheckRegionCoverageResult
- type CreateProfileOpts
- type CreateProfileOptsBuilder
- type FieldType
- type GetAccessStatusResult
- type Options
- type Profile
- type ProfileField
- type ProfileTaskResult
- type ProfileTemplate
- type ProfileTemplatesPage
- type ProfilesPage
- type Protocol
- type RegionCoverage
- type ResourceType
- type Status
- type TemplateField
- type UpdateProfileOpts
- type UpdateProfileOptsBuilder
Constants ¶
const ( StringField = FieldType("str") IntField = FieldType("int") BoolField = FieldType("bool") )
Variables ¶
This section is empty.
Functions ¶
func ActivateProfile ¶
func ActivateProfile(c *gcorecloud.ServiceClient, id int, opts ActivateProfileOptsBuilder) (r tasks.Result)
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 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 ListProfiles ¶
func ListProfiles(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 ¶
func (ActivateProfileOpts) ToActivateProfileMap ¶
func (opts ActivateProfileOpts) ToActivateProfileMap() (map[string]interface{}, error)
ToActivateProfileMap builds a request bode from ActivateProfileOptsBuilder.
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"` ProfileTemplateName string `json:"profile_template_name,omitempty" validate:"omitempty"` BaremetalInstanceID string `json:"bm_instance_id,omitempty" validate:"omitempty,required_without=ResourceID"` ResourceID string `json:"resource_id,omitempty" validate:"omitempty,required_without=BaremetalInstanceID"` ResourceType ResourceType `json:"resource_type,omitempty" validate:"omitempty,enum"` IPAddress string `json:"ip_address" required:"true" validate:"required,ip4_addr"` Fields []ProfileField `json:"fields" required:"true" validate:"required"` }
func (CreateProfileOpts) ToProfileCreateMap ¶
func (opts CreateProfileOpts) ToProfileCreateMap() (map[string]interface{}, error)
ToProfileCreateMap builds a request body from CreateProfileOpts.
type CreateProfileOptsBuilder ¶
CreateProfileOptsBuilder allows extensions to add additional parameters to the Create request.
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 Profile ¶
type Profile struct { ID int `json:"id"` Options Options `json:"options"` IPAddress string `json:"ip_address"` Site string `json:"site,omitempty" validate:"omitempty,max=50"` Fields []ProfileField `json:"fields"` Protocols []Protocol `json:"protocols"` ProfileTemplate ProfileTemplate `json:"profile_template"` ProfileTemplateDescription string `json:"profile_template_description,omitempty"` Status Status `json:"status,omitempty"` }
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"` Name string `json:"name,omitempty"` FieldType FieldType `json:"field_type,omitempty"` BaseField int `json:"base_field,omitempty" required:"true" validate:"required"` Value string `json:"value,omitempty" required_without:"FieldValue" validate:"required,max=500"` Description string `json:"description,omitempty"` Default string `json:"default,omitempty"` Required bool `json:"required,omitempty"` FieldValue json.RawMessage `json:"field_value,omitempty" required_without:"Value"` ValidationSchema json.RawMessage `json:"validation_schema,omitempty"` }
ProfileField represent fields of active client DDoS protection profile
type ProfileTaskResult ¶
type ProfileTaskResult struct {
Profiles []int `json:"ddos_profiles" mapstructure:"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 ResourceType ¶ added in v0.6.6
type ResourceType string
const ( ResourceTypeInstance ResourceType = "instance" ResourceTypeLoadBalancer ResourceType = "loadbalancer" )
type Status ¶ added in v0.6.4
type Status struct { Status string `json:"status,omitempty"` ErrorDescription string `json:"error_description,omitempty"` }
Status represents the status of DDoS protection profile
type TemplateField ¶
type TemplateField struct { ID int `json:"id"` Name string `json:"name"` FieldType FieldType `json:"field_type"` Required bool `json:"required"` Description string `json:"description"` Default string `json:"default,omitempty"` ValidationSchema json.RawMessage `json:"validation_schema,omitempty"` }
TemplateField represents additional fields for protection profile template
type UpdateProfileOpts ¶
type UpdateProfileOpts struct { ProfileTemplate int `json:"profile_template" required:"true" validate:"required"` ProfileTemplateName string `json:"profile_template_name,omitempty" validate:"omitempty"` BaremetalInstanceID string `json:"bm_instance_id,omitempty" validate:"omitempty,required_without=ResourceID"` ResourceID string `json:"resource_id,omitempty" validate:"omitempty,required_without=BaremetalInstanceID"` ResourceType ResourceType `json:"resource_type,omitempty" validate:"omitempty,enum"` IPAddress string `json:"ip_address" required:"true" validate:"required,ip4_addr"` Fields []ProfileField `json:"fields" required:"true" validate:"required"` }
func (UpdateProfileOpts) ToProfileUpdateMap ¶
func (opts UpdateProfileOpts) ToProfileUpdateMap() (map[string]interface{}, error)
ToProfileUpdateMap builds a request body from UpdateProfileOpts.
type UpdateProfileOptsBuilder ¶
UpdateProfileOptsBuilder allows extensions to add additional parameters to the Update request.