1.0.1
This commit is contained in:
164
internal/service/cloudbroker/rg/schemas/schema_data_source_rg.go
Normal file
164
internal/service/cloudbroker/rg/schemas/schema_data_source_rg.go
Normal file
@@ -0,0 +1,164 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRG() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "resource group id",
|
||||
},
|
||||
|
||||
// optional attributes
|
||||
"reason": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "reason for request",
|
||||
},
|
||||
|
||||
//computed attributes
|
||||
"account_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"account_name": 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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"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,
|
||||
},
|
||||
"def_net_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"def_net_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"desc": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"dirty": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"guid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"lock_status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"register_computes": schema.BoolAttribute{
|
||||
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,
|
||||
},
|
||||
"secret": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vins": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"computes": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"uniq_pools": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGAffinityGroupComputes() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "find by rg id",
|
||||
},
|
||||
"affinity_group": schema.StringAttribute{
|
||||
Required: true,
|
||||
Description: "Affinity group label",
|
||||
},
|
||||
|
||||
//computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"items": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"compute_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"other_node": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"other_node_indirect": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"other_node_indirect_soft": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"other_node_soft": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"same_node": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"same_node_soft": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGAffinityGroupsGet() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "find by rg id",
|
||||
},
|
||||
"affinity_group": schema.StringAttribute{
|
||||
Required: true,
|
||||
Description: "Affinity group label",
|
||||
},
|
||||
|
||||
//computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ids": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGAffinityGroupsList() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "find by rg id",
|
||||
},
|
||||
|
||||
// optional attributes
|
||||
"page": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "page number",
|
||||
},
|
||||
"size": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "size number",
|
||||
},
|
||||
|
||||
//computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"affinity_groups": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"label": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
"ids": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"node_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGAudits() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
},
|
||||
|
||||
//computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"items": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"call": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"responsetime": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"statuscode": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"timestamp": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"user": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGGetResourceConsumption() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "find by rg id",
|
||||
},
|
||||
|
||||
//computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"consumed": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"cpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"extips": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"seps": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"sep_id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"data_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"reserved": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"cpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"extips": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"seps": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"sep_id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"data_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGList() 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",
|
||||
},
|
||||
"account_name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by account name",
|
||||
},
|
||||
"created_after": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find by created after time (unix timestamp)",
|
||||
},
|
||||
"created_before": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find by created before time (unix timestamp)",
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by status",
|
||||
},
|
||||
"lock_status": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by lock status",
|
||||
},
|
||||
"includedeleted": schema.BoolAttribute{
|
||||
Optional: true,
|
||||
Description: "included deleted resource groups. If using field 'status', then includedeleted 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{
|
||||
Computed: true,
|
||||
},
|
||||
"items": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"account_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"account_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"compute_features": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"created_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"def_net_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"def_net_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"desc": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"dirty": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"guid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"lock_status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"register_computes": schema.BoolAttribute{
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
"secret": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vins": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"vms": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"resource_types": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"cpu_allocation_parameter": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"cpu_allocation_ratio": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"uniq_pools": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGListComputes() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "ID of the RG",
|
||||
},
|
||||
|
||||
// optional attributes
|
||||
"compute_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",
|
||||
},
|
||||
"tech_status": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by tech status",
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by status",
|
||||
},
|
||||
"ip_address": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by ip address",
|
||||
},
|
||||
"extnet_name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by external network name",
|
||||
},
|
||||
"extnet_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find by external network 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: "size number",
|
||||
},
|
||||
|
||||
//computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
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,
|
||||
},
|
||||
"affinity_label": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"affinity_rules": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"guid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"key": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"mode": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"policy": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"topology": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"value": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"affinity_weight": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"antiaffinity_rules": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"guid": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"key": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"mode": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"policy": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"topology": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"value": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"cpus": 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,
|
||||
},
|
||||
"id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"registered": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rg_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"tech_status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"total_disks_size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"user_managed": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vins_connected": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGListDeleted() 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",
|
||||
},
|
||||
"account_name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by account name",
|
||||
},
|
||||
"created_after": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find by created after time (unix timestamp)",
|
||||
},
|
||||
"created_before": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find by created before time (unix timestamp)",
|
||||
},
|
||||
"lock_status": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by lock status",
|
||||
},
|
||||
"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{
|
||||
"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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"account_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"account_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"compute_features": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"created_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"created_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"def_net_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"def_net_type": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"deleted_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"desc": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"dirty": schema.BoolAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"guid": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"lock_status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"register_computes": schema.BoolAttribute{
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
"secret": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"status": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"updated_by": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vins": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"vms": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.Int64Type,
|
||||
},
|
||||
"resource_types": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"cpu_allocation_parameter": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"cpu_allocation_ratio": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"uniq_pools": schema.ListAttribute{
|
||||
Computed: true,
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGListLB() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "ID of the RG",
|
||||
},
|
||||
|
||||
// optional attributes
|
||||
"by_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find by id",
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by name",
|
||||
},
|
||||
"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",
|
||||
},
|
||||
"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,
|
||||
},
|
||||
"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,
|
||||
},
|
||||
"down_inter": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rise": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"fall": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"slow_start": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"max_conn": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"max_queue": 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,
|
||||
},
|
||||
"down_inter": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"rise": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"fall": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"slow_start": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"max_conn": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"max_queue": 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,
|
||||
},
|
||||
"extnet_id": schema.Int64Attribute{
|
||||
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,
|
||||
},
|
||||
"image_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"milestones": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
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,
|
||||
},
|
||||
"vins_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGListPFW() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "ID of the RG",
|
||||
},
|
||||
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Optional: true,
|
||||
},
|
||||
"items": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"public_port_end": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"public_port_start": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vm_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vm_ip": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vm_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vm_port": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vins_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"vins_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGListVins() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "ID of the RG",
|
||||
},
|
||||
|
||||
// optional attributes
|
||||
"name": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by name",
|
||||
},
|
||||
"account_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find by account id",
|
||||
},
|
||||
"ext_ip": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "find by external ip address",
|
||||
},
|
||||
"vins_id": schema.Int64Attribute{
|
||||
Optional: true,
|
||||
Description: "find by vins 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: "size number",
|
||||
},
|
||||
|
||||
// computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
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,
|
||||
},
|
||||
"id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"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,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGResourceConsumptionList() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
//computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"items": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"consumed": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"cpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"extips": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"seps": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"sep_id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"data_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"reserved": schema.SingleNestedAttribute{
|
||||
Computed: true,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"cpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"extips": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"seps": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"sep_id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"data_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package schemas
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
)
|
||||
|
||||
func MakeSchemaDataSourceRGUsage() map[string]schema.Attribute {
|
||||
return map[string]schema.Attribute{
|
||||
// required attributes
|
||||
"rg_id": schema.Int64Attribute{
|
||||
Required: true,
|
||||
Description: "find by rg id",
|
||||
},
|
||||
|
||||
// optional attributes
|
||||
"reason": schema.StringAttribute{
|
||||
Optional: true,
|
||||
Description: "reason for action",
|
||||
},
|
||||
|
||||
//computed attributes
|
||||
"id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"cpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"extips": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"exttraffic": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"gpu": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"ram": schema.Int64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"seps": schema.ListNestedAttribute{
|
||||
Computed: true,
|
||||
NestedObject: schema.NestedAttributeObject{
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"sep_id": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"data_name": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
"disk_size_max": schema.Float64Attribute{
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user