github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/params/instance_information.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package params 5 6 import "github.com/juju/juju/core/constraints" 7 8 // CloudInstanceTypesConstraints contains a slice of CloudInstanceTypesConstraint. 9 type CloudInstanceTypesConstraints struct { 10 Constraints []CloudInstanceTypesConstraint `json:"constraints"` 11 } 12 13 // CloudInstanceTypesConstraint contains the cloud information and constraints 14 // necessary to query for instance types on a given cloud. 15 type CloudInstanceTypesConstraint struct { 16 // CloudTag is the tag of the cloud for which instances types 17 // should be returned. 18 CloudTag string `json:"cloud-tag"` 19 20 // CloudRegion is the name of the region for which instance 21 // types should be returned. 22 CloudRegion string `json:"region"` 23 24 // Constraints, if specified, contains the constraints to filter 25 // the instance types by. If Constraints is not specified, then 26 // no filtering by constraints will take place: all instance 27 // types supported by the region will be returned. 28 Constraints *constraints.Value `json:"constraints,omitempty"` 29 } 30 31 // ModelInstanceTypesConstraints contains a slice of InstanceTypesConstraint. 32 type ModelInstanceTypesConstraints struct { 33 // Constraints, if specified, contains the constraints to filter 34 // the instance types by. If Constraints is not specified, then 35 // no filtering by constraints will take place: all instance 36 // types supported by the model will be returned. 37 Constraints []ModelInstanceTypesConstraint `json:"constraints"` 38 } 39 40 // ModelInstanceTypesConstraint contains a constraint applied when filtering instance types. 41 type ModelInstanceTypesConstraint struct { 42 // Value, if specified, contains the constraints to filter 43 // the instance types by. If Value is not specified, then 44 // no filtering by constraints will take place: all instance 45 // types supported by the region will be returned. 46 Value *constraints.Value `json:"value,omitempty"` 47 } 48 49 // InstanceTypesResults contains the bulk result of prompting a cloud for its instance types. 50 type InstanceTypesResults struct { 51 Results []InstanceTypesResult `json:"results"` 52 } 53 54 // InstanceTypesResult contains the result of prompting a cloud for its instance types. 55 type InstanceTypesResult struct { 56 InstanceTypes []InstanceType `json:"instance-types,omitempty"` 57 CostUnit string `json:"cost-unit,omitempty"` 58 CostCurrency string `json:"cost-currency,omitempty"` 59 // CostDivisor Will be present only when the Cost is not expressed in CostUnit. 60 CostDivisor uint64 `json:"cost-divisor,omitempty"` 61 Error *Error `json:"error,omitempty"` 62 } 63 64 // InstanceType represents an available instance type in a cloud. 65 type InstanceType struct { 66 Name string `json:"name,omitempty"` 67 Arches []string `json:"arches"` 68 CPUCores int `json:"cpu-cores"` 69 Memory int `json:"memory"` 70 RootDiskSize int `json:"root-disk,omitempty"` 71 VirtType string `json:"virt-type,omitempty"` 72 Deprecated bool `json:"deprecated,omitempty"` 73 Cost int `json:"cost,omitempty"` 74 }