github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/backups/ShowBackupPolicy.go (about)

     1  package backups
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func ShowBackupPolicy(client *golangsdk.ServiceClient, instanceId string) (*BackupPolicy, error) {
     9  	// GET https://{Endpoint}/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  	// Indicates the number of days to retain the backup files.
    22  	KeepDays int `json:"keep_days"`
    23  	// Indicates the backup time window. Automated backups will be triggered during the backup time window.
    24  	// The value must be a valid value in the "hh:mm-HH:MM" format. The current time is in the UTC format.
    25  	// The HH value must be 1 greater than the hh value.
    26  	// The values of mm and MM must be the same and must be set to any of the following: 00, 15, 30, or 45.
    27  	StartTime string `json:"start_time,omitempty"`
    28  	// Indicates the backup cycle configuration. Data will be automatically backed up on the selected days every week.
    29  	Period string `json:"period,omitempty"`
    30  }