backups

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete added in v0.5.6

func Delete(c *golangsdk.ServiceClient, backupId string) (err error)

func RestorePITR added in v0.5.8

func RestorePITR(c *golangsdk.ServiceClient, opts RestorePITROpts) (string, error)

func RestoreToNew added in v0.5.6

func RestoreToNew(c *golangsdk.ServiceClient, opts RestoreToNewOpts) (*instances.CreateRds, error)

func Update

func Update(c *golangsdk.ServiceClient, opts UpdateOpts) (err error)

Update accepts a UpdateOpts struct and uses the values to update a Backup.The response code from api is 200

func WaitForBackup added in v0.5.6

func WaitForBackup(c *golangsdk.ServiceClient, instanceID, backupID string, status BackupStatus) error

Types

type Backup added in v0.5.6

type Backup struct {
	// Indicates the backup ID.
	ID string `json:"id"`
	// Indicates the DB instance ID.
	InstanceID string `json:"instance_id"`
	// Indicates the backup name.
	Name string `json:"name"`
	// Indicates the backup description.
	Description string `json:"description"`
	// Indicates the backup type. Value:
	//
	// auto: automated full backup
	// manual: manual full backup
	// fragment: differential full backup
	// incremental: automated incremental backup
	Type string `json:"type"`
	// Indicates the backup size in kB.
	Size int `json:"size"`
	// Indicates a list of self-built Microsoft SQL Server databases that are partially backed up. (Only Microsoft SQL Server support partial backups.)
	Databases []BackupDatabase `json:"databases"`
	// Indicates the backup start time in the "yyyy-mm-ddThh:mm:ssZ" format, where "T" indicates the start time of the time field, and "Z" indicates the time zone offset.
	BeginTime string `json:"begin_time"`
	// Indicates the backup end time.
	// In a full backup, it indicates the full backup end time.
	// In a MySQL incremental backup, it indicates the time when the last transaction in the backup file is submitted.
	// The format is yyyy-mm-ddThh:mm:ssZ. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.
	EndTime string `json:"end_time"`
	// Indicates the database version.
	Datastore instances.Datastore `json:"datastore"`
	// Indicates the backup status. Value:
	//
	// BUILDING: Backup in progress
	// COMPLETED: Backup completed
	// FAILED: Backup failed
	// DELETING: Backup being deleted
	Status BackupStatus `json:"status"`
}

func Create added in v0.5.6

func Create(c *golangsdk.ServiceClient, opts CreateOpts) (*Backup, error)

func List added in v0.5.6

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

type BackupDatabase added in v0.5.6

type BackupDatabase struct {
	// Specifies the names of self-built databases.
	Name string `json:"name"`
}

type BackupPolicy added in v0.5.26

type BackupPolicy struct {
	// Indicates the number of days to retain the backup files.
	KeepDays int `json:"keep_days"`
	// Indicates the backup time window. Automated backups will be triggered during the backup time window.
	// The value must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.
	// The HH value must be 1 greater than the hh value.
	// The values of mm and MM must be the same and must be set to any of the following: 00, 15, 30, or 45.
	StartTime string `json:"start_time,omitempty"`
	// Indicates the backup cycle configuration. Data will be automatically backed up on the selected days every week.
	Period string `json:"period,omitempty"`
}

func ShowBackupPolicy added in v0.5.26

func ShowBackupPolicy(client *golangsdk.ServiceClient, instanceId string) (*BackupPolicy, error)

type BackupStatus added in v0.5.6

type BackupStatus string
const (
	StatusBuilding  BackupStatus = "BUILDING"
	StatusCompleted BackupStatus = "COMPLETED"
	StatusFailed    BackupStatus = "FAILED"
	StatusDeleting  BackupStatus = "DELETING"
	StatusDeleted   BackupStatus = "DELETED"
)

type CreateOpts added in v0.5.6

type CreateOpts struct {
	// Specifies the DB instance ID.
	InstanceID string `json:"instance_id" required:"true"`
	// Specifies the backup name. It must be 4 to 64 characters in length and start with a letter. It is case-sensitive and can contain only letters, digits, hyphens (-), and underscores (_).
	// The backup name must be unique.
	Name string `json:"name" required:"true"`
	// Specifies the backup description. It contains a maximum of 256 characters and cannot contain the following special characters: >!<"&'=
	Description string `json:"description,omitempty"`
	// Specifies a list of self-built Microsoft SQL Server databases that are partially backed up. (Only Microsoft SQL Server support partial backups.)
	Databases []BackupDatabase `json:"databases,omitempty"`
}

type ListOpts added in v0.5.6

type ListOpts struct {
	// Specifies the DB instance ID.
	InstanceID string `q:"instance_id"`
	// Specifies the backup ID.
	BackupID string `q:"backup_id"`
	// Specifies the backup type. Value:
	//
	// auto: automated full backup
	// manual: manual full backup
	// fragment: differential full backup
	// incremental: automated incremental backup
	BackupType string `q:"backup_type"`
	// Specifies the index position. If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value must be a positive number.
	Offset int `q:"offset"`
	// Specifies the number of records to be queried. The default value is 100. The value cannot be a negative number. The minimum value is 1 and the maximum value is 100.
	Limit int `q:"limit"`
	// Specifies the start time for obtaining the backup list. The format of the start time is "yyyy-mm-ddThh:mm:ssZ".
	// T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.
	// NOTE:
	// When begin_time is not empty, end_time is mandatory.
	BeginTime string `q:"begin_time"`
	// Specifies the end time for obtaining the backup list. The format of the end time is "yyyy-mm-ddThh:mm:ssZ" and the end time must be later than the start time.
	// T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset.
	// NOTE:
	// When end_time is not empty, begin_time is mandatory.
	EndTime string `q:"end_time"`
}

type ListRestoreTimesOpts added in v0.5.26

type ListRestoreTimesOpts struct {
	// Specifies the DB instance ID.
	InstanceId string `json:"-"`
	// Specifies the date to be queried. The value is in the yyyy-mm-dd format, and the time zone is UTC.
	Date string `json:"date,omitempty"`
}

type RestorePITROpts added in v0.5.8

type RestorePITROpts struct {
	// Specifies the restoration information.
	Source Source `json:"source"`
	// Specifies the restoration target.
	Target Target `json:"target"`
}

type RestorePoint added in v0.5.6

type RestorePoint struct {
	// Specifies the DB instance ID.
	InstanceID string `json:"instance_id" required:"true"`
	// Specifies the restoration mode. Enumerated values include:
	//
	// backup: indicates restoration from backup files. In this mode, backup_id is mandatory when type is not mandatory.
	// timestamp: indicates point-in-time restoration. In this mode, restore_time is mandatory when type is mandatory.
	Type RestoreType `json:"type" required:"true"`
	// Specifies the ID of the backup used to restore data. This parameter must be specified when the backup file is used for restoration.
	//
	// NOTICE:
	// When type is not mandatory, backup_id is mandatory.
	BackupID string `json:"backup_id,omitempty"`
	// Specifies the time point of data restoration in the UNIX timestamp. The unit is millisecond and the time zone is UTC.
	//
	// NOTICE:
	// When type is mandatory, restore_time is mandatory.
	RestoreTime int `json:"restore_time,omitempty"`
}

type RestoreTime added in v0.5.26

type RestoreTime struct {
	// Indicates the start time of the restoration time range in the UNIX timestamp format. The unit is millisecond and the time zone is UTC.
	StartTime int64 `json:"start_time"`
	// Indicates the end time of the restoration time range in the UNIX timestamp format. The unit is millisecond and the time zone is UTC.
	EndTime int64 `json:"end_time"`
}

func ListRestoreTimes added in v0.5.26

func ListRestoreTimes(client *golangsdk.ServiceClient, opts ListRestoreTimesOpts) ([]RestoreTime, error)

type RestoreToNewOpts added in v0.5.6

type RestoreToNewOpts struct {
	// Specifies the DB instance name.
	// DB instances of the same type can have same names under the same tenant.
	// The value must be 4 to 64 characters in length and start with a letter. It is case-insensitive and can contain only letters, digits, hyphens (-), and underscores (_).
	Name string `json:"name" required:"true"`
	// Specifies the HA configuration parameters, which are used when creating primary/standby DB instances.
	Ha *instances.Ha `json:"ha,omitempty"`
	// Specifies the parameter template ID.
	ConfigurationId string `json:"configuration_id,omitempty"`
	// Specifies the database port information.
	//
	// The MySQL database port ranges from 1024 to 65535 (excluding 12017 and 33071, which are occupied by the RDS system and cannot be used).
	// The PostgreSQL database port ranges from 2100 to 9500.
	// The Microsoft SQL Server database port is 1433 or ranges from 2100 to 9500 (excluding 5355 and 5985).
	// If this parameter is not set, the default value is as follows:
	//
	// For MySQL, the default value is 3306.
	// For PostgreSQL, the default value is 5432.
	// For Microsoft SQL Server, the default value is 1433.
	Port string `json:"port,omitempty"`
	// Specifies the database password.
	// Valid value:
	// The value cannot be empty and should contain 8 to 32 characters, including uppercase and lowercase letters, digits, and the following special characters: ~!@#%^*-_=+?
	// You are advised to enter a strong password to improve security, preventing security risks such as brute force cracking.
	// If provided password will be considered by system as weak, you will receive an error and you should provide stronger password.
	Password string `json:"password" required:"true"`
	// Specifies the advanced backup policy.
	BackupStrategy *instances.BackupStrategy `json:"backup_strategy,omitempty"`
	// Specifies the key ID for disk encryption. The default value is empty.
	DiskEncryptionId string `json:"disk_encryption_id,omitempty"`
	// Specifies the specification code. The value cannot be empty.
	FlavorRef string `json:"flavor_ref" required:"true"`
	// Specifies the volume information.
	Volume *instances.Volume `json:"volume" required:"true"`
	// Specifies the AZ ID. If the DB instance is not a single instance, you need to specify an AZ for each node of the instance and separate the AZs with commas (,). For details, see the example.
	// The value cannot be empty.
	AvailabilityZone string `json:"availability_zone" required:"true"`
	// Specifies the VPC ID. To obtain this parameter value, use either of the following methods:
	//
	// Method 1: Log in to VPC console and view the VPC ID in the VPC details.
	// Method 2: See the "Querying VPCs" section in the Virtual Private Cloud API Reference.
	VpcId string `json:"vpc_id" required:"true"`
	// Specifies the network ID. To obtain this parameter value, use either of the following methods:
	//
	// Method 1: Log in to VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.
	// Method 2: See the "Querying Subnets" section under "APIs" or the "Querying Networks" section under "OpenStack Neutron APIs" in Virtual Private Cloud API Reference.
	SubnetId string `json:"subnet_id" required:"true"`
	// Specifies the floating IP address of a DB instance. To obtain this parameter value, use either of the following methods:
	//
	// Method 1: Log in to VPC console and click the target subnet on the Subnets page. You can view the subnet CIDR block on the displayed page.
	// Method 2: See the "Querying Subnets" section under "APIs" in the Virtual Private Cloud API Reference.
	DataVip string `json:"data_vip,omitempty"`
	// Specifies the security group which the RDS DB instance belongs to. To obtain this parameter value, use either of the following methods:
	//
	// Method 1: Log in to VPC console. Choose Access Control > Security Groups in the navigation pane on the left. On the displayed page, click the target security group. You can view the security group ID on the displayed page.
	// Method 2: See the "Querying Security Groups" section in the Virtual Private Cloud API Reference.
	SecurityGroupId string `json:"security_group_id" required:"true"`
	// Specifies the restoration information.
	RestorePoint RestorePoint `json:"restore_point" required:"true"`
	// This parameter applies only to Microsoft SQL Server DB instances.
	Collation string `json:"collation,omitempty"`
}

type RestoreType added in v0.5.6

type RestoreType string
const (
	TypeBackup    RestoreType = "backup"
	TypeTimestamp RestoreType = "timestamp"
)

type Source added in v0.5.8

type Source struct {
	// Specifies the ID of the backup used to restore data. This parameter must be specified when the backup file is used for restoration.
	BackupID string `json:"backup_id" required:"false"`
	// Specifies the DB instance ID.
	InstanceID string `json:"instance_id" required:"true"`
	// Specifies the time point of data restoration in the UNIX timestamp. The unit is millisecond and the time zone is UTC.
	RestoreTime int64 `json:"restore_time,omitempty"`
	// Specifies the restoration mode. Enumerated values include:
	// backup: indicates using backup files for restoration. In this mode, type is not mandatory and backup_id is mandatory.
	// timestamp: indicates the point-in-time restoration mode. In this mode, type is mandatory and restore_time is no mandatory.
	Type string `json:"type" required:"true"`
}

type Target added in v0.5.8

type Target struct {
	// Specifies the ID of the DB instance to be restored to.
	InstanceID string `json:"instance_id" required:"true"`
}

type UpdateOpts

type UpdateOpts struct {
	InstanceId string `json:"-"`
	// Specifies the number of days to retain the generated backup files.
	// The value range is from 0 to 732. The value 0 indicates that the automated backup policy is disabled. To extend the retention period, contact customer service. Automated backups can be retained for up to 2562 days.
	// NOTICE
	// Once the automated backup policy is disabled, automated backups are no longer created and all incremental backups are deleted immediately. Operations related to the incremental backups, including downloads, replications, restorations, and rebuilds, may fail.
	// Disabling Automated Backup Policy is not allowed for SQL Server Primary/Standby and Cluster instances. So "keep_days" cannot be set to 0 for SQL Server Primary/Standby and Cluster instances.
	KeepDays int `json:"keep_days" required:"true"`
	// Specifies the backup time window. Automated backups will be triggered during the backup time window. This parameter is mandatory except that the automated backup policy is disabled.
	// The value must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.
	// The HH value must be 1 greater than the hh value.
	// The values of mm and MM must be the same and must be set to any of the following: 00, 15, 30, or 45.
	// Example value:
	// 08:15-09:15
	// 23:00-00:00
	StartTime string `json:"start_time,omitempty"`
	// Specifies the backup cycle configuration. Data will be automatically backed up on the selected days every week. This parameter is mandatory except that the automated backup policy is disabled.
	// Value range: The value is digits separated by commas (,), indicating the day of the week and starting from Monday.
	// For example, the value 1,2,3,4 indicates that the backup period is Monday, Tuesday, Wednesday, and Thursday.
	Period string `json:"period,omitempty"`
}

UpdateOpts contains all the values needed to update a Backup.

Jump to

Keyboard shortcuts

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