github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/apigw/v2/environments/results.go (about) 1 package environments 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 "github.com/huaweicloud/golangsdk/pagination" 6 ) 7 8 type commonResult struct { 9 golangsdk.Result 10 } 11 12 // CreateResult represents a result of the Create method. 13 type CreateResult struct { 14 commonResult 15 } 16 17 // UpdateResult represents a result of the Update method. 18 type UpdateResult struct { 19 commonResult 20 } 21 22 type Environment struct { 23 // Environment ID. 24 Id string `json:"id"` 25 // Environment name. 26 Name string `json:"name"` 27 // Description. 28 Description string `json:"remark"` 29 // Create time, in RFC-3339 format. 30 CreateTime string `json:"create_time"` 31 } 32 33 func (r commonResult) Extract() (*Environment, error) { 34 var s Environment 35 err := r.ExtractInto(&s) 36 return &s, err 37 } 38 39 // EnvironmentPage represents the response pages of the List method. 40 type EnvironmentPage struct { 41 pagination.SinglePageBase 42 } 43 44 func ExtractEnvironments(r pagination.Page) ([]Environment, error) { 45 var s []Environment 46 err := r.(EnvironmentPage).Result.ExtractIntoSlicePtr(&s, "envs") 47 return s, err 48 } 49 50 // DeleteResult represents a result of the Delete and DeleteVariable method. 51 type DeleteResult struct { 52 golangsdk.ErrResult 53 } 54 55 type VariableResult struct { 56 golangsdk.Result 57 } 58 59 // VariableCreateResult represents a result of the CreateVariable method. 60 type VariableCreateResult struct { 61 VariableResult 62 } 63 64 // VariableGetResult represents a result of the GetVariable operation. 65 type VariableGetResult struct { 66 VariableResult 67 } 68 69 type Variable struct { 70 // Environment variable ID. 71 Id string `json:"id"` 72 // Variable name. 73 Name string `json:"variable_name"` 74 // Variable value. 75 Value string `json:"variable_value"` 76 // API group ID. 77 GroupId string `json:"group_id"` 78 // Environment ID. 79 EnvId string `json:"env_id"` 80 } 81 82 func (r VariableResult) Extract() (*Variable, error) { 83 var s Variable 84 err := r.ExtractInto(&s) 85 return &s, err 86 } 87 88 // VariablePage represents the response pages of the List operation. 89 type VariablePage struct { 90 pagination.SinglePageBase 91 } 92 93 func ExtractVariables(r pagination.Page) ([]Variable, error) { 94 var s []Variable 95 err := r.(VariablePage).Result.ExtractIntoSlicePtr(&s, "variables") 96 return s, err 97 }