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,139 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceAccount() map[string]schema.Attribute {
return map[string]schema.Attribute{
"account_id": schema.Int64Attribute{
Required: true,
},
"dc_location": schema.StringAttribute{
Computed: true,
},
"ckey": schema.StringAttribute{
Computed: true,
},
"acl": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"explicit": schema.BoolAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"right": schema.StringAttribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"type": schema.StringAttribute{
Computed: true,
},
"user_group_id": schema.StringAttribute{
Computed: true,
},
},
},
},
"company": schema.StringAttribute{
Computed: true,
},
"companyurl": schema.StringAttribute{
Computed: true,
},
"compute_features": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"cpu_allocation_parameter": schema.StringAttribute{
Computed: true,
},
"cpu_allocation_ratio": schema.Float64Attribute{
Computed: true,
},
"created_by": schema.StringAttribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"deactivation_time": schema.Int64Attribute{
Computed: true,
},
"deleted_by": schema.StringAttribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"displayname": schema.StringAttribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"id": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"resource_limits": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"cu_c": schema.Float64Attribute{
Computed: true,
},
"cu_d": schema.Float64Attribute{
Computed: true,
},
"cu_dm": schema.Float64Attribute{
Computed: true,
},
"cu_i": schema.Float64Attribute{
Computed: true,
},
"cu_m": schema.Float64Attribute{
Computed: true,
},
"cu_np": schema.Float64Attribute{
Computed: true,
},
"gpu_units": schema.Float64Attribute{
Computed: true,
},
},
},
"resource_types": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"send_access_emails": schema.BoolAttribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"uniq_pools": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
"version": schema.Int64Attribute{
Computed: true,
},
"vins": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
}
}

View File

@@ -0,0 +1,177 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
func MakeSchemaDataSourceAccountList() map[string]schema.Attribute {
return map[string]schema.Attribute{
// optional attributes
"by_id": schema.Int64Attribute{
Optional: true,
Description: "filter by id",
},
"name": schema.StringAttribute{
Optional: true,
Description: "filter by name",
},
"acl": schema.StringAttribute{
Optional: true,
Description: "filter by acl",
},
"status": schema.StringAttribute{
Computed: true,
},
"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)",
},
"items": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"dc_location": schema.StringAttribute{
Computed: true,
},
"ckey": schema.StringAttribute{
Computed: true,
},
"acl": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"explicit": schema.BoolAttribute{
Computed: true,
},
"guid": schema.StringAttribute{
Computed: true,
},
"right": schema.StringAttribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"type": schema.StringAttribute{
Computed: true,
},
"user_group_id": schema.StringAttribute{
Computed: true,
},
},
},
},
"company": schema.StringAttribute{
Computed: true,
},
"companyurl": schema.StringAttribute{
Computed: true,
},
"compute_features": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"cpu_allocation_parameter": schema.StringAttribute{
Computed: true,
},
"cpu_allocation_ratio": schema.Float64Attribute{
Computed: true,
},
"created_by": schema.StringAttribute{
Computed: true,
},
"created_time": schema.Int64Attribute{
Computed: true,
},
"deactivation_time": schema.Int64Attribute{
Computed: true,
},
"deleted_by": schema.StringAttribute{
Computed: true,
},
"deleted_time": schema.Int64Attribute{
Computed: true,
},
"displayname": schema.StringAttribute{
Computed: true,
},
"guid": schema.Int64Attribute{
Computed: true,
},
"id": schema.Int64Attribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"resource_limits": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"cu_c": schema.Float64Attribute{
Computed: true,
},
"cu_d": schema.Float64Attribute{
Computed: true,
},
"cu_dm": schema.Float64Attribute{
Computed: true,
},
"cu_i": schema.Float64Attribute{
Computed: true,
},
"cu_m": schema.Float64Attribute{
Computed: true,
},
"cu_np": schema.Float64Attribute{
Computed: true,
},
"gpu_units": schema.Float64Attribute{
Computed: true,
},
},
},
"resource_types": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"send_access_emails": schema.BoolAttribute{
Computed: true,
},
"status": schema.StringAttribute{
Computed: true,
},
"uniq_pools": schema.ListAttribute{
Computed: true,
ElementType: types.StringType,
},
"updated_time": schema.Int64Attribute{
Computed: true,
},
"version": schema.Int64Attribute{
Computed: true,
},
"vins": schema.ListAttribute{
Computed: true,
ElementType: types.Int64Type,
},
},
},
},
"id": schema.StringAttribute{
Computed: true,
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}

View File

@@ -0,0 +1,102 @@
package schemas
import (
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
)
func MakeSchemaDataSourceAccountVinsList() map[string]schema.Attribute {
return map[string]schema.Attribute{
"account_id": schema.Int64Attribute{
Required: true,
},
"vins_id": schema.Int64Attribute{
Optional: true,
},
"name": schema.StringAttribute{
Optional: true,
},
"rg_id": schema.Int64Attribute{
Optional: true,
},
"ext_ip": schema.StringAttribute{
Optional: true,
},
"sort_by": schema.StringAttribute{
Optional: true,
},
"page": schema.Int64Attribute{
Optional: true,
},
"size": schema.Int64Attribute{
Optional: 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,
},
"computes": 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,
},
"external_ip": schema.StringAttribute{
Computed: true,
},
"extnet_id": schema.Int64Attribute{
Computed: true,
},
"free_ips": schema.Int64Attribute{
Computed: true,
},
"vin_id": schema.Int64Attribute{
Computed: true,
},
"vin_name": schema.StringAttribute{
Computed: true,
},
"network": schema.StringAttribute{
Computed: true,
},
"pri_vnf_dev_id": schema.Int64Attribute{
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,
},
},
},
},
"entry_count": schema.Int64Attribute{
Computed: true,
},
}
}