github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/bms/v1/baremetalservers/results.go (about) 1 package baremetalservers 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 ) 6 7 type cloudServerResult struct { 8 golangsdk.Result 9 } 10 11 type Flavor struct { 12 ID string `json:"id"` 13 Name string `json:"name"` 14 Disk string `json:"disk"` 15 Vcpus string `json:"vcpus"` 16 RAM string `json:"ram"` 17 } 18 19 // Image defines a image struct in details of a server. 20 type Image struct { 21 ID string `json:"id"` 22 Name string `json:"name"` 23 Type string `json:"__os_type"` 24 } 25 26 type SysTags struct { 27 Key string `json:"key"` 28 Value string `json:"value"` 29 } 30 31 type OsSchedulerHints struct { 32 DecBaremetal []string `json:"dec_baremetal"` 33 } 34 35 // Metadata is only used for method that requests details on a single server, by ID. 36 // Because metadata struct must be a map. 37 type Metadata struct { 38 ChargingMode string `json:"charging_mode"` 39 OrderID string `json:"metering.order_id"` 40 ProductID string `json:"metering.product_id"` 41 VpcID string `json:"vpc_id"` 42 ImageID string `json:"metering.image_id"` 43 Imagetype string `json:"metering.imagetype"` 44 PortList string `json:"baremetalPortIDList"` 45 Resourcespeccode string `json:"metering.resourcespeccode"` 46 ResourceType string `json:"metering.resourcetype"` 47 ImageName string `json:"image_name"` 48 OpSvcUserId string `json:"op_svc_userid"` 49 OsType string `json:"os_type"` 50 BmsSupportEvs string `json:"__bms_support_evs"` 51 OsBit string `json:"os_bit"` 52 } 53 54 type Address struct { 55 Version string `json:"version"` 56 Addr string `json:"addr"` 57 MacAddr string `json:"OS-EXT-IPS-MAC:mac_addr"` 58 PortID string `json:"OS-EXT-IPS:port_id"` 59 Type string `json:"OS-EXT-IPS:type"` 60 } 61 62 type Fault struct { 63 Message string `json:"message"` 64 Code int `json:"code"` 65 Details string `json:"details"` 66 Created string `json:"created"` 67 } 68 type VolumeAttached struct { 69 ID string `json:"id"` 70 DeleteOnTermination string `json:"delete_on_termination"` 71 BootIndex string `json:"bootIndex"` 72 Device string `json:"device"` 73 } 74 75 type SecurityGroups struct { 76 Name string `json:"name"` 77 ID string `json:"id"` 78 } 79 80 // CloudServer is only used for method that requests details on a single server, by ID. 81 // Because metadata struct must be a map. 82 type CloudServer struct { 83 ID string `json:"id"` 84 UserID string `json:"user_id"` 85 Name string `json:"name"` 86 TenantID string `json:"tenant_id"` 87 HostID string `json:"hostId"` 88 Addresses map[string][]Address `json:"addresses"` 89 KeyName string `json:"key_name"` 90 Image Image `json:"image"` 91 Flavor Flavor `json:"flavor"` 92 SecurityGroups []SecurityGroups `json:"security_groups"` 93 AccessIPv4 string `json:"accessIPv4"` 94 AccessIPv6 string `json:"accessIPv6"` 95 Status string `json:"status"` 96 Progress *int `json:"progress"` 97 ConfigDrive string `json:"config_drive"` 98 Metadata Metadata `json:"metadata"` 99 TaskState string `json:"OS-EXT-STS:task_state"` 100 VMState string `json:"OS-EXT-STS:vm_state"` 101 Host string `json:"OS-EXT-SRV-ATTR:host"` 102 InstanceName string `json:"OS-EXT-SRV-ATTR:instance_name"` 103 PowerState *int `json:"OS-EXT-STS:power_state"` 104 HypervisorHostname string `json:"OS-EXT-SRV-ATTR:hypervisor_hostname"` 105 AvailabilityZone string `json:"OS-EXT-AZ:availability_zone"` 106 DiskConfig string `json:"OS-DCF:diskConfig"` 107 Fault Fault `json:"fault"` 108 VolumeAttached []VolumeAttached `json:"os-extended-volumes:volumes_attached"` 109 Description string `json:"description"` 110 HostStatus string `json:"host_status"` 111 Hostname string `json:"OS-EXT-SRV-ATTR:hostname"` 112 ReservationID string `json:"OS-EXT-SRV-ATTR:reservation_id"` 113 LaunchIndex *int `json:"OS-EXT-SRV-ATTR:launch_index"` 114 KernelID string `json:"OS-EXT-SRV-ATTR:kernel_id"` 115 RamdiskID string `json:"OS-EXT-SRV-ATTR:ramdisk_id"` 116 RootDeviceName string `json:"OS-EXT-SRV-ATTR:root_device_name"` 117 UserData string `json:"OS-EXT-SRV-ATTR:user_data"` 118 Locked *bool `json:"locked"` 119 Tags []string `json:"tags"` 120 OsSchedulerHints OsSchedulerHints `json:"os:scheduler_hints"` 121 EnterpriseProjectID string `json:"enterprise_project_id"` 122 SysTags []SysTags `json:"sys_tags"` 123 } 124 125 // GetResult is the response from a Get operation. Call its Extract 126 // method to interpret it as a Server. 127 type GetResult struct { 128 cloudServerResult 129 } 130 131 type UpdateResult struct { 132 cloudServerResult 133 } 134 135 func (r cloudServerResult) Extract() (*CloudServer, error) { 136 var s struct { 137 Server *CloudServer `json:"server"` 138 } 139 err := r.ExtractInto(&s) 140 return s.Server, err 141 }