This commit is contained in:
asteam
2024-12-04 13:18:58 +03:00
parent 003e4d656e
commit 76ea459b3d
417 changed files with 30051 additions and 975 deletions

View File

@@ -0,0 +1,73 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceK8CI() map[string]schema.Attribute {
return map[string]schema.Attribute{
"k8ci_id": schema.Int64Attribute{
Required: true,
Description: "K8CI ID",
},
"desc": schema.StringAttribute{
Computed: true,
Description: "description",
},
"gid": schema.Int64Attribute{
Computed: true,
Description: "gid",
},
"guid": schema.Int64Attribute{
Computed: true,
Description: "guid",
},
"id": schema.StringAttribute{
Computed: true,
},
"lb_image_id": schema.Int64Attribute{
Computed: true,
Description: "LB Image ID",
},
"master_driver": schema.StringAttribute{
Computed: true,
},
"master_image_id": schema.Int64Attribute{
Computed: true,
},
"max_master_count": schema.Int64Attribute{
Computed: true,
},
"max_worker_count": schema.Int64Attribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
Description: "K8CI name",
},
"network_plugins": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"shared_with": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"status": schema.StringAttribute{
Computed: true,
},
"version": schema.StringAttribute{
Computed: true,
},
"worker_driver": schema.StringAttribute{
Computed: true,
},
"worker_image_id": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,113 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceK8CIList() map[string]schema.Attribute {
return map[string]schema.Attribute{
"by_id": schema.Int64Attribute{
Optional: true,
Description: "Filter by ID",
},
"name": schema.StringAttribute{
Optional: true,
Description: "Filter by name",
},
"status": schema.StringAttribute{
Optional: true,
Description: "Filter by status",
},
"worker_driver": schema.StringAttribute{
Optional: true,
Description: "Filter by worker driver",
},
"master_driver": schema.StringAttribute{
Optional: true,
Description: "Filter by master driver",
},
"network_plugin": schema.StringAttribute{
Optional: true,
Description: "Filter by network plugin",
},
"include_disabled": schema.BoolAttribute{
Optional: true,
Description: "Include disabled k8cis in result",
},
"sort_by": schema.StringAttribute{
Optional: true,
Description: "sort by one of supported fields, format +|-(field)",
},
"page": schema.Int64Attribute{
Optional: true,
Description: "Page number",
},
"size": schema.Int64Attribute{
Optional: true,
Description: "Page size",
},
"id": schema.StringAttribute{
Computed: true,
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"created_time": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"k8ci_id": schema.Int64Attribute{
Computed: true,
},
"lb_image_id": schema.Int64Attribute{
Computed: true,
},
"master_driver": schema.StringAttribute{
Computed: true,
},
"master_image_id": schema.Int64Attribute{
Computed: true,
},
"max_master_count": schema.Int64Attribute{
Computed: true,
},
"max_worker_count": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"shared_with": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"status": schema.StringAttribute{
Computed: true,
},
"version": schema.StringAttribute{
Computed: true,
},
"worker_driver": schema.StringAttribute{
Computed: true,
},
"worker_image_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,105 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceK8CIListDeleted() map[string]schema.Attribute {
return map[string]schema.Attribute{
"by_id": schema.Int64Attribute{
Optional: true,
Description: "Filter by ID",
},
"name": schema.StringAttribute{
Optional: true,
Description: "Filter by name",
},
"worker_driver": schema.StringAttribute{
Optional: true,
Description: "Filter by worker driver",
},
"master_driver": schema.StringAttribute{
Optional: true,
Description: "Filter by master driver",
},
"network_plugin": schema.StringAttribute{
Optional: true,
Description: "Filter by network plugin",
},
"sort_by": schema.StringAttribute{
Optional: true,
Description: "sort by one of supported fields, format +|-(field)",
},
"page": schema.Int64Attribute{
Optional: true,
Description: "Page number",
},
"size": schema.Int64Attribute{
Optional: true,
Description: "Page size",
},
"id": schema.StringAttribute{
Computed: true,
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"created_time": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"k8ci_id": schema.Int64Attribute{
Computed: true,
},
"lb_image_id": schema.Int64Attribute{
Computed: true,
},
"master_driver": schema.StringAttribute{
Computed: true,
},
"master_image_id": schema.Int64Attribute{
Computed: true,
},
"max_master_count": schema.Int64Attribute{
Computed: true,
},
"max_worker_count": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"shared_with": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"status": schema.StringAttribute{
Computed: true,
},
"version": schema.StringAttribute{
Computed: true,
},
"worker_driver": schema.StringAttribute{
Computed: true,
},
"worker_image_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,84 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaResourceK8CI() map[string]schema.Attribute {
return map[string]schema.Attribute{
"name": schema.StringAttribute{
Required: true,
Description: "K8CI name",
},
"version": schema.StringAttribute{
Required: true,
},
"master_driver": schema.StringAttribute{
Required: true,
},
"master_image_id": schema.Int64Attribute{
Required: true,
},
"max_master_count": schema.Int64Attribute{
Required: true,
},
"max_worker_count": schema.Int64Attribute{
Required: true,
},
"worker_image_id": schema.Int64Attribute{
Required: true,
},
"worker_driver": schema.StringAttribute{
Required: true,
},
"network_plugins": schema.ListAttribute{
Required: true,
ElementType: types.StringType,
},
"enabled": schema.BoolAttribute{
Optional: true,
},
"permanently": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
// default value is true
},
"restore": schema.BoolAttribute{
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
// default value is true
},
"desc": schema.StringAttribute{
Optional: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"k8ci_id": schema.Int64Attribute{
Computed: true,
},
"id": schema.StringAttribute{
Computed: true,
},
"lb_image_id": schema.Int64Attribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"shared_with": schema.ListAttribute{
Optional: true,
ElementType: types.Int64Type,
},
"status": schema.StringAttribute{
Computed: true,
},
}
}