/
framework_datasource_schema.go
91 lines (84 loc) · 2.55 KB
/
framework_datasource_schema.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package instancetype
import (
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
var priceObjectType = types.ObjectType{
AttrTypes: map[string]attr.Type{
"hourly": types.Float64Type,
"monthly": types.Float64Type,
},
}
var regionPriceObjectType = types.ObjectType{
AttrTypes: map[string]attr.Type{
"id": types.StringType,
"hourly": types.Float64Type,
"monthly": types.Float64Type,
},
}
var backupsObjectType = types.ObjectType{
AttrTypes: map[string]attr.Type{
"price": types.ListType{ElemType: priceObjectType},
"region_prices": types.ListType{ElemType: regionPriceObjectType},
},
}
var addonsObjectType = types.ObjectType{
AttrTypes: map[string]attr.Type{
"backups": types.ListType{ElemType: backupsObjectType},
},
}
var Attributes = map[string]schema.Attribute{
"id": schema.StringAttribute{
Description: "The unique ID assigned to this Instance type.",
Required: true,
},
"label": schema.StringAttribute{
Description: "The Linode Type's label is for display purposes only.",
Computed: true,
Optional: true,
},
"disk": schema.Int64Attribute{
Description: "The Disk size, in MB, of the Linode Type.",
Computed: true,
},
"class": schema.StringAttribute{
Description: "The class of the Linode Type. There are currently three classes of Linodes: nanode, " +
"standard, highmem, dedicated",
Computed: true,
},
"price": schema.ListAttribute{
Description: "Cost in US dollars, broken down into hourly and monthly charges.",
Computed: true,
ElementType: priceObjectType,
},
"addons": schema.ListAttribute{
Description: "Information about the optional Backup service offered for Linodes.",
Computed: true,
ElementType: addonsObjectType,
},
"region_prices": schema.ListAttribute{
Description: "A list of region-specific prices for this plan.",
Computed: true,
ElementType: regionPriceObjectType,
},
"network_out": schema.Int64Attribute{
Description: "The Mbits outbound bandwidth allocation.",
Computed: true,
},
"memory": schema.Int64Attribute{
Description: "Amount of RAM included in this Linode Type.",
Computed: true,
},
"transfer": schema.Int64Attribute{
Description: "The monthly outbound transfer amount, in MB.",
Computed: true,
},
"vcpus": schema.Int64Attribute{
Description: "The number of VCPU cores this Linode Type offers.",
Computed: true,
},
}
var frameworkDatasourceSchema = schema.Schema{
Attributes: Attributes,
}