This commit is contained in:
asteam
2024-08-23 16:55:50 +03:00
parent 6f40af6a5f
commit 003e4d656e
524 changed files with 43376 additions and 432 deletions

View File

@@ -0,0 +1,79 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceVFPool() map[string]schema.Attribute {
return map[string]schema.Attribute{
"vfpool_id": schema.Int64Attribute{
Required: true,
},
"account_access": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"description": schema.StringAttribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"rg_access": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"status": schema.StringAttribute{
Computed: true,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
"vfs": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"node_id": schema.Int64Attribute{
Computed: true,
},
"vf_list": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"nic_name": schema.StringAttribute{
Computed: true,
},
"vfs_info": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
Computed: true,
},
"claimed": schema.BoolAttribute{
Computed: true,
},
"vm_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
},
},
},
},
}
}

View File

@@ -0,0 +1,119 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceVFPoolList() map[string]schema.Attribute {
return map[string]schema.Attribute{
"by_id": schema.Int64Attribute{
Optional: true,
},
"gid": schema.Int64Attribute{
Optional: true,
},
"name": schema.StringAttribute{
Optional: true,
},
"description": schema.StringAttribute{
Optional: true,
},
"status": schema.StringAttribute{
Optional: true,
},
"account_access": schema.Int64Attribute{
Optional: true,
},
"rg_access": schema.Int64Attribute{
Optional: true,
},
"sort_by": schema.StringAttribute{
Optional: true,
},
"page": schema.Int64Attribute{
Optional: true,
},
"size": schema.Int64Attribute{
Optional: true,
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"account_access": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"description": schema.StringAttribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"vfpool_id": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"rg_access": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"status": schema.StringAttribute{
Computed: true,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
"vfs": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"node_id": schema.Int64Attribute{
Computed: true,
},
"vf_list": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"nic_name": schema.StringAttribute{
Computed: true,
},
"vfs_info": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
Computed: true,
},
"claimed": schema.BoolAttribute{
Computed: true,
},
"vm_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
},
},
},
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,107 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaResourceVFPool() map[string]schema.Attribute {
return map[string]schema.Attribute{
"name": schema.StringAttribute{
Required: true,
},
"description": schema.StringAttribute{
Optional: true,
},
"account_access": schema.ListAttribute{
Optional: true,
ElementType: types.Int64Type,
},
"rg_access": schema.ListAttribute{
Optional: true,
ElementType: types.Int64Type,
},
"config": schema.ListNestedAttribute{
Optional: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"node_id": schema.Int64Attribute{
Required: true,
},
"nic_name": schema.StringAttribute{
Required: true,
},
"vf_ids": schema.ListAttribute{
Required: true,
ElementType: types.Int64Type,
},
},
},
},
"enable": schema.BoolAttribute{
Optional: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"vfpool_id": schema.Int64Attribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
"vfs": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"node_id": schema.Int64Attribute{
Computed: true,
},
"vf_list": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"nic_name": schema.StringAttribute{
Computed: true,
},
"vfs_info": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"id": schema.Int64Attribute{
Computed: true,
},
"claimed": schema.BoolAttribute{
Computed: true,
},
"vm_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
},
},
},
},
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
}
}