This commit is contained in:
asteam
2024-07-25 14:33:38 +03:00
commit 6f40af6a5f
946 changed files with 98335 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceFlipgroup() map[string]schema.Attribute {
return map[string]schema.Attribute{
"flipgroup_id": schema.Int64Attribute{
Required: true,
},
"account_id": schema.Int64Attribute{
Computed: true,
},
"account_name": schema.StringAttribute{
Computed: true,
},
"client_ids": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"client_type": schema.StringAttribute{
Computed: true,
},
"conn_id": schema.Int64Attribute{
Computed: true,
},
"conn_type": schema.StringAttribute{
Computed: true,
},
"created_by": schema.StringAttribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"default_gw": schema.StringAttribute{
Computed: true,
},
"deleted_by": schema.StringAttribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"id": schema.Int64Attribute{
Computed: true,
},
"ip": schema.StringAttribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"net_id": schema.Int64Attribute{
Computed: true,
},
"net_type": schema.StringAttribute{
Computed: true,
},
"network": schema.StringAttribute{
Computed: true,
},
"rg_id": schema.Int64Attribute{
Computed: true,
},
"rg_name": schema.StringAttribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"updated_by": schema.StringAttribute{
Computed: true,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,140 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceFlipgroupList() 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",
},
"vins_id": schema.Int64Attribute{
Optional: true,
Description: "Filter by ViNS ID",
},
"vins_name": schema.StringAttribute{
Optional: true,
Description: "Filter by ViNS name",
},
"extnet_id": schema.Int64Attribute{
Optional: true,
Description: "Filter by ExtNetID",
},
"by_ip": schema.StringAttribute{
Optional: true,
Description: "Filter by IP-address",
},
"rg_id": schema.Int64Attribute{
Optional: true,
Description: "Filter by RG ID",
},
"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",
},
"account_id": schema.Int64Attribute{
Optional: true,
Description: "Account id",
},
"conn_id": schema.Int64Attribute{
Optional: true,
Description: "Conn id",
},
"client_ids": schema.ListAttribute{
Optional: true,
ElementType: types.Int64Type,
Description: "client_ids",
},
"status": schema.StringAttribute{
Optional: true,
Description: "Status",
},
"id": schema.StringAttribute{
Computed: true,
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"flipgroup_id": schema.Int64Attribute{
Computed: true,
},
"account_id": schema.Int64Attribute{
Computed: true,
},
"client_ids": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"client_type": schema.StringAttribute{
Computed: true,
},
"conn_id": schema.Int64Attribute{
Computed: true,
},
"conn_type": schema.StringAttribute{
Computed: true,
},
"default_gw": schema.StringAttribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"net_id": schema.Int64Attribute{
Computed: true,
},
"net_type": schema.StringAttribute{
Computed: true,
},
"ip": schema.StringAttribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"net_mask": schema.Int64Attribute{
Computed: true,
},
"ckey": schema.StringAttribute{
Computed: true,
},
"meta": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,116 @@
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"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaResourceFlipgroup() map[string]schema.Attribute {
return map[string]schema.Attribute{
"account_id": schema.Int64Attribute{
Required: true,
Description: "Account ID",
},
"name": schema.StringAttribute{
Required: true,
Description: "Flipgroup name",
},
"net_id": schema.Int64Attribute{
Required: true,
Description: "EXTNET or ViNS ID",
},
"net_type": schema.StringAttribute{
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("EXTNET", "VINS"),
},
Description: "Network type, EXTNET or VINS",
},
"client_type": schema.StringAttribute{
Required: true,
Validators: []validator.String{
stringvalidator.OneOf("compute"),
},
Description: "Type of client, 'compute' ('vins' will be later)",
},
"ip": schema.StringAttribute{
Optional: true,
Computed: true,
Description: "IP address to associate with this group. If empty, the platform will autoselect IP address",
},
"desc": schema.StringAttribute{
Optional: true,
Description: "Text description of this Flipgroup instance",
},
"client_ids": schema.ListAttribute{
Optional: true,
Computed: true,
ElementType: types.Int64Type,
Description: "List of clients attached to this Flipgroup instance",
},
"flipgroup_id": schema.Int64Attribute{
Computed: true,
},
"account_name": schema.StringAttribute{
Computed: true,
},
"conn_id": schema.Int64Attribute{
Computed: true,
},
"conn_type": schema.StringAttribute{
Computed: true,
},
"created_by": schema.StringAttribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"default_gw": schema.StringAttribute{
Computed: true,
},
"deleted_by": schema.StringAttribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"id": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"network": schema.StringAttribute{
Computed: true,
},
"rg_id": schema.Int64Attribute{
Computed: true,
},
"rg_name": schema.StringAttribute{
Computed: true,
},
"updated_by": schema.StringAttribute{
Computed: true,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
}
}