Files
2025-12-22 16:34:04 +03:00

286 lines
5.5 KiB
Go

package stpolicy
import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
func resourceStoragePolicySchemaMake() map[string]*schema.Schema {
res := map[string]*schema.Schema{
"storage_policy_id": {
Type: schema.TypeInt,
Computed: true,
},
"name": {
Type: schema.TypeString,
Required: true,
},
"access_seps_pools": {
Type: schema.TypeSet,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"pool_name": {
Type: schema.TypeString,
Required: true,
},
"sep_id": {
Type: schema.TypeInt,
Required: true,
},
},
},
},
"description": {
Type: schema.TypeString,
Optional: true,
},
"limit_iops": {
Type: schema.TypeInt,
Optional: true,
},
"enabled": {
Type: schema.TypeBool,
Default: true,
Optional: true,
},
"guid": {
Type: schema.TypeInt,
Computed: true,
},
"status": {
Type: schema.TypeString,
Computed: true,
},
"usage": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"accounts": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
"resgroups": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
},
},
},
}
return res
}
func dataSourceStoragePolicySchemaMake() map[string]*schema.Schema {
res := map[string]*schema.Schema{
"storage_policy_id": {
Type: schema.TypeInt,
Required: true,
},
"description": {
Type: schema.TypeString,
Computed: true,
},
"guid": {
Type: schema.TypeInt,
Computed: true,
},
"limit_iops": {
Type: schema.TypeInt,
Computed: true,
},
"name": {
Type: schema.TypeString,
Computed: true,
},
"status": {
Type: schema.TypeString,
Computed: true,
},
"access_seps_pools": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"pool_names": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"sep_id": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
"usage": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"accounts": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
"resgroups": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
},
},
},
}
return res
}
func dataSourceStoragePolicyListSchemaMake() map[string]*schema.Schema {
res := map[string]*schema.Schema{
"account_id": {
Type: schema.TypeInt,
Optional: true,
},
"page": {
Type: schema.TypeInt,
Optional: true,
},
"size": {
Type: schema.TypeInt,
Optional: true,
},
"by_id": {
Type: schema.TypeInt,
Optional: true,
},
"name": {
Type: schema.TypeString,
Optional: true,
},
"status": {
Type: schema.TypeString,
Optional: true,
},
"desc": {
Type: schema.TypeString,
Optional: true,
},
"limit_iops": {
Type: schema.TypeInt,
Optional: true,
},
"sort_by": {
Type: schema.TypeString,
Optional: true,
},
"resgroup_id": {
Type: schema.TypeInt,
Optional: true,
},
"sep_id": {
Type: schema.TypeInt,
Optional: true,
},
"pool_name": {
Type: schema.TypeString,
Optional: true,
},
"items": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"storage_policy_id": {
Type: schema.TypeInt,
Required: true,
},
"description": {
Type: schema.TypeString,
Computed: true,
},
"guid": {
Type: schema.TypeInt,
Computed: true,
},
"limit_iops": {
Type: schema.TypeInt,
Computed: true,
},
"name": {
Type: schema.TypeString,
Computed: true,
},
"status": {
Type: schema.TypeString,
Computed: true,
},
"access_seps_pools": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"pool_names": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"sep_id": {
Type: schema.TypeInt,
Computed: true,
},
"sep_name": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
"usage": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"accounts": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
"resgroups": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeInt,
},
},
},
},
},
},
},
},
"entry_count": {
Type: schema.TypeInt,
Computed: true,
},
}
return res
}