This commit is contained in:
2026-06-02 11:28:16 +03:00
parent af79f6ab3e
commit c734dcfff7
254 changed files with 10439 additions and 3751 deletions

View File

@@ -5,6 +5,98 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
func l2ExternalNetworkSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
},
"display_name": {
Type: schema.TypeString,
Computed: true,
},
"description": {
Type: schema.TypeString,
Computed: true,
},
"bridge_network_name": {
Type: schema.TypeString,
Computed: true,
},
"hypervisors": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"vlan_tag": {
Type: schema.TypeInt,
Computed: true,
},
"version_id": {
Type: schema.TypeInt,
Computed: true,
},
"created_at": {
Type: schema.TypeString,
Computed: true,
},
"created_by": {
Type: schema.TypeString,
Computed: true,
},
"updated_at": {
Type: schema.TypeString,
Computed: true,
},
"updated_by": {
Type: schema.TypeString,
Computed: true,
},
}
}
func l2ConnectionPortSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true,
},
"access_group_id": {
Type: schema.TypeString,
Computed: true,
},
"version_id": {
Type: schema.TypeInt,
Computed: true,
},
"created_at": {
Type: schema.TypeString,
Computed: true,
},
"created_by": {
Type: schema.TypeString,
Computed: true,
},
"updated_at": {
Type: schema.TypeString,
Computed: true,
},
"updated_by": {
Type: schema.TypeString,
Computed: true,
},
"l2_external_network": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: l2ExternalNetworkSchema(),
},
},
}
}
func dataSourceSegmentSchemaMake() map[string]*schema.Schema {
sch := map[string]*schema.Schema{
"segment_id": {
@@ -117,6 +209,13 @@ func dataSourceSegmentSchemaMake() map[string]*schema.Schema {
Type: schema.TypeBool,
Computed: true,
},
"l2_connection_port": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: l2ConnectionPortSchema(),
},
},
"logical_ports_info": {
Type: schema.TypeList,
Computed: true,
@@ -154,7 +253,7 @@ func dataSourceSegmentSchemaMake() map[string]*schema.Schema {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"common": {
"operation_status": {
Type: schema.TypeString,
Computed: true,
},
@@ -163,7 +262,7 @@ func dataSourceSegmentSchemaMake() map[string]*schema.Schema {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"status": {
"operation_status": {
Type: schema.TypeString,
Computed: true,
},
@@ -197,6 +296,10 @@ func dataSourceSegmentSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"type": {
Type: schema.TypeString,
Computed: true,
},
"updated_at": {
Type: schema.TypeString,
Computed: true,
@@ -278,6 +381,12 @@ func dataSourceSegmentListSchemaMake() map[string]*schema.Schema {
Optional: true,
Description: "find by updated date",
},
"operation_status": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"Idle", "SynchronizingAtCore", "SynchronizingAtOVN", "Synchronized", "NoHypervisorAtOVN", "FailedAtCore", "TemporaryFailedAtCore"}, false),
Description: "filter by operation status",
},
"items": {
Type: schema.TypeList,
Computed: true,
@@ -392,6 +501,13 @@ func dataSourceSegmentListSchemaMake() map[string]*schema.Schema {
Type: schema.TypeBool,
Computed: true,
},
"l2_connection_port": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: l2ConnectionPortSchema(),
},
},
"logical_ports_info": {
Type: schema.TypeList,
Computed: true,
@@ -429,7 +545,7 @@ func dataSourceSegmentListSchemaMake() map[string]*schema.Schema {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"common": {
"operation_status": {
Type: schema.TypeString,
Computed: true,
},
@@ -438,7 +554,7 @@ func dataSourceSegmentListSchemaMake() map[string]*schema.Schema {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"status": {
"operation_status": {
Type: schema.TypeString,
Computed: true,
},
@@ -472,6 +588,10 @@ func dataSourceSegmentListSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"type": {
Type: schema.TypeString,
Computed: true,
},
"updated_at": {
Type: schema.TypeString,
Computed: true,
@@ -492,28 +612,6 @@ func dataSourceSegmentListSchemaMake() map[string]*schema.Schema {
return res
}
func dataSourceSegmentGetStatusSchemaMake() map[string]*schema.Schema {
res := map[string]*schema.Schema{
"segment_id": {
Type: schema.TypeString,
Required: true,
},
"version_id": {
Type: schema.TypeInt,
Optional: true,
},
"detailed": {
Type: schema.TypeBool,
Optional: true,
},
"status": {
Type: schema.TypeString,
Computed: true,
},
}
return res
}
func resourceSegmentSchemaMake() map[string]*schema.Schema {
res := map[string]*schema.Schema{
"access_group_id": {
@@ -646,6 +744,13 @@ func resourceSegmentSchemaMake() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"l2_connection_port": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: l2ConnectionPortSchema(),
},
},
"logical_ports_info": {
Type: schema.TypeList,
Computed: true,
@@ -683,7 +788,7 @@ func resourceSegmentSchemaMake() map[string]*schema.Schema {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"common": {
"operation_status": {
Type: schema.TypeString,
Computed: true,
},
@@ -692,7 +797,7 @@ func resourceSegmentSchemaMake() map[string]*schema.Schema {
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"status": {
"operation_status": {
Type: schema.TypeString,
Computed: true,
},
@@ -718,6 +823,11 @@ func resourceSegmentSchemaMake() map[string]*schema.Schema {
},
},
},
"type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"updated_at": {
Type: schema.TypeString,
Computed: true,