github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/gaussdb/v3/backup/GetPolicy.go (about)

     1  package backup
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func GetPolicy(client *golangsdk.ServiceClient, instanceId string) (*BackupPolicy, error) {
     9  	// GET https://{Endpoint}/mysql/v3/{project_id}/instances/{instance_id}/backups/policy
    10  	raw, err := client.Get(client.ServiceURL("instances", instanceId, "backups", "policy"), nil, nil)
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	var res BackupPolicy
    16  	err = extract.IntoStructPtr(raw.Body, &res, "backup_policy")
    17  	return &res, err
    18  }
    19  
    20  type BackupPolicy struct {
    21  	// Backup retention days
    22  	KeepDays int32 `json:"keep_days"`
    23  	// Backup time window. The creation of an automated backup will be triggered during the backup time window.
    24  	StartTime string `json:"start_time"`
    25  	// Backup cycle configuration. Data will be automatically backed up on the selected days every week.
    26  	Period string `json:"period"`
    27  	// Number of retained level-1 backups. This parameter is returned when level-1 backup is enabled
    28  	RetentionNumBackupLevel1 int32 `json:"retention_num_backup_level1"`
    29  }