-
Notifications
You must be signed in to change notification settings - Fork 10
/
data_source_volcengine_cen_attach_instances.go
96 lines (92 loc) · 2.82 KB
/
data_source_volcengine_cen_attach_instances.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
92
93
94
95
96
package cen_attach_instance
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
ve "github.com/volcengine/terraform-provider-volcengine/common"
)
func DataSourceVolcengineCenAttachInstances() *schema.Resource {
return &schema.Resource{
Read: dataSourceVolcengineCenInstanceAttachInstances,
Schema: map[string]*schema.Schema{
"cen_id": {
Type: schema.TypeString,
Optional: true,
Description: "A cen ID.",
},
"instance_id": {
Type: schema.TypeString,
Optional: true,
Description: "An instance ID.",
},
"instance_type": {
Type: schema.TypeString,
Optional: true,
Description: "An instance type.",
ValidateFunc: validation.StringInSlice([]string{"VPC", "DCGW"}, false),
},
"instance_region_id": {
Type: schema.TypeString,
Optional: true,
Description: "A region id of instance.",
},
"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 cen attach instance query.",
},
"attach_instances": {
Description: "The collection of cen attach instance query.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"cen_id": {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the cen.",
},
"instance_id": {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the instance.",
},
"instance_owner_id": {
Type: schema.TypeString,
Computed: true,
Description: "The owner ID of the instance.",
},
"instance_type": {
Type: schema.TypeString,
Computed: true,
Description: "The type of the instance.",
},
"instance_region_id": {
Type: schema.TypeString,
Computed: true,
Description: "The region id of the instance.",
},
"status": {
Type: schema.TypeString,
Computed: true,
Description: "The status of the cen attaching instance.",
},
"creation_time": {
Type: schema.TypeString,
Computed: true,
Description: "The create time of the cen attaching instance.",
},
},
},
},
},
}
}
func dataSourceVolcengineCenInstanceAttachInstances(d *schema.ResourceData, meta interface{}) error {
cenAttachInstanceService := NewCenAttachInstanceService(meta.(*ve.SdkClient))
return ve.DefaultDispatcher().Data(cenAttachInstanceService, d, DataSourceVolcengineCenAttachInstances())
}