github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/apigw/v2/channels/results.go (about) 1 package channels 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 // GetResult represents the result of a create operation. 13 type CreateResult struct { 14 commonResult 15 } 16 17 // UdpateResult represents the result of a update operation. 18 type UpdateResult struct { 19 commonResult 20 } 21 22 // GetResult represents the result of a update operation. 23 type GetResult struct { 24 commonResult 25 } 26 27 type VpcChannel struct { 28 // VPC channel name. 29 // A VPC channel name can contain 3 to 64 characters, starting with a letter. 30 // Only letters, digits, hyphens (-), and underscores (_) are allowed. 31 // Chinese characters must be in UTF-8 or Unicode format. 32 Name string `json:"name"` 33 // VPC channel type. 34 // 1: private network ELB channel (to be deprecated) 35 // 2: fast channel with the load balancing function 36 Type int `json:"type"` 37 // Host port of the VPC channel. 38 // This parameter is valid only when the VPC channel type is set to 2. 39 // This parameter is required if the VPC channel type is set to 2. 40 // The value range is 1–65535. 41 Port int `json:"port"` 42 // Distribution algorithm. 43 // 1: WRR (default) 44 // 2: WLC 45 // 3: SH 46 // 4: URI hashing 47 // This parameter is mandatory if the VPC channel type is set to 2. 48 BalanceStrategy int `json:"balance_strategy"` 49 // Member type of the VPC channel. 50 // ip 51 // ecs (default) 52 // This parameter is required if the VPC channel type is set to 2. 53 MemberType string `json:"member_type"` 54 // Time when the VPC channel is created. 55 CreateTime string `json:"create_time"` 56 // VPC channel ID. 57 Id string `json:"id"` 58 // VPC channel status. 59 // 1: normal 60 // 2: abnormal 61 Status int `json:"status"` 62 // ID of a private network ELB channel. 63 // This parameter is valid only when the VPC channel type is set to 1. 64 ElbId string `json:"elb_id"` 65 // Backend server list. Only one backend server is included if the VPC channel type is set to 1. 66 Members []MemberInfo `json:"members"` 67 // Health check details. 68 VpcHealthConfig VpcHealthConfig `json:"vpc_health_config"` 69 } 70 71 func (r commonResult) Extract() (*VpcChannel, error) { 72 var s VpcChannel 73 err := r.ExtractInto(&s) 74 return &s, err 75 } 76 77 // The ChannelPage represents the result of a List operation. 78 type ChannelPage struct { 79 pagination.SinglePageBase 80 } 81 82 // ExtractChannels its Extract method to interpret it as a channel array. 83 func ExtractChannels(r pagination.Page) ([]VpcChannel, error) { 84 var s []VpcChannel 85 err := r.(ChannelPage).Result.ExtractIntoSlicePtr(&s, "vpc_channels") 86 return s, err 87 } 88 89 type DeleteResult struct { 90 golangsdk.ErrResult 91 } 92 93 type MemberResult struct { 94 golangsdk.Result 95 } 96 97 type AddBackendResult struct { 98 MemberResult 99 } 100 101 type GetBackendResult struct { 102 MemberResult 103 } 104 105 type Member struct { 106 // VPC channel name. 107 // A VPC channel name can contain 3 to 64 characters, starting with a letter. 108 // Only letters, digits, hyphens (-), and underscores (_) are allowed. 109 // Chinese characters must be in UTF-8 or Unicode format. 110 Name string `json:"name"` 111 // VPC channel type. 112 // 1: private network ELB channel (to be deprecated) 113 // 2: fast channel with the load balancing function 114 Type int `json:"type"` 115 // Host port of the VPC channel. 116 // This parameter is valid only when the VPC channel type is set to 2. The value range is 1–65535. 117 // This parameter is required if the VPC channel type is set to 2. 118 Port int `json:"port"` 119 // Distribution algorithm. 120 // 1: WRR (default) 121 // 2: WLC 122 // 3: SH 123 // 4: URI hashing 124 // This parameter is mandatory if the VPC channel type is set to 2. 125 BalanceStrategy int `json:"balance_strategy"` 126 // Member type of the VPC channel. 127 // ip 128 // ecs (default) 129 // This parameter is required if the VPC channel type is set to 2. 130 MemberType string `json:"member_type"` 131 // Time when the VPC channel is created. 132 CreateTime string `json:"create_time"` 133 // VPC channel ID. 134 Id string `json:"id"` 135 // VPC channel status. 136 // 1: normal 137 // 2: abnormal 138 Status int `json:"status"` 139 // ID of a private network ELB channel. 140 // This parameter is valid only when the VPC channel type is set to 1. 141 ElbId string `json:"elb_id"` 142 } 143 144 func (r MemberResult) Extract() ([]Member, error) { 145 var s []Member 146 err := r.ExtractIntoStructPtr(&s, "members") 147 return s, err 148 } 149 150 type RemoveResult struct { 151 golangsdk.ErrResult 152 }