github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/autoscaling/v1/lifecyclehooks/results.go (about) 1 package lifecyclehooks 2 3 import "github.com/huaweicloud/golangsdk" 4 5 // Hook is a struct that represents the result of API calling. 6 type Hook struct { 7 // The lifecycle hook name. 8 Name string `json:"lifecycle_hook_name"` 9 // The lifecycle hook type: INSTANCE_TERMINATING and INSTANCE_LAUNCHING. 10 Type string `json:"lifecycle_hook_type"` 11 // The default lifecycle hook callback operation: ABANDON and CONTINUE. 12 DefaultResult string `json:"default_result"` 13 // The lifecycle hook timeout duration in the unit of second. 14 Timeout int `json:"default_timeout"` 15 // The unique topic in SMN. 16 NotificationTopicURN string `json:"notification_topic_urn"` 17 // The topic name in SMN. 18 NotificationTopicName string `json:"notification_topic_name"` 19 // The notification message. 20 NotificationMetadata string `json:"notification_metadata"` 21 // The UTC-compliant time when the lifecycle hook is created. 22 CreateTime string `json:"create_time"` 23 } 24 25 type commonResult struct { 26 golangsdk.Result 27 } 28 29 // Extract will deserialize the result to Hook object. 30 func (r commonResult) Extract() (*Hook, error) { 31 var s Hook 32 err := r.Result.ExtractInto(&s) 33 return &s, err 34 } 35 36 type CreateResult struct { 37 commonResult 38 } 39 40 type GetResult struct { 41 commonResult 42 } 43 44 type UpdateResult struct { 45 commonResult 46 } 47 48 type ListResult struct { 49 commonResult 50 } 51 52 // Extract will deserialize the result to Hook array. 53 func (r ListResult) Extract() (*[]Hook, error) { 54 var s struct { 55 // An array of lifecycle hooks. 56 Hooks []Hook `json:"lifecycle_hooks"` 57 } 58 err := r.Result.ExtractInto(&s) 59 return &s.Hooks, err 60 } 61 62 type DeleteResult struct { 63 golangsdk.ErrResult 64 }