yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/bingocloud/host.go (about) 1 // Copyright 2019 Yunion 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package bingocloud 16 17 import ( 18 "time" 19 ) 20 21 type SHost struct { 22 CPUHz string `json:"CpuHz"` 23 ModelId string `json:"ModelId"` 24 MonitorType string `json:"MonitorType"` 25 IpmiMgrEnabled string `json:"IpmiMgrEnabled"` 26 JoinTime time.Time `json:"JoinTime"` 27 IsBareMetal string `json:"isBareMetal"` 28 BmcPwd string `json:"BmcPwd"` 29 Extra string `json:"Extra"` 30 InstanceId string `json:"instanceId"` 31 Manufacturer string `json:"Manufacturer"` 32 BaseBoardSerial string `json:"BaseBoardSerial"` 33 BareMetalHWInfo string `json:"BareMetalHWInfo"` 34 BmcPort string `json:"BmcPort"` 35 CPUCores int `json:"CpuCores"` 36 BmcIP string `json:"BmcIp"` 37 Cabinet string `json:"Cabinet"` 38 Memo string `json:"Memo"` 39 HostIP string `json:"HostIp"` 40 Memory int `json:"Memory"` 41 HostId string `json:"HostId"` 42 CPUKind string `json:"CpuKind"` 43 SystemSerial string `json:"SystemSerial"` 44 InCloud string `json:"InCloud"` 45 Location string `json:"Location"` 46 BmcUser string `json:"BmcUser"` 47 PublicIP string `json:"PublicIp"` 48 Status string `json:"Status"` 49 Room string `json:"Room"` 50 SSHMgrEnabled string `json:"SshMgrEnabled"` 51 BmState string `json:"bmState"` 52 HostName string `json:"HostName"` 53 } 54 55 func (self *SRegion) GetHosts(nextToken string) ([]SHost, string, error) { 56 params := map[string]string{} 57 if len(nextToken) > 0 { 58 params["nextToken"] = nextToken 59 } 60 resp, err := self.invoke("DescribePhysicalHosts", params) 61 if err != nil { 62 return nil, "", err 63 } 64 ret := struct { 65 DescribePhysicalHostsResult struct { 66 PhysicalHostSet []SHost 67 } 68 NextToken string 69 }{} 70 resp.Unmarshal(&ret) 71 return ret.DescribePhysicalHostsResult.PhysicalHostSet, ret.NextToken, nil 72 }