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

     1  package protectedinstances
     2  
     3  import (
     4  	"github.com/huaweicloud/golangsdk"
     5  )
     6  
     7  type Instance struct {
     8  	//Instance ID
     9  	Id string `json:"id"`
    10  	//Instance Name
    11  	Name string `json:"name"`
    12  	//Instance Description
    13  	Description string `json:"description"`
    14  	//Protection Group ID
    15  	GroupID string `json:"server_group_id"`
    16  	//Instance Status
    17  	Status string `json:"status"`
    18  	//Source Server
    19  	SourceServer string `json:"source_server"`
    20  	//Target Server
    21  	TargetServer string `json:"target_server"`
    22  	//Attachment
    23  	Attachment []Attachment `json:"attachment"`
    24  }
    25  
    26  type Attachment struct {
    27  	//Replication ID
    28  	Replication string `json:"replication"`
    29  	//Device Name
    30  	Device string `json:"device"`
    31  }
    32  
    33  type commonResult struct {
    34  	golangsdk.Result
    35  }
    36  
    37  // Extract is a function that accepts a result and extracts a instance.
    38  func (r commonResult) Extract() (*Instance, error) {
    39  	var response Instance
    40  	err := r.ExtractInto(&response)
    41  	return &response, err
    42  }
    43  
    44  func (r commonResult) ExtractInto(v interface{}) error {
    45  	return r.Result.ExtractIntoStructPtr(v, "protected_instance")
    46  }
    47  
    48  // UpdateResult represents the result of a update operation. Call its Extract
    49  // method to interpret it as a Instance.
    50  type UpdateResult struct {
    51  	commonResult
    52  }
    53  
    54  // GetResult represents the result of a get operation. Call its Extract
    55  // method to interpret it as a Instance.
    56  type GetResult struct {
    57  	commonResult
    58  }