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,169 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceExtNet() map[string]schema.Attribute {
return map[string]schema.Attribute{
// required attributes
"net_id": schema.Int64Attribute{
Required: true,
Description: "ext net id",
},
// computed attributes
"id": schema.StringAttribute{
Computed: true,
},
"ckey": schema.StringAttribute{
Computed: true,
},
"meta": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"check_ips": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"default": schema.BoolAttribute{
Computed: true,
},
"default_qos": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"e_rate": schema.Int64Attribute{
Computed: true,
},
"e_burst": schema.Int64Attribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"in_burst": schema.Int64Attribute{
Computed: true,
},
"in_rate": schema.Int64Attribute{
Computed: true,
},
},
},
"desc": schema.StringAttribute{
Computed: true,
},
"dns": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"excluded": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"client_type": schema.StringAttribute{
Computed: true,
},
"mac": schema.StringAttribute{
Computed: true,
},
"ip": schema.StringAttribute{
Computed: true,
},
"type": schema.StringAttribute{
Computed: true,
},
"vm_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
"free_ips": schema.Int64Attribute{
Computed: true,
},
"gateway": schema.StringAttribute{
Computed: true,
},
"gid": schema.Int64Attribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"ipcidr": schema.StringAttribute{
Computed: true,
},
"milestones": schema.Int64Attribute{
Computed: true,
},
"net_name": schema.StringAttribute{
Computed: true,
},
"network": schema.StringAttribute{
Computed: true,
},
"network_id": schema.Int64Attribute{
Computed: true,
},
"pre_reservations_num": schema.Int64Attribute{
Computed: true,
},
"prefix": schema.Int64Attribute{
Computed: true,
},
"pri_vnf_dev_id": schema.Int64Attribute{
Computed: true,
},
"reservations": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"client_type": schema.StringAttribute{
Computed: true,
},
"domainname": schema.StringAttribute{
Computed: true,
},
"hostname": schema.StringAttribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"ip": schema.StringAttribute{
Computed: true,
},
"mac": schema.StringAttribute{
Computed: true,
},
"type": schema.StringAttribute{
Computed: true,
},
"vm_id": schema.Int64Attribute{
Computed: true,
},
},
},
},
"shared_with": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
"status": schema.StringAttribute{
Computed: true,
},
"vlan_id": schema.Int64Attribute{
Computed: true,
},
"vnfs": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"dhcp": schema.Int64Attribute{
Computed: true,
},
},
},
}
}

View File

@@ -0,0 +1,89 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
)
func MakeSchemaDataSourceExtNetComputesList() map[string]schema.Attribute {
return map[string]schema.Attribute{
// required attributes
"account_id": schema.Int64Attribute{
Required: true,
Description: "find by account id",
},
// optional attributes
"rg_id": schema.Int64Attribute{
Optional: true,
Description: "find by rg id",
},
"compute_id": schema.Int64Attribute{
Optional: true,
Description: "find by compute id",
},
"page": schema.Int64Attribute{
Optional: true,
Description: "page number",
},
"size": schema.Int64Attribute{
Optional: true,
Description: "page size",
},
"sort_by": schema.StringAttribute{
Optional: true,
Description: "sort by one of supported fields, format +|-(field)",
},
// computed attributes
"id": schema.StringAttribute{
Computed: true,
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"account_id": schema.Int64Attribute{
Computed: true,
},
"account_name": schema.StringAttribute{
Computed: true,
},
"extnets": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"net_id": schema.Int64Attribute{
Computed: true,
},
"ipaddr": schema.StringAttribute{
Computed: true,
},
"ipcidr": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
},
},
},
"id": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"rg_id": schema.Int64Attribute{
Computed: true,
},
"rg_name": schema.StringAttribute{
Computed: true,
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,17 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
)
func MakeSchemaDataSourceExtNetDefault() map[string]schema.Attribute {
return map[string]schema.Attribute{
// computed attributes
"id": schema.StringAttribute{
Computed: true,
},
"net_id": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,78 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
)
func MakeSchemaDataSourceExtNetList() map[string]schema.Attribute {
return map[string]schema.Attribute{
// optional attributes
"account_id": schema.Int64Attribute{
Optional: true,
Description: "find by account id",
},
"by_id": schema.Int64Attribute{
Optional: true,
Description: "find by id",
},
"name": schema.StringAttribute{
Optional: true,
Description: "find by name",
},
"network": schema.StringAttribute{
Optional: true,
Description: "find by network ip address",
},
"vlan_id": schema.Int64Attribute{
Optional: true,
Description: "find by vlan id",
},
"vnfdev_id": schema.Int64Attribute{
Optional: true,
Description: "find by vnfdevices id",
},
"status": schema.StringAttribute{
Optional: true,
Description: "find by status",
},
"page": schema.Int64Attribute{
Optional: true,
Description: "page number",
},
"size": schema.Int64Attribute{
Optional: true,
Description: "page size",
},
"sort_by": schema.StringAttribute{
Optional: true,
Description: "sort by one of supported fields, format +|-(field)",
},
// computed attributes
"id": schema.StringAttribute{
Computed: true,
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"net_id": schema.Int64Attribute{
Computed: true,
},
"ipcidr": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}