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