/
datasource_schema.go
67 lines (64 loc) · 2.34 KB
/
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
package project
import (
"context"
"github.com/equinix/terraform-provider-equinix/internal/framework"
fwtypes "github.com/equinix/terraform-provider-equinix/internal/framework/types"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func dataSourceSchema(ctx context.Context) schema.Schema {
return schema.Schema{
Attributes: map[string]schema.Attribute{
"id": framework.IDAttributeDefaultDescription(),
"name": schema.StringAttribute{
Description: "Name of the connection resource",
Optional: true,
Computed: true,
Validators: []validator.String{
stringvalidator.ExactlyOneOf(path.Expressions{
path.MatchRoot("project_id"),
}...),
},
},
"project_id": schema.StringAttribute{
Description: "ID of project to which the connection belongs",
Optional: true,
Computed: true,
},
"created": schema.StringAttribute{
Description: "The timestamp for when the project was created",
Computed: true,
},
"updated": schema.StringAttribute{
Description: "The timestamp for the last time the project was updated",
Computed: true,
},
"backend_transfer": schema.BoolAttribute{
Description: "Whether Backend Transfer is enabled for this project",
Computed: true,
},
"payment_method_id": schema.StringAttribute{
Description: "The UUID of payment method for this project",
Computed: true,
},
"organization_id": schema.StringAttribute{
Description: "The UUID of this project's parent organization",
Computed: true,
},
"user_ids": schema.ListAttribute{
Description: "List of UUIDs of user accounts which belong to this project",
ElementType: types.StringType,
Computed: true,
},
"bgp_config": schema.ListAttribute{
Description: "Optional BGP settings. Refer to [Equinix Metal guide for BGP](https://metal.equinix.com/developers/docs/networking/local-global-bgp/)",
CustomType: fwtypes.NewListNestedObjectTypeOf[BGPConfigModel](ctx),
ElementType: fwtypes.NewObjectTypeOf[BGPConfigModel](ctx),
Computed: true,
},
},
}
}