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 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{ 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, }, }, }, }, }, }, }, }, }, "created_by": schema.StringAttribute{ Computed: true, }, "created_time": schema.Int64Attribute{ Computed: true, }, "deleted_by": schema.StringAttribute{ Computed: true, }, "deleted_time": schema.Int64Attribute{ Computed: true, }, "dp_api_user": 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, }, }, }, "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, }, } }