github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/rds/v1/instances/results.go (about)

     1  package instances
     2  
     3  import "github.com/huaweicloud/golangsdk"
     4  
     5  type Instance struct {
     6  	ID               string              `json:"id"`
     7  	Status           string              `json:"status"`
     8  	Name             string              `json:"name"`
     9  	Created          string              `json:"created"`
    10  	HostName         string              `json:"hostname"`
    11  	Type             string              `json:"type"`
    12  	Region           string              `json:"region"`
    13  	Updated          string              `json:"updated"`
    14  	AvailabilityZone string              `json:"availabilityZone"`
    15  	Vpc              string              `json:"vpc"`
    16  	Nics             NicsInfor           `json:"nics"`
    17  	SecurityGroup    SecurityGroupInfor  `json:"securityGroup"`
    18  	Flavor           FlavorInfo          `json:"flavor"`
    19  	Volume           VolumeInfor         `json:"volume"`
    20  	DbPort           int                 `json:"dbPort"`
    21  	DataStore        DataStoreInfo       `json:"dataStoreInfo"`
    22  	ExtendParameters ExtendParamInfo     `json:"extendparam"`
    23  	BackupStrategy   BackupStrategyInfor `json:"backupStrategy"`
    24  	Ha               HaInfor             `json:"ha"`
    25  	SlaveId          string              `json:"slaveId"`
    26  }
    27  
    28  type ExtendParamInfo struct {
    29  	Jobs []Job `json:"jobs"`
    30  }
    31  
    32  type FlavorInfo struct {
    33  	Id string `json:"id"`
    34  }
    35  
    36  type DataStoreInfo struct {
    37  	Type    string `json:"type"`
    38  	Version string `json:"version"`
    39  }
    40  
    41  type VolumeInfor struct {
    42  	Type string `json:"type"`
    43  	Size int    `json:"size"`
    44  }
    45  
    46  type NicsInfor struct {
    47  	SubnetId string `json:"subnetId"`
    48  }
    49  
    50  type SecurityGroupInfor struct {
    51  	Id string `json:"id"`
    52  }
    53  
    54  type BackupStrategyInfor struct {
    55  	StartTime string `json:"startTime"`
    56  	KeepDays  int    `json:"keepDays"`
    57  }
    58  
    59  type HaInfor struct {
    60  	Enable          bool   `json:"enable"`
    61  	ReplicationMode string `json:"replicationMode"`
    62  }
    63  
    64  type Job struct {
    65  	ID string `json:"id"`
    66  }
    67  
    68  // Extract will get the Instance object out of the commonResult object.
    69  func (r commonResult) Extract() (*Instance, error) {
    70  	var s Instance
    71  	err := r.ExtractInto(&s)
    72  	return &s, err
    73  }
    74  
    75  func (r commonResult) ExtractInto(v interface{}) error {
    76  	return r.Result.ExtractIntoStructPtr(v, "instance")
    77  }
    78  
    79  type commonResult struct {
    80  	golangsdk.Result
    81  }
    82  
    83  // CreateResult contains the response body and error from a Create request.
    84  type CreateResult struct {
    85  	commonResult
    86  }
    87  
    88  type UpdateResult struct {
    89  	commonResult
    90  }
    91  
    92  type DeleteResult struct {
    93  	commonResult
    94  }
    95  
    96  type GetResult struct {
    97  	commonResult
    98  }
    99  
   100  type ListResult struct {
   101  	golangsdk.Result
   102  }
   103  
   104  func (lr ListResult) Extract() ([]Instance, error) {
   105  	var a struct {
   106  		Instances []Instance `json:"instances"`
   107  	}
   108  	err := lr.Result.ExtractInto(&a)
   109  	return a.Instances, err
   110  }