Documentation ¶
Index ¶
- func GetStructNestedField(v *Policy, field string, structDriller []string) string
- type AssociateOpts
- type AssociateOptsBuilder
- type AssociateResource
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type DisassociateOpts
- type DisassociateOptsBuilder
- type DisassociateResource
- type FilterStruct
- type ListOpts
- type Policy
- type PolicyPage
- type Resource
- type ResourceResult
- type ResultResources
- type ScheduledPolicy
- type Tag
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
- type UpdateSchedule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssociateOpts ¶
type AssociateOpts struct { //Backup policy ID, to which the resource is to be associated. PolicyID string `json:"backup_policy_id" required:"true"` //Details about the resources to associate with the policy. Resources []AssociateResource `json:"resources" required:"true"` }
AssociateOpts contains the options to associate a resource to a Policy.
func (AssociateOpts) ToPolicyAssociateMap ¶
func (opts AssociateOpts) ToPolicyAssociateMap() (map[string]interface{}, error)
ToPolicyAssociateMap assembles a request body based on the contents of a AssociateOpts.
type AssociateOptsBuilder ¶
AssociateOptsBuilder allows extensions to add additional parameters to the Associate request.
type AssociateResource ¶
type CreateOpts ¶
type CreateOpts struct { //Backup policy name.It cannot start with default. Name string `json:"backup_policy_name" required:"true"` //Details about the scheduling policy ScheduledPolicy ScheduledPolicy `json:"scheduled_policy" required:"true"` // Tags to be configured for the backup policy Tags []Tag `json:"tags,omitempty"` }
CreateOpts contains the options for create a Policy. This object is passed to Create(). For more information about these parameters, please refer to the Policy object, or the volume backup service API v2 documentation
func (CreateOpts) ToPolicyCreateMap ¶
func (opts CreateOpts) ToPolicyCreateMap() (map[string]interface{}, error)
ToPolicyCreateMap assembles a request body based on the contents of a CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
CreateResult represents the result of a create operation.
func Create ¶
func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create will create a new Policy based on the values in CreateOpts. To extract the Policy object from the response, call the Extract method on the CreateResult.
type DeleteResult ¶
type DeleteResult struct {
// contains filtered or unexported fields
}
DeleteResult represents the result of a delete operation.
func Delete ¶
func Delete(c *golangsdk.ServiceClient, policyID string) (r DeleteResult)
Delete will delete the specified backup policy.
type DisassociateOpts ¶
type DisassociateOpts struct { //Disassociate Resources Resources []DisassociateResource `json:"resources" required:"true"` }
DisassociateOpts contains the options disassociate a resource from a Policy.
func (DisassociateOpts) ToPolicyDisassociateMap ¶
func (opts DisassociateOpts) ToPolicyDisassociateMap() (map[string]interface{}, error)
ToPolicyDisassociateMap assembles a request body based on the contents of a DisassociateOpts.
type DisassociateOptsBuilder ¶
type DisassociateOptsBuilder interface {
ToPolicyDisassociateMap() (map[string]interface{}, error)
}
DisassociateOptsBuilder allows extensions to add additional parameters to the Disassociate request.
type DisassociateResource ¶
type DisassociateResource struct { //ResourceID ResourceID string `json:"resource_id" required:"true"` }
type FilterStruct ¶
type ListOpts ¶
type ListOpts struct { //Backup policy ID ID string //Backup policy name Name string //Backup policy status Status string }
ListOpts allows filtering policies
type Policy ¶
type Policy struct { //Backup policy ID ID string `json:"backup_policy_id"` //Backup policy name Name string `json:"backup_policy_name"` //Details about the scheduling policy ScheduledPolicy ScheduledPolicy `json:"scheduled_policy"` //Number of volumes associated with the backup policy ResourceCount int `json:"policy_resource_count"` }
func ExtractPolicies ¶
func ExtractPolicies(r pagination.Page) ([]Policy, error)
ExtractPolicies accepts a Page struct, specifically a PolicyPage struct, and extracts the elements into a slice of Policy structs. In other words, a generic collection is mapped into a relevant slice.
type PolicyPage ¶
type PolicyPage struct {
pagination.LinkedPageBase
}
func (PolicyPage) IsEmpty ¶
func (r PolicyPage) IsEmpty() (bool, error)
IsEmpty returns true if a page contains no Policies results.
func (PolicyPage) NextPageURL ¶
func (r PolicyPage) NextPageURL() (string, error)
NextPageURL uses the response's embedded link reference to navigate to the next page of results.
type Resource ¶
type Resource struct { //Resource ID ResourceID string `json:"resource_id"` //Resource type ResourceType string `json:"resource_type"` //Availability zone to which the resource belongs AvailabilityZone string `json:"availability_zone"` //POD to which the resource belongs Pod string `json:"os_vol_host_attr"` }
type ResourceResult ¶
type ResourceResult struct {
// contains filtered or unexported fields
}
ResourceResult represents the result of a associate/diassociate operation.
func Associate ¶
func Associate(client *golangsdk.ServiceClient, opts AssociateOpts) (r ResourceResult)
Associate will associate a resource tp a backup policy based on the values in AssociateOpts. To extract the associated resources from the response, call the ExtractResource method on the ResourceResult.
func Disassociate ¶
func Disassociate(client *golangsdk.ServiceClient, policyID string, opts DisassociateOpts) (r ResourceResult)
Disassociate will disassociate a resource from a backup policy based on the values in DisassociateOpts. To extract the disassociated resources from the response, call the ExtractResource method on the ResourceResult.
func (ResourceResult) ExtractResource ¶
func (r ResourceResult) ExtractResource() (*ResultResources, error)
ExtractResource will get the Association/disassociation of resources from the ResourceResult
type ResultResources ¶
type ScheduledPolicy ¶
type ScheduledPolicy struct { //Start time of the backup job. StartTime string `json:"start_time" required:"true"` //Backup interval (1 to 14 days) Frequency int `json:"frequency,omitempty"` //Specifies on which days of each week backup jobs are ececuted. WeekFrequency []string `json:"week_frequency,omitempty"` //Number of retained backups, minimum 2. RententionNum int `json:"rentention_num,omitempty"` //Days of retained backups, minimum 2. RententionDay int `json:"rentention_day,omitempty"` //Whether to retain the first backup in the current month, possible values Y or N RemainFirstBackup string `json:"remain_first_backup_of_curMonth" required:"true"` //Backup policy status, ON or OFF Status string `json:"status" required:"true"` }
ScheduledPolicy defines the details about scheduling policy for create
type UpdateOpts ¶
type UpdateOpts struct { //Backup policy name.It cannot start with default. Name string `json:"backup_policy_name,omitempty"` //Details about the scheduling policy ScheduledPolicy UpdateSchedule `json:"scheduled_policy,omitempty"` }
UpdateOpts contains the options for Update a Policy.
func (UpdateOpts) ToPolicyUpdateMap ¶
func (opts UpdateOpts) ToPolicyUpdateMap() (map[string]interface{}, error)
ToPolicyUpdateMap assembles a request body based on the contents of a UpdateOpts.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.
type UpdateResult ¶
type UpdateResult struct {
// contains filtered or unexported fields
}
UpdateResult represents the result of a update operation.
func Update ¶
func Update(c *golangsdk.ServiceClient, policyID string, opts UpdateOptsBuilder) (r UpdateResult)
Update will Update an existing backup Policy based on the values in UpdateOpts.To extract the Policy object from the response, call the Extract method on the UpdateResult.
type UpdateSchedule ¶
type UpdateSchedule struct { //Start time of the backup job. StartTime string `json:"start_time,omitempty"` //Backup interval (1 to 14 days) Frequency int `json:"frequency,omitempty"` //Specifies on which days of each week backup jobs are ececuted. WeekFrequency []string `json:"week_frequency,omitempty"` //Number of retained backups, minimum 2. RententionNum int `json:"rentention_num,omitempty"` //Days of retained backups, minimum 2. RententionDay int `json:"rentention_day,omitempty"` //Number of retained backups, minimum 2. RemainFirstBackup string `json:"remain_first_backup_of_curMonth,omitempty"` //Backup policy status, ON or OFF Status string `json:"status,omitempty"` }
UpdateSchedule defiens the details about scheduling policy for update.