-
Notifications
You must be signed in to change notification settings - Fork 10
/
data_source_volcengine_zones.go
59 lines (54 loc) · 1.47 KB
/
data_source_volcengine_zones.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
package zone
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
ve "github.com/volcengine/terraform-provider-volcengine/common"
)
func DataSourceVolcengineZones() *schema.Resource {
return &schema.Resource{
Read: dataSourceVolcengineZonesRead,
Schema: map[string]*schema.Schema{
"ids": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Set: schema.HashString,
Description: "A list of zone ids.",
},
"output_file": {
Type: schema.TypeString,
Optional: true,
Description: "File name where to save data source results.",
},
"total_count": {
Type: schema.TypeInt,
Computed: true,
Description: "The total count of zone query.",
},
"zones": {
Description: "The collection of zone query.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
Description: "The id of the zone.",
},
"zone_id": {
Type: schema.TypeString,
Computed: true,
Description: "The id of the zone.",
},
},
},
},
},
}
}
func dataSourceVolcengineZonesRead(d *schema.ResourceData, meta interface{}) error {
zoneService := NewZoneService(meta.(*ve.SdkClient))
return ve.DefaultDispatcher().Data(zoneService, d, DataSourceVolcengineZones())
}