github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/eps/v1/enterpriseprojects/results.go (about) 1 package enterpriseprojects 2 3 import "github.com/chnsz/golangsdk" 4 5 type Project struct { 6 ID string `json:"id"` 7 Name string `json:"name"` 8 Description string `json:"description"` 9 Status int `json:"status"` 10 CreatedAt string `json:"created_at"` 11 UpdatedAt string `json:"updated_at"` 12 Type string `json:"type"` 13 } 14 15 type Projects struct { 16 EnterpriseProjects []Project `json:"enterprise_projects"` 17 TotalCount int `json:"total_count"` 18 } 19 20 type ListResult struct { 21 golangsdk.Result 22 } 23 24 func (r ListResult) Extract() ([]Project, error) { 25 var a struct { 26 EnterpriseProjects []Project `json:"enterprise_projects"` 27 } 28 err := r.Result.ExtractInto(&a) 29 return a.EnterpriseProjects, err 30 } 31 32 type commonResult struct { 33 golangsdk.Result 34 } 35 36 type CreatResult struct { 37 commonResult 38 } 39 40 type GetResult struct { 41 commonResult 42 } 43 44 type UpdateResult struct { 45 commonResult 46 } 47 48 type ActionResult struct { 49 commonResult 50 } 51 52 type MigrateResult struct { 53 commonResult 54 } 55 56 type ResourceResult struct { 57 commonResult 58 } 59 60 type FilterResult struct { 61 Resources []Resource `json:"resources"` 62 Errors []Errors `json:"errors"` 63 TotalCount int32 `json:"total_count"` 64 } 65 66 type Resource struct { 67 EnterpriseProjectId string `json:"enterprise_project_id"` 68 69 ProjectId string `json:"project_id"` 70 71 ProjectName string `json:"project_name"` 72 73 ResourceDetail interface{} `json:"-"` 74 75 ResourceId string `json:"resource_id"` 76 77 ResourceName string `json:"resource_name"` 78 79 ResourceType string `json:"resource_type"` 80 } 81 82 type Errors struct { 83 ErrorCode string `json:"error_code,omitempty"` 84 85 ErrorMsg string `json:"error_msg,omitempty"` 86 87 ProjectId string `json:"project_id,omitempty"` 88 89 ResourceType string `json:"resource_type,omitempty"` 90 } 91 92 func (r commonResult) Extract() (Project, error) { 93 var s struct { 94 EnterpriseProject Project `json:"enterprise_project"` 95 } 96 err := r.ExtractInto(&s) 97 return s.EnterpriseProject, err 98 }