github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/bms/v1/flavors/results.go (about) 1 package flavors 2 3 import ( 4 "github.com/chnsz/golangsdk" 5 ) 6 7 // Flavor represent (virtual) hardware configurations for BMS 8 type Flavor struct { 9 // ID is the flavor's unique ID. 10 ID string `json:"id"` 11 // Name is the name of the flavor. 12 Name string `json:"name"` 13 // VCPUs indicates how many (virtual) CPUs are available for this flavor. 14 VCPUs string `json:"vcpus"` 15 // RAM is the amount of memory, measured in MB. 16 RAM int `json:"ram"` 17 // Disk is the amount of root disk, measured in GB. 18 Disk string `json:"disk"` 19 // IsPublic indicates whether the flavor is public. 20 IsPublic bool `json:"os-flavor-access:is_public"` 21 // the shortcut links of the flavor. 22 Links []golangsdk.Link `json:"links"` 23 // the extended fields of the BMS flavor 24 OsExtraSpecs OsExtraSpecs `json:"os_extra_specs"` 25 26 // the following are reserved attributes 27 Swap string `json:"swap"` 28 Ephemeral int `json:"OS-FLV-EXT-DATA:ephemeral"` 29 Disabled bool `json:"OS-FLV-DISABLED:disabled"` 30 RxTxFactor float64 `json:"rxtx_factor"` 31 } 32 33 // OsExtraSpecs os_extra_specs struct 34 type OsExtraSpecs struct { 35 // the resource type corresponding to the flavor. The value is ironic. 36 Type string `json:"resource_type"` 37 // the CPU architecture of the BMS. The value can be: x86_64 and aarch64 38 CPUArch string `json:"capabilities:cpu_arch"` 39 // the type of the BMS flavor in the format of flavor abbreviation. 40 // For example, if the flavor name is physical.o2.medium, the flavor type is o2m. 41 FlavorType string `json:"capabilities:board_type"` 42 // a flavor of the Ironic type. 43 HypervisorType string `json:"capabilities:hypervisor_type"` 44 // whether the BMS flavor supports EVS disks: true/false 45 SupportEvs string `json:"baremetal:__support_evs"` 46 // the boot source of the BMS. The value can be: LocalDisk and Volume 47 BootFrom string `json:"baremetal:extBootType"` 48 // the maximum number of NICs on the BMS 49 NetNum string `json:"baremetal:net_num"` 50 // the physical CPU specifications 51 CPUDetail string `json:"baremetal:cpu_detail"` 52 // the physical memory specifications 53 MemoryDetail string `json:"baremetal:memory_detail"` 54 // the physical disk specifications 55 DiskDetail string `json:"baremetal:disk_detail"` 56 // the physical NIC specifications 57 NetcardDetail string `json:"baremetal:netcard_detail"` 58 // Specifies the status of the BMS flavor. The value can be: normal, abandon, sellout, obt, promotion 59 OperationStatus string `json:"cond:operation:status"` 60 // the BMS flavor status in an AZ. 61 OperationAZ string `json:"cond:operation:az"` 62 } 63 64 // ListResult is the response from a List operation. 65 type ListResult struct { 66 golangsdk.Result 67 } 68 69 // Extract provides access to the list of flavors from the List operation. 70 func (r ListResult) Extract() ([]Flavor, error) { 71 var s struct { 72 Flavors []Flavor `json:"flavors"` 73 } 74 err := r.ExtractInto(&s) 75 return s.Flavors, err 76 }