4.10.0
This commit is contained in:
336
internal/service/cloudbroker/trunk/schema.go
Normal file
336
internal/service/cloudbroker/trunk/schema.go
Normal file
@@ -0,0 +1,336 @@
|
||||
package trunk
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func resourceTrunkSchemaMake() map[string]*schema.Schema {
|
||||
log.Debugf("resourceTrunkSchemaMake: invoked")
|
||||
return map[string]*schema.Schema{
|
||||
"trunk_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "trunk id",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Name of the trunk",
|
||||
},
|
||||
"trunk_tags": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "List of trunk tags (values between 1-4095)",
|
||||
},
|
||||
"ovs_bridge": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "OVS bridge name",
|
||||
},
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Description of the trunk",
|
||||
},
|
||||
"account_ids": {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of account IDs with access to this trunk",
|
||||
},
|
||||
"native_vlan_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Native VLAN ID",
|
||||
},
|
||||
"enable": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: true,
|
||||
Description: "Whether the trunk should be enabled",
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "GUID",
|
||||
},
|
||||
"mac": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "MAC address",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "if the trunk is enabled",
|
||||
},
|
||||
"created_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was created",
|
||||
},
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who created the trunk",
|
||||
},
|
||||
"updated_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was updated",
|
||||
},
|
||||
"updated_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who updated the trunk",
|
||||
},
|
||||
"deleted_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was updated",
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who updated the trunk",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func dataSourceTrunkSchemaMake() map[string]*schema.Schema {
|
||||
log.Debugf("dataSourceTrunkSchemaMake: invoked")
|
||||
|
||||
res := map[string]*schema.Schema{
|
||||
"trunk_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
Description: "trunk id",
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "GUID",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the trunk",
|
||||
},
|
||||
"mac": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "MAC address",
|
||||
},
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Description of the trunk",
|
||||
},
|
||||
"account_ids": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of account IDs with access to this trunk",
|
||||
},
|
||||
"ovs_bridge": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "OVS bridge name",
|
||||
},
|
||||
"native_vlan_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Native VLAN ID",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "if the trunk is enabled",
|
||||
},
|
||||
"trunk_tags": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "List of trunk tags (values between 1-4095)",
|
||||
},
|
||||
"created_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was created",
|
||||
},
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who created the trunk",
|
||||
},
|
||||
"updated_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was updated",
|
||||
},
|
||||
"updated_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who updated the trunk",
|
||||
},
|
||||
"deleted_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was updated",
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who updated the trunk",
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func dataSourceTrunkListSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"trunk_ids": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "ID of the trunk(s) to filter by",
|
||||
},
|
||||
"account_ids": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "Account access ID(s) to filter by",
|
||||
},
|
||||
"trunk_tags": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Trunk tags to filter by (value between 1-4095)",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page number.",
|
||||
},
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page size.",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "find by status",
|
||||
},
|
||||
"sort_by": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Sort by one of supported fields, format ±<field>",
|
||||
},
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"account_ids": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of account IDs with access to this trunk",
|
||||
},
|
||||
"created_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was created",
|
||||
},
|
||||
"created_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who created the trunk",
|
||||
},
|
||||
"deleted_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was updated",
|
||||
},
|
||||
"deleted_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who updated the trunk",
|
||||
},
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Description of the trunk",
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "GUID",
|
||||
},
|
||||
"id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Trunk ID",
|
||||
},
|
||||
"mac": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "MAC address",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "Name of the trunk",
|
||||
},
|
||||
"native_vlan_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "Native VLAN ID",
|
||||
},
|
||||
"ovs_bridge": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "OVS bridge name",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "if the trunk is enabled",
|
||||
},
|
||||
"trunk_tags": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "List of trunk tags (values between 1-4095)",
|
||||
},
|
||||
"updated_at": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "when the trunk was updated",
|
||||
},
|
||||
"updated_by": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Description: "who updated the trunk",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
Reference in New Issue
Block a user