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,270 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceLB() map[string]schema.Attribute {
return map[string]schema.Attribute{
"lb_id": schema.Int64Attribute{
Required: true,
},
"ha_mode": schema.BoolAttribute{
Computed: true,
},
"acl": schema.StringAttribute{
Computed: true,
},
"backend_haip": schema.StringAttribute{
Computed: true,
},
"backends": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"algorithm": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"server_default_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"downinter": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"inter": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
"servers": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"check": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
"server_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"downinter": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"inter": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
},
},
},
"ckey": schema.StringAttribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"dp_api_user": schema.StringAttribute{
Computed: true,
},
"dp_api_password": schema.StringAttribute{
Computed: true,
},
"extnet_id": schema.Int64Attribute{
Computed: true,
},
"frontend_haip": schema.StringAttribute{
Computed: true,
},
"frontends": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"backend": schema.StringAttribute{
Computed: true,
},
"bindings": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
},
},
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
},
},
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"id": schema.Int64Attribute{
Computed: true,
},
"manager_id": schema.Int64Attribute{
Computed: true,
},
"manager_type": schema.StringAttribute{
Computed: true,
},
"image_id": schema.Int64Attribute{
Computed: true,
},
"meta": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"part_k8s": schema.BoolAttribute{
Computed: true,
},
"primary_node": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backend_ip": schema.StringAttribute{
Computed: true,
},
"compute_id": schema.Int64Attribute{
Computed: true,
},
"frontend_ip": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"mgmt_ip": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
},
},
"rg_id": schema.Int64Attribute{
Computed: true,
},
"secondary_node": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backend_ip": schema.StringAttribute{
Computed: true,
},
"compute_id": schema.Int64Attribute{
Computed: true,
},
"frontend_ip": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"mgmt_ip": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
},
},
"status": schema.StringAttribute{
Computed: true,
},
"tech_status": schema.StringAttribute{
Computed: true,
},
"user_managed": schema.BoolAttribute{
Computed: true,
},
"vins_id": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,341 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
)
func MakeSchemaDataSourceLBList() map[string]schema.Attribute {
return map[string]schema.Attribute{
// optional attributes
"by_id": schema.Int64Attribute{
Optional: true,
Description: "find by id",
},
"name": schema.StringAttribute{
Optional: true,
Description: "find by name",
},
"account_id": schema.Int64Attribute{
Optional: true,
Description: "find by account ID",
},
"rg_id": schema.Int64Attribute{
Optional: true,
Description: "find by RG ID",
},
"tech_status": schema.StringAttribute{
Optional: true,
Description: "find by tech status",
},
"status": schema.StringAttribute{
Optional: true,
Description: "find by status",
},
"front_ip": schema.StringAttribute{
Optional: true,
Description: "find by frontend Ip",
},
"back_ip": schema.StringAttribute{
Optional: true,
Description: "find by backend Ip",
},
"include_deleted": schema.BoolAttribute{
Optional: true,
Description: "included deleted LBs. If using field 'status', then include_deleted will be ignored",
},
"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: "size number",
},
// computed attributes
"id": schema.StringAttribute{
Optional: true,
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"ha_mode": schema.BoolAttribute{
Computed: true,
},
"acl": schema.StringAttribute{
Computed: true,
},
"backend_haip": schema.StringAttribute{
Computed: true,
},
"backends": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"algorithm": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"server_default_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"inter": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"downinter": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
"servers": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"check": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
"server_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"inter": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"downinter": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
},
},
},
"created_by": schema.StringAttribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"deleted_by": schema.StringAttribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"dp_api_user": schema.StringAttribute{
Computed: true,
},
"dp_api_password": schema.StringAttribute{
Computed: true,
},
"extnet_id": schema.Int64Attribute{
Computed: true,
},
"frontend_haip": schema.StringAttribute{
Computed: true,
},
"frontends": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"backend": schema.StringAttribute{
Computed: true,
},
"bindings": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
},
},
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
},
},
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"lb_id": schema.Int64Attribute{
Computed: true,
},
"manager_id": schema.Int64Attribute{
Computed: true,
},
"manager_type": schema.StringAttribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"part_k8s": schema.BoolAttribute{
Computed: true,
},
"primary_node": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backend_ip": schema.StringAttribute{
Computed: true,
},
"compute_id": schema.Int64Attribute{
Computed: true,
},
"frontend_ip": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"mgmt_ip": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
},
},
"rg_id": schema.Int64Attribute{
Computed: true,
},
"rg_name": schema.StringAttribute{
Computed: true,
},
"secondary_node": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backend_ip": schema.StringAttribute{
Computed: true,
},
"compute_id": schema.Int64Attribute{
Computed: true,
},
"frontend_ip": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"mgmt_ip": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
},
},
"status": schema.StringAttribute{
Computed: true,
},
"tech_status": schema.StringAttribute{
Computed: true,
},
"updated_by": schema.StringAttribute{
Computed: true,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
"user_managed": schema.BoolAttribute{
Computed: true,
},
"vins_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,333 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
)
func MakeSchemaDataSourceLBListDeleted() map[string]schema.Attribute {
return map[string]schema.Attribute{
// optional attributes
"by_id": schema.Int64Attribute{
Optional: true,
Description: "find by id",
},
"name": schema.StringAttribute{
Optional: true,
Description: "find by name",
},
"account_id": schema.Int64Attribute{
Optional: true,
Description: "find by account ID",
},
"rg_id": schema.Int64Attribute{
Optional: true,
Description: "find by RG ID",
},
"tech_status": schema.StringAttribute{
Optional: true,
Description: "find by tech status",
},
"front_ip": schema.StringAttribute{
Optional: true,
Description: "find by frontend Ip",
},
"back_ip": schema.StringAttribute{
Optional: true,
Description: "find by backend Ip",
},
"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: "size number",
},
// computed attributes
"id": schema.StringAttribute{
Optional: true,
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"ha_mode": schema.BoolAttribute{
Computed: true,
},
"acl": schema.StringAttribute{
Computed: true,
},
"backend_haip": schema.StringAttribute{
Computed: true,
},
"backends": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"algorithm": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"server_default_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"inter": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"downinter": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
"servers": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"check": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
"server_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"inter": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"downinter": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
},
},
},
"created_by": schema.StringAttribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"deleted_by": schema.StringAttribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"dp_api_user": schema.StringAttribute{
Computed: true,
},
"dp_api_password": schema.StringAttribute{
Computed: true,
},
"extnet_id": schema.Int64Attribute{
Computed: true,
},
"frontend_haip": schema.StringAttribute{
Computed: true,
},
"frontends": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"backend": schema.StringAttribute{
Computed: true,
},
"bindings": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
},
},
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
},
},
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"lb_id": schema.Int64Attribute{
Computed: true,
},
"manager_id": schema.Int64Attribute{
Computed: true,
},
"manager_type": schema.StringAttribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"part_k8s": schema.BoolAttribute{
Computed: true,
},
"primary_node": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backend_ip": schema.StringAttribute{
Computed: true,
},
"compute_id": schema.Int64Attribute{
Computed: true,
},
"frontend_ip": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"mgmt_ip": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
},
},
"rg_id": schema.Int64Attribute{
Computed: true,
},
"rg_name": schema.StringAttribute{
Computed: true,
},
"secondary_node": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backend_ip": schema.StringAttribute{
Computed: true,
},
"compute_id": schema.Int64Attribute{
Computed: true,
},
"frontend_ip": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"mgmt_ip": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
},
},
"status": schema.StringAttribute{
Computed: true,
},
"tech_status": schema.StringAttribute{
Computed: true,
},
"updated_by": schema.StringAttribute{
Computed: true,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
"user_managed": schema.BoolAttribute{
Computed: true,
},
"vins_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,316 @@
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 MakeSchemaResourceLB() map[string]schema.Attribute {
return map[string]schema.Attribute{
// required attributes
"rg_id": schema.Int64Attribute{
Required: true,
},
"name": schema.StringAttribute{
Required: true,
},
"extnet_id": schema.Int64Attribute{
Required: true,
},
"vins_id": schema.Int64Attribute{
Required: true,
},
"start": schema.BoolAttribute{
Required: true,
},
// optional attributes
"ha_mode": schema.BoolAttribute{
Optional: true,
Computed: true,
},
"desc": schema.StringAttribute{
Optional: true,
Computed: true,
},
"enable": schema.BoolAttribute{
Optional: true,
},
"restart": schema.BoolAttribute{
Optional: true,
},
"config_reset": schema.BoolAttribute{
Optional: true,
},
"permanently": schema.BoolAttribute{
Optional: true,
},
"restore": schema.BoolAttribute{
Optional: true,
},
"safe": schema.BoolAttribute{
// Default: true
Optional: true,
},
"sysctl_params": schema.ListNestedAttribute{
Optional: true,
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"key": schema.StringAttribute{
Required: true,
},
"value": schema.StringAttribute{
Required: true,
},
},
},
},
"acl": schema.StringAttribute{
Computed: true,
},
"backend_haip": schema.StringAttribute{
Computed: true,
},
"backends": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"algorithm": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"server_default_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"downinter": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"inter": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
"servers": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"check": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
"server_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"downinter": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"inter": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
},
},
},
"ckey": schema.StringAttribute{
Computed: true,
},
"meta": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"dp_api_user": schema.StringAttribute{
Computed: true,
},
"dp_api_password": schema.StringAttribute{
Computed: true,
},
"frontend_haip": schema.StringAttribute{
Computed: true,
},
"frontends": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"backend": schema.StringAttribute{
Computed: true,
},
"bindings": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
},
},
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
},
},
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"lb_id": schema.Int64Attribute{
Computed: true,
},
"manager_id": schema.Int64Attribute{
Computed: true,
},
"manager_type": schema.StringAttribute{
Computed: true,
},
"image_id": schema.Int64Attribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"part_k8s": schema.BoolAttribute{
Computed: true,
},
"primary_node": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backend_ip": schema.StringAttribute{
Computed: true,
},
"compute_id": schema.Int64Attribute{
Computed: true,
},
"frontend_ip": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"mgmt_ip": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
},
},
"secondary_node": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"backend_ip": schema.StringAttribute{
Computed: true,
},
"compute_id": schema.Int64Attribute{
Computed: true,
},
"frontend_ip": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"mgmt_ip": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
},
},
"status": schema.StringAttribute{
Computed: true,
},
"tech_status": schema.StringAttribute{
Computed: true,
},
"user_managed": schema.BoolAttribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,122 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"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/schema/validator"
)
func MakeSchemaResourceLBBackend() map[string]schema.Attribute {
return map[string]schema.Attribute{
"lb_id": schema.Int64Attribute{
Required: true,
},
"name": schema.StringAttribute{
Required: true,
},
"algorithm": schema.StringAttribute{
Optional: true,
Computed: true,
Validators: []validator.String{
stringvalidator.OneOf("roundrobin", "static-rr", "leastconn"),
},
},
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"downinter": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"fall": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"inter": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"maxconn": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"rise": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"slowstart": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"weight": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"servers": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"check": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
"server_settings": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"downinter": schema.Int64Attribute{
Computed: true,
},
"fall": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"inter": schema.Int64Attribute{
Computed: true,
},
"maxconn": schema.Int64Attribute{
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Computed: true,
},
"rise": schema.Int64Attribute{
Computed: true,
},
"slowstart": schema.Int64Attribute{
Computed: true,
},
"weight": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
}
}

View File

@@ -0,0 +1,83 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"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/schema/validator"
)
func MakeSchemaResourceLBBackendServer() map[string]schema.Attribute {
return map[string]schema.Attribute{
"lb_id": schema.Int64Attribute{
Required: true,
Description: "ID of the LB instance to backendCreate",
},
"backend_name": schema.StringAttribute{
Required: true,
Description: "Must be unique among all backends of this LB - name of the new backend to create",
},
"name": schema.StringAttribute{
Required: true,
Description: "Must be unique among all servers defined for this backend - name of the server definition to add.",
},
"address": schema.StringAttribute{
Required: true,
Description: "IP address of the server.",
},
"port": schema.Int64Attribute{
Required: true,
Description: "Port number on the server",
},
"check": schema.StringAttribute{
Computed: true,
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf("disabled", "enabled"),
},
Description: "set to disabled if this server should be used regardless of its state.",
},
"guid": schema.StringAttribute{
Computed: true,
},
"downinter": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"fall": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"inter": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"maxconn": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"maxqueue": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"rise": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"slowstart": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"weight": schema.Int64Attribute{
Optional: true,
Computed: true,
},
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
}
}

View File

@@ -0,0 +1,49 @@
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"
)
func MakeSchemaResourceLBFrontend() map[string]schema.Attribute {
return map[string]schema.Attribute{
"lb_id": schema.Int64Attribute{
Required: true,
},
"backend_name": schema.StringAttribute{
Required: true,
},
"name": schema.StringAttribute{
Required: true,
},
"bindings": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"address": schema.StringAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"port": schema.Int64Attribute{
Computed: true,
},
},
},
},
"guid": schema.StringAttribute{
Computed: true,
},
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
}
}

View File

@@ -0,0 +1,36 @@
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"
)
func MakeSchemaResourceLBFrontendBind() map[string]schema.Attribute {
return map[string]schema.Attribute{
"lb_id": schema.Int64Attribute{
Required: true,
},
"frontend_name": schema.StringAttribute{
Required: true,
},
"address": schema.StringAttribute{
Required: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Required: true,
},
"port": schema.Int64Attribute{
Required: true,
},
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
}
}