made pool and sep_id optional and account_id required

gos_tech_4.4.3
kjubybot 3 years ago
parent 56e71c8981
commit 9a806a8e2c
No known key found for this signature in database
GPG Key ID: E55254690327C021

@ -47,8 +47,14 @@ func resourceDiskCreate(d *schema.ResourceData, m interface{}) error {
urlValues.Add("name", d.Get("name").(string)) urlValues.Add("name", d.Get("name").(string))
urlValues.Add("size", fmt.Sprintf("%d", d.Get("size").(int))) urlValues.Add("size", fmt.Sprintf("%d", d.Get("size").(int)))
urlValues.Add("type", "D") // NOTE: only disks of Data type are managed via plugin urlValues.Add("type", "D") // NOTE: only disks of Data type are managed via plugin
urlValues.Add("sep_id", fmt.Sprintf("%d", d.Get("sep_id").(int)))
urlValues.Add("pool", d.Get("pool").(string)) if sepId, ok := d.GetOk("sep_id"); ok {
urlValues.Add("sep_id", strconv.Itoa(sepId.(int)))
}
if poolName, ok := d.GetOk("pool"); ok {
urlValues.Add("pool", poolName.(string))
}
argVal, argSet := d.GetOk("description") argVal, argSet := d.GetOk("description")
if argSet { if argSet {
@ -198,7 +204,7 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
rets := map[string]*schema.Schema{ rets := map[string]*schema.Schema{
"name": { "name": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Required: true,
Description: "Name of this disk. NOTE: disk names are NOT unique within an account. If disk ID is specified, disk name is ignored.", Description: "Name of this disk. NOTE: disk names are NOT unique within an account. If disk ID is specified, disk name is ignored.",
}, },
@ -210,23 +216,23 @@ func resourceDiskSchemaMake() map[string]*schema.Schema {
"account_id": { "account_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Optional: true, Required: true,
Description: "ID of the account this disk belongs to.", Description: "ID of the account this disk belongs to.",
}, },
"sep_id": { "sep_id": {
Type: schema.TypeInt, Type: schema.TypeInt,
Required: true, Optional: true,
Computed: true,
ForceNew: true, ForceNew: true,
ValidateFunc: validation.IntAtLeast(1),
Description: "Storage end-point provider serving this disk. Cannot be changed for existing disk.", Description: "Storage end-point provider serving this disk. Cannot be changed for existing disk.",
}, },
"pool": { "pool": {
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Optional: true,
Computed: true,
ForceNew: true, ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "Pool where this disk is located. Cannot be changed for existing disk.", Description: "Pool where this disk is located. Cannot be changed for existing disk.",
}, },

Loading…
Cancel
Save