github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/drs/v2/replicationconsistencygroups/results.go (about) 1 package replicationconsistencygroups 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 "github.com/huaweicloud/golangsdk/pagination" 6 ) 7 8 // ReplicationConsistencyGroupCreateorUpdate response 9 type ReplicationConsistencyGroupCreateorUpdate struct { 10 ID string `json:"id"` 11 Name string `json:"name"` 12 Description string `json:"description"` 13 Status string `json:"status"` 14 PriorityStation string `json:"priority_station"` 15 CreatedAt string `json:"created_at"` 16 UpdatedAt string `json:"updated_at"` 17 } 18 19 // CreateResult is a struct that contains all the return parameters of creation 20 type CreateResult struct { 21 golangsdk.Result 22 } 23 24 // Extract from CreateResult 25 func (r CreateResult) Extract() (*ReplicationConsistencyGroupCreateorUpdate, error) { 26 var s struct { 27 ReplicationConsistencyGroup *ReplicationConsistencyGroupCreateorUpdate `json:"replication_consistency_group"` 28 } 29 err := r.Result.ExtractInto(&s) 30 return s.ReplicationConsistencyGroup, err 31 } 32 33 // DeleteResult is a struct which contains the result of deletion 34 type DeleteResult struct { 35 golangsdk.ErrResult 36 } 37 38 // ReplicationConsistencyGroup response 39 type ReplicationConsistencyGroup struct { 40 ID string `json:"id"` 41 Name string `json:"name"` 42 Description string `json:"description"` 43 Status string `json:"status"` 44 PriorityStation string `json:"priority_station"` 45 ReplicationModel string `json:"replication_model"` 46 ReplicationStatus string `json:"replication_status"` 47 ReplicationIDs []string `json:"replication_ids"` 48 CreatedAt string `json:"created_at"` 49 UpdatedAt string `json:"updated_at"` 50 FailureDetail string `json:"failure_detail"` 51 FaultLevel string `json:"fault_level"` 52 } 53 54 // GetResult contains the body of getting detailed 55 type GetResult struct { 56 golangsdk.Result 57 } 58 59 // Extract from GetResult 60 func (r GetResult) Extract() (*ReplicationConsistencyGroup, error) { 61 var s struct { 62 ReplicationConsistencyGroup *ReplicationConsistencyGroup `json:"replication_consistency_group"` 63 } 64 err := r.Result.ExtractInto(&s) 65 return s.ReplicationConsistencyGroup, err 66 } 67 68 // ReplicationConsistencyGroupPage may be embedded in a Page 69 // that contains all of the results from an operation at once. 70 type ReplicationConsistencyGroupPage struct { 71 pagination.SinglePageBase 72 } 73 74 // IsEmpty returns true if a ListResult contains no replications. 75 func (r ReplicationConsistencyGroupPage) IsEmpty() (bool, error) { 76 rs, err := ExtractReplicationConsistencyGroups(r) 77 return len(rs) == 0, err 78 } 79 80 // ExtractReplicationConsistencyGroups from List 81 func ExtractReplicationConsistencyGroups(r pagination.Page) ([]ReplicationConsistencyGroup, error) { 82 var s struct { 83 ReplicationConsistencyGroups []ReplicationConsistencyGroup `json:"replication_consistency_groups"` 84 } 85 err := (r.(ReplicationConsistencyGroupPage)).ExtractInto(&s) 86 return s.ReplicationConsistencyGroups, err 87 } 88 89 // UpdateResult is a struct from which can get the result of update method 90 type UpdateResult struct { 91 golangsdk.Result 92 } 93 94 // Extract from UpdateResult 95 func (r UpdateResult) Extract() (*ReplicationConsistencyGroupCreateorUpdate, error) { 96 var s struct { 97 ReplicationConsistencyGroup *ReplicationConsistencyGroupCreateorUpdate `json:"replication_consistency_group"` 98 } 99 err := r.Result.ExtractInto(&s) 100 return s.ReplicationConsistencyGroup, err 101 } 102 103 // ActionResult is the result of action operations 104 type ActionResult struct { 105 golangsdk.ErrResult 106 }