backup

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const ProviderID = "fc4d5750-22e7-4798-8a46-f48f62c4c1da"

Variables

This section is empty.

Functions

func CountBackups added in v0.5.28

func CountBackups(client *golangsdk.ServiceClient, opts CountOpts) (*int, error)

func Delete

func Delete(client *golangsdk.ServiceClient, checkpointID string) (err error)

Delete will delete an existing backup.

Types

type Backup

type Backup struct {
	// Backup record ID
	CheckpointId string `json:"checkpoint_id"`
	// Creation time, for example, 2017-04-18T01:21:52.701973
	CreatedAt string `json:"created_at"`
	// Extension information
	ExtendInfo ExtendInfo `json:"extend_info"`
	// Backup ID
	Id string `json:"id"`
	// Backup name
	Name string `json:"name"`
	// ID of the object to be backed up
	ResourceId string `json:"resource_id"`
	// Backup status. Possible values are waiting_protect, protecting, available, waiting_restore, restoring, error, waiting_delete, deleting, and deleted.
	// Enum:[ waiting_protect, protecting, available, waiting_restore, restoring, error, waiting_delete, deleting,deleted]
	Status string `json:"status"`
	// Modification time, for example, 2017-04-18T01:21:52.701973
	UpdatedAt string `json:"updated_at"`
	// VM metadata
	VMMetadata VMMetadata `json:"backup_data"`
	// Backup description
	Description string `json:"description"`
	// List of backup tags
	// Keys in the tag list must be unique.
	Tags []tags.ResourceTag `json:"tags"`
	// Type of the backup object
	ResourceType string `json:"resource_type"`
}

func ExtractBackups

func ExtractBackups(r pagination.Page) ([]Backup, error)

ExtractBackups accepts a Page struct, specifically a СsbsBackupPage struct, and extracts the elements into a slice of Backup structs. In other words, a generic collection is mapped into a relevant slice.

func Get

func Get(client *golangsdk.ServiceClient, backupID string) (*Backup, error)

Get will get a single backup with specific ID. To extract the Backup object from the response, call the ExtractBackup method on the GetResult.

func List

func List(c *golangsdk.ServiceClient, opts ListOpts) ([]Backup, error)

List returns collection of backups. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type Checkpoint

type Checkpoint struct {
	// Backup status
	// Enum:[ waiting_protect, protecting, available, waiting_restore, restoring, error, waiting_delete, deleting,deleted]
	Status string `json:"status"`
	// Creation time, for example, 2017-04-18T01:21:52.701973
	CreatedAt string `json:"created_at"`
	// Backup record ID
	Id string `json:"id"`
	// Resource diagram, which displays the inclusion relationship between backups and sub-backups
	ResourceGraph string `json:"resource_graph"`
	// Project ID
	ProjectId string `json:"project_id"`
	// Backup plan information
	ProtectionPlan ProtectionPlan `json:"protection_plan"`
	// Additional information
	ExtraInfo interface{} `json:"extra_info"`
}

func Create

func Create(client *golangsdk.ServiceClient, resourceID string, opts CreateOpts) (*Checkpoint, error)

Create will create a new backup based on the values in CreateOpts. To extract the checkpoint object from the response, call the Extract method on the CreateResult.

func ExecBackupPolicy added in v0.5.28

func ExecBackupPolicy(client *golangsdk.ServiceClient, opts CheckpointOpts) (*Checkpoint, error)

type CheckpointOpts added in v0.5.28

type CheckpointOpts struct {
	// Backup policy ID. Refer to the backup policy ID that is returned by the API of 2.2.5 Querying the Backup Policy List.
	PlanId string `json:"plan_id"`
	// Backup parameters
	Parameters CheckpointParam `json:"parameters"`
}

type CheckpointParam added in v0.5.28

type CheckpointParam struct {
	// Whether automatic trigger is enabled
	AutoTrigger bool `json:"auto_trigger"`
	// ID list of resources to be backed up
	Resources []string `json:"resources"`
}

type CountOpts added in v0.5.28

type CountOpts struct {
	// Query based on field status is supported.
	// Value range: waiting_protect, protecting, available, waiting_restore, restoring, error, waiting_delete, deleting, and deleted
	Status string `q:"status"`
	// Whether to query the backup of all tenants. Only administrators can query the backup of all tenants.
	AllTenants string `q:"all_tenants"`
	// Supports query by backup name.
	Name string `q:"name"`
	// AZ-based filtering is supported.
	Az string `q:"az"`
	// Filtering based on the backup object ID is supported.
	ResourceId string `q:"resource_id"`
	// Filtering based on the backup object name is supported.
	ResourceName string `q:"resource_name"`
	// Filtering based on the backup time is supported. This is the backup start time. For example, 2017-04-15T04:25:38
	StartTime string `q:"start_time"`
	// Filtering based on the backup time is supported. This is the backup end time. For example, 2017-04-15T04:25:38
	EndTime string `q:"end_time"`
	// Supports filtering by backup image type. This parameter can be used only when images are created using backups.
	// The image type can be obtained from Image Management Service.
	ImageType string `q:"image_type"`
	// Filtering based on policy_id is supported.
	PolicyId string `q:"policy_id"`
	// Searching based on the VM's IP address is supported.
	Ip string `q:"ip"`
	// Filtering based on checkpoint_id is supported.
	CheckpointId string `q:"checkpoint_id"`
	// Type of the backup object. For example, OS::Nova::Server
	ResourceType string `q:"resource_type"`
}

type CreateOpts

type CreateOpts struct {
	// Backup name. The value consists of 1 to 255 characters and can contain only letters, digits, underscores (_), and hyphens (-).
	BackupName string `json:"backup_name,omitempty"`
	// Backup description. The value consists of 0 to 255 characters and must not contain a greater-than sign (>) or less-than sign (<).
	Description string `json:"description,omitempty"`
	// Entity object type of the backup object
	// The current value is OS::Nova::Server indicating that the backup object is an ECS.
	// If this parameter is not passed, the backup object type defaults to OS::Nova::Server.
	ResourceType string `json:"resource_type,omitempty"`
	// Backup type. Value True indicates incremental backup and value False indicates full backup.
	// For the initial backup, full backup is always adopted, in spite of which value is set.
	Incremental *bool `json:"incremental,omitempty"`
	// Tag list
	// This list cannot be an empty list.
	// The list can contain up to 10 keys.
	// Keys in this list must be unique.
	Tags []tags.ResourceTag `json:"tags,omitempty"`
	// Additional information about the backup object
	ExtraInfo interface{} `json:"extra_info,omitempty"`
}

CreateOpts contains the options for create a Backup. This object is passed to backup.Create().

type ExtendInfo

type ExtendInfo struct {
	// Whether automatic trigger is enabled
	AutoTrigger bool `json:"auto_trigger"`
	// Average rate. The unit is kb/s
	AverageSpeed float32 `json:"average_speed"`
	// The destination region of a backup replication. The default value is empty.
	CopyFrom string `json:"copy_from"`
	// Backup replication status. The default value is na.
	// Possible values are na, waiting_copy, copying, success, and fail.
	CopyStatus string `json:"copy_status"`
	// Error code
	FailCode FailCode `json:"fail_code"`
	// Type of the failed operation
	// Enum: [backup, restore, delete]
	FailOp string `json:"fail_op"`
	// Description of the failure cause
	FailReason string `json:"fail_reason"`
	// Backup type. For example, backup
	ImageType string `json:"image_type"`
	// Whether the backup is an enhanced backup
	Incremental bool `json:"incremental"`
	// Backup progress. The value is an integer ranging from 0 to 100.
	Progress int `json:"progress"`
	// AZ to which the backup resource belongs
	ResourceAz string `json:"resource_az"`
	// Backup object name
	ResourceName string `json:"resource_name"`
	// Type of the backup object. For example, OS::Nova::Server
	ResourceType string `json:"resource_type"`
	// Backup capacity. The unit is MB.
	Size int `json:"size"`
	// Space saving rate
	SpaceSavingRatio float32 `json:"space_saving_ratio"`
	// Volume backup list
	VolumeBackups []VolumeBackup `json:"volume_backups"`
	// Backup completion time, for example, 2017-04-18T01:21:52.701973
	FinishedAt string `json:"finished_at"`
	// Image data. This parameter has a value if an image has been created for the VM.
	OsImagesData []ImagesData `json:"os_images_data"`
	// Job ID
	TaskId string `json:"taskid"`
	// Virtualization type
	// The value is fixed at QEMU.
	HypervisorType string `json:"hypervisor_type"`
	// Restoration mode. Possible values are na, snapshot, and backup.
	// backup: Data is restored from backups of the EVS disks of the server.
	// na: Restoration is not supported.
	SupportedRestoreMode string `json:"supported_restore_mode"`
	// Whether to allow lazyloading for fast restoration
	Supportlld bool `json:"support_lld"`
}

type FailCode

type FailCode struct {
	Code        string `json:"Code"`
	Description string `json:"Description"`
}

type ImagesData added in v0.6.0

type ImagesData struct {
	ImageId string `json:"image_id"`
}

type ListOpts

type ListOpts struct {
	// Query based on field status is supported.
	// Value range: waiting_protect, protecting, available, waiting_restore, restoring, error, waiting_delete, deleting, and deleted
	Status string `q:"status"`
	// Number of resources displayed per page. The value must be a positive integer. The value defaults to 1000.
	Limit string `q:"limit"`
	// ID of the last record displayed on the previous page
	Marker string `q:"marker"`
	// A group of properties separated by commas (,) and sorting directions. The value format is <key1>[:<direction>],
	// <key2>[:<direction>], where the value of direction is asc (in ascending order) or desc (in descending order).
	// If the parameter direction is not specified, the default sorting direction is desc.
	// The value of sort contains a maximum of 255 characters. Enumeration values of the key are as follows:
	// created_at, updated_at, name, status, protected_at, and id.
	Sort string `q:"sort"`
	// Whether to query the backup of all tenants. Only administrators can query the backup of all tenants.
	AllTenants string `q:"all_tenants"`
	// Fuzzy search based on field name is supported.
	Name string `q:"name"`
	// Filtering based on the backup AZ is supported.
	Az string `q:"az"`
	// Filtering based on the backup object ID is supported.
	ResourceId string `q:"resource_id"`
	// Fuzzy search based on the backup object name is supported.
	ResourceName string `q:"resource_name"`
	// Filtering based on the backup start time is supported.
	// For example: 2017-04-18T01:21:52.701973
	StartTime string `q:"start_time"`
	// Filtering based on the backup end time is supported.
	// For example: 2017-04-18T01:21:52.701973
	EndTime string `q:"end_time"`
	// Supports filtering by image type, for example, backup.
	ImageType string `q:"image_type"`
	// Filtering based on policy_id is supported.
	PolicyId string `q:"policy_id"`
	// Offset value, which is a positive integer.
	Offset string `q:"offset"`
	// Filtering based on checkpoint_id is supported.
	CheckpointId string `q:"checkpoint_id"`
	// Type of the backup object. For example, OS::Nova::Server
	ResourceType string `q:"resource_type"`
	// IP address of the server.
	VmIp string `q:"ip"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the attributes you want to see returned. Marker and Limit are used for pagination.

type ProtectionPlan

type ProtectionPlan struct {
	// Backup policy ID
	Id string `json:"id"`
	// Backup policy name
	Name string `json:"name"`
	// Backup object list
	// For details, see Table 2-8.
	BackupResources []СsbsBackupResource `json:"resources"`
}

type VMMetadata

type VMMetadata struct {
	// Name of the AZ where the server is located. If this parameter is left blank, such information about the server has not been obtained.
	RegionName string `json:"__openstack_region_name"`
	// Server type
	// The value is fixed at server (ECSs).
	CloudServiceType string `json:"cloudservicetype"`
	// System disk size corresponding to the server specifications
	Disk int `json:"disk"`
	// Image type
	// The value can be:
	// gold: public image
	// private: private image
	// market: market image
	ImageType string `json:"imagetype"`
	// Memory size of the server, in MB
	Ram int `json:"ram"`
	// CPU cores corresponding to the server
	Vcpus int `json:"vcpus"`
	// Elastic IP address of the server. If this parameter is left blank, such information about the server has not been obtained.
	Eip string `json:"eip"`
	// Internal IP address of the server. If this parameter is left blank, such information about the server has not been obtained.
	PrivateIp string `json:"private_ip"`
}

type VolumeBackup

type VolumeBackup struct {
	// Average rate, in MB/s
	AverageSpeed int `json:"average_speed"`
	// Whether the disk is bootable
	// The value can be true or false.
	Bootable bool `json:"bootable"`
	// Cinder backup ID
	Id string `json:"id"`
	// Backup set type: backup
	// Enum:[ backup]
	ImageType string `json:"image_type"`
	// Whether incremental backup is used
	Incremental bool `json:"incremental"`
	// ID of the snapshot from which the backup is generated
	SnapshotID string `json:"snapshot_id"`
	// EVS disk backup name
	Name string `json:"name"`
	// Accumulated size (MB) of backups
	Size int `json:"size"`
	// Source disk ID
	SourceVolumeId string `json:"source_volume_id"`
	// Source volume size in GB
	SourceVolumeSize int `json:"source_volume_size"`
	// Space saving rate
	SpaceSavingRatio int `json:"space_saving_ratio"`
	// Status
	Status string `json:"status"`
	// Source volume name
	SourceVolumeName string `json:"source_volume_name"`
}

type СsbsBackupPage added in v0.5.2

type СsbsBackupPage struct {
	pagination.LinkedPageBase
}

СsbsBackupPage is the page returned by a pager when traversing over a collection of backups.

func (СsbsBackupPage) IsEmpty added in v0.5.2

func (r СsbsBackupPage) IsEmpty() (bool, error)

IsEmpty checks whether a СsbsBackupPage struct is empty.

func (СsbsBackupPage) NextPageURL added in v0.5.2

func (r СsbsBackupPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of backups 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 СsbsBackupResource added in v0.5.2

type СsbsBackupResource struct {
	// ID of the object to be backed up
	ID string `json:"id"`
	// Entity object type of the backup object. The value is fixed at OS::Nova::Server, indicating that the object type is ECSs.
	Type string `json:"type"`
	// Backup object name
	Name string `json:"name"`
	// Additional information about the backup object
	ExtraInfo interface{} `json:"extra_info"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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