4.6.0
This commit is contained in:
68
internal/service/cloudbroker/vfpool/data_source_vfpool.go
Normal file
68
internal/service/cloudbroker/vfpool/data_source_vfpool.go
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package vfpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func dataSourceVFPoolRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
vfpool, err := utilityVFpoolCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("") // ensure ID is empty in this case
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
d.SetId(strconv.Itoa(d.Get("vfpool_id").(int)))
|
||||
flattenVFPoolDataSource(d, vfpool)
|
||||
return nil
|
||||
}
|
||||
|
||||
func DataSourceVFPool() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
ReadContext: dataSourceVFPoolRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &constants.Timeout30s,
|
||||
Default: &constants.Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceVFPoolSchemaMake(),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package vfpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func dataSourceVFPoolListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
vfpoolList, err := utilityVFpoolListCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("") // ensure ID is empty in this case
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
id := uuid.New()
|
||||
d.SetId(id.String())
|
||||
d.Set("items", flattenVFPoolList(vfpoolList))
|
||||
d.Set("entry_count", vfpoolList.EntryCount)
|
||||
return nil
|
||||
}
|
||||
|
||||
func DataSourceVFPoolList() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
ReadContext: dataSourceVFPoolListRead,
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Read: &constants.Timeout30s,
|
||||
Default: &constants.Timeout60s,
|
||||
},
|
||||
|
||||
Schema: dataSourceVFPoolListSchemaMake(),
|
||||
}
|
||||
}
|
||||
142
internal/service/cloudbroker/vfpool/flattens.go
Normal file
142
internal/service/cloudbroker/vfpool/flattens.go
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package vfpool
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/vfpool"
|
||||
)
|
||||
|
||||
func flattenVFPoolList(vfpooll *vfpool.ListVFPool) []map[string]interface{} {
|
||||
log.Debugf("flattenVFPoolList start")
|
||||
res := make([]map[string]interface{}, 0, len(vfpooll.Data))
|
||||
for _, vfpool := range vfpooll.Data {
|
||||
temp := map[string]interface{}{
|
||||
"account_access": vfpool.AccountAccess,
|
||||
"created_time": vfpool.CreatedTime,
|
||||
"description": vfpool.Description,
|
||||
"gid": vfpool.GID,
|
||||
"guid": vfpool.GUID,
|
||||
"vfpool_id": vfpool.ID,
|
||||
"name": vfpool.Name,
|
||||
"rg_access": vfpool.RGAccess,
|
||||
"status": vfpool.Status,
|
||||
"updated_time": vfpool.UpdatedTime,
|
||||
"vfs": flattenVFSList(vfpool.VFS),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
log.Debugf("flattenVFPoolList end")
|
||||
return res
|
||||
|
||||
}
|
||||
|
||||
func flattenVFPoolDataSource(d *schema.ResourceData, item *vfpool.RecordVFPool) error {
|
||||
log.Debugf("flattenVFPoolDataSource: start decoded VFPool name %q / ID %d",
|
||||
item.Name, item.ID)
|
||||
|
||||
d.Set("account_access", item.AccountAccess)
|
||||
d.Set("created_time", item.CreatedTime)
|
||||
d.Set("description", item.Description)
|
||||
d.Set("gid", item.GID)
|
||||
d.Set("guid", item.GUID)
|
||||
d.Set("name", item.Name)
|
||||
d.Set("rg_access", item.RGAccess)
|
||||
d.Set("status", item.Status)
|
||||
d.Set("updated_time", item.UpdatedTime)
|
||||
d.Set("vfs", flattenVFSList(item.VFS))
|
||||
|
||||
log.Debugf("flattenVFPoolDataSource: decoded VFPool name %q / ID %d, complete",
|
||||
item.Name, item.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
func flattenVFPoolResource(d *schema.ResourceData, item *vfpool.RecordVFPool) error {
|
||||
log.Debugf("flattenVFPoolResource: start decoded VFPool name %q / ID %d",
|
||||
item.Name, item.ID)
|
||||
|
||||
d.Set("account_access", item.AccountAccess)
|
||||
d.Set("created_time", item.CreatedTime)
|
||||
d.Set("description", item.Description)
|
||||
d.Set("gid", item.GID)
|
||||
d.Set("guid", item.GUID)
|
||||
d.Set("vfpool_id", item.ID)
|
||||
d.Set("name", item.Name)
|
||||
d.Set("rg_access", item.RGAccess)
|
||||
d.Set("status", item.Status)
|
||||
d.Set("updated_time", item.UpdatedTime)
|
||||
d.Set("vfs", flattenVFSList(item.VFS))
|
||||
|
||||
log.Debugf("flattenVFPoolResource: decoded VFPool name %q / ID %d, complete",
|
||||
item.Name, item.ID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func flattenVFSList(vfsItem []vfpool.VFS) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(vfsItem))
|
||||
for _, item := range vfsItem {
|
||||
temp := map[string]interface{}{
|
||||
"node_id": item.NodeID,
|
||||
"vf_list": flattenVFList(item.VFList),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenVFList(vfItem vfpool.VFList) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(vfItem))
|
||||
for _, item := range vfItem {
|
||||
temp := map[string]interface{}{
|
||||
"nic_name": item.NicName,
|
||||
"vfs_info": flattenVFInfoList(item.VFSInfo),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenVFInfoList(vfInfo vfpool.VFSInfoList) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(vfInfo))
|
||||
for _, item := range vfInfo {
|
||||
temp := map[string]interface{}{
|
||||
"id": item.ID,
|
||||
"claimed": item.Claimed,
|
||||
"vm_id": item.VMID,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package vfpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/dc"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/ic"
|
||||
)
|
||||
|
||||
func checkParamsExistence(ctx context.Context, c *controller.ControllerCfg, accountIDs, rgIDs []uint64) diag.Diagnostics {
|
||||
var errs []error
|
||||
|
||||
if err := ic.ExistAccouts(ctx, accountIDs, c); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
if err := ic.ExistRGs(ctx, rgIDs, c); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
return dc.ErrorsToDiagnostics(errs)
|
||||
}
|
||||
230
internal/service/cloudbroker/vfpool/resource_vfpool.go
Normal file
230
internal/service/cloudbroker/vfpool/resource_vfpool.go
Normal file
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
Copyright (c) 2019-2024 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package vfpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/vfpool"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/dc"
|
||||
)
|
||||
|
||||
func resourceVFPoolCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
vfpoolName := d.Get("name").(string)
|
||||
|
||||
log.Debugf("resourceVFPoolCreate: called VFPool with name %s", vfpoolName)
|
||||
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
req := vfpool.CreateRequest{
|
||||
Name: vfpoolName,
|
||||
}
|
||||
|
||||
if desc, ok := d.GetOk("description"); ok {
|
||||
req.Description = desc.(string)
|
||||
}
|
||||
|
||||
if accountAccess, ok := d.GetOk("account_access"); ok {
|
||||
accountAccessArray := accountAccess.(*schema.Set).List()
|
||||
|
||||
req.AccountAccess = make([]uint64, 0, len(accountAccessArray))
|
||||
|
||||
for _, access := range accountAccessArray {
|
||||
req.AccountAccess = append(req.AccountAccess, uint64(access.(int)))
|
||||
}
|
||||
}
|
||||
|
||||
if rgAccess, ok := d.GetOk("rg_access"); ok {
|
||||
rgAccessArray := rgAccess.(*schema.Set).List()
|
||||
|
||||
req.RGAccess = make([]uint64, 0, len(rgAccessArray))
|
||||
|
||||
for _, access := range rgAccessArray {
|
||||
req.RGAccess = append(req.RGAccess, uint64(access.(int)))
|
||||
}
|
||||
}
|
||||
|
||||
if err := checkParamsExistence(ctx, c, req.AccountAccess, req.RGAccess); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
config, configOk := d.GetOk("config")
|
||||
if configOk {
|
||||
configArray := config.(*schema.Set).List()
|
||||
req.Config = make([]vfpool.Config, 0, len(configArray))
|
||||
|
||||
for _, access := range configArray {
|
||||
temp := access.(map[string]interface{})
|
||||
|
||||
vfArray := temp["vf_ids"].([]interface{})
|
||||
resVfIds := make([]uint64, 0, len(vfArray))
|
||||
|
||||
for _, vfID := range vfArray {
|
||||
resVfIds = append(resVfIds, uint64(vfID.(int)))
|
||||
}
|
||||
|
||||
reqTemp := vfpool.Config{
|
||||
NodeID: uint64(temp["node_id"].(int)),
|
||||
NicName: temp["nic_name"].(string),
|
||||
VFIDs: resVfIds,
|
||||
}
|
||||
req.Config = append(req.Config, reqTemp)
|
||||
}
|
||||
}
|
||||
|
||||
vfPoolID, err := c.CloudBroker().VFPool().Create(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
d.SetId(strconv.FormatUint(vfPoolID, 10))
|
||||
|
||||
warnings := dc.Warnings{}
|
||||
|
||||
if enable, ok := d.GetOk("enable"); ok {
|
||||
if err := utilityVFPoolEnabled(ctx, m, enable.(bool), vfPoolID, configOk); err != nil {
|
||||
warnings.Add(err)
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("resourceVFPoolCreate: create VFPool with ID: %d, complete", vfPoolID)
|
||||
return append(resourceVFPoolRead(ctx, d, m), warnings.Get()...)
|
||||
}
|
||||
|
||||
func resourceVFPoolRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
log.Debugf("resourceVFPoolRead: called VFPool with id %s", d.Id())
|
||||
|
||||
vfPool, err := utilityVFpoolCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("")
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
flattenVFPoolResource(d, vfPool)
|
||||
|
||||
log.Debugf("resourceVFPoolRead: read VFPool with id %s, complete", d.Id())
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceVFPoolUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
vfPoolID, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
|
||||
log.Debugf("resourceVFPoolUpdate: called VFPool with id %d", vfPoolID)
|
||||
|
||||
_, ok := d.GetOk("config")
|
||||
|
||||
if d.HasChanges("name,", "description", "account_access", "rg_access,", "config") {
|
||||
if err := utilityVFPoolUpdate(ctx, d, m, vfPoolID); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
|
||||
if d.HasChange("enable") {
|
||||
if err := utilityVFPoolEnabled(ctx, m, d.Get("enable").(bool), vfPoolID, ok); err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("resourceVFPoolUpdate: update VFPool with id %d, complete", vfPoolID)
|
||||
|
||||
return resourceVFPoolRead(ctx, d, m)
|
||||
}
|
||||
|
||||
func resourceVFPoolDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
||||
log.Debugf("resourceVFPoolDelete: called VFPool with id %s", d.Id())
|
||||
|
||||
vfPool, err := utilityVFpoolCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("")
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
req := vfpool.DeleteRequest{
|
||||
VFPoolID: vfPool.ID,
|
||||
}
|
||||
|
||||
if vfPool.Status == "ENABLED" || vfPool.Status == "CREATED" {
|
||||
reqDisable := vfpool.DisableRequest{
|
||||
VFPoolID: vfPool.ID,
|
||||
}
|
||||
|
||||
log.Debugf("resourceVFPoolDelete: need to disable vfPool with ID: %d, after delete", vfPool.ID)
|
||||
_, err = c.CloudBroker().VFPool().Disable(ctx, reqDisable)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
log.Debugf("resourceVFPoolDelete: disable vfPool with ID: %d, complete", vfPool.ID)
|
||||
}
|
||||
|
||||
_, err = c.CloudBroker().VFPool().Delete(ctx, req)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
d.SetId("")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ResourceVFPool() *schema.Resource {
|
||||
return &schema.Resource{
|
||||
SchemaVersion: 1,
|
||||
|
||||
CreateContext: resourceVFPoolCreate,
|
||||
ReadContext: resourceVFPoolRead,
|
||||
UpdateContext: resourceVFPoolUpdate,
|
||||
DeleteContext: resourceVFPoolDelete,
|
||||
|
||||
Importer: &schema.ResourceImporter{
|
||||
StateContext: schema.ImportStatePassthroughContext,
|
||||
},
|
||||
|
||||
Timeouts: &schema.ResourceTimeout{
|
||||
Create: &constants.Timeout20m,
|
||||
Read: &constants.Timeout20m,
|
||||
Update: &constants.Timeout20m,
|
||||
Delete: &constants.Timeout20m,
|
||||
Default: &constants.Timeout20m,
|
||||
},
|
||||
|
||||
Schema: resourceVFPoolSchemaMake(),
|
||||
}
|
||||
}
|
||||
394
internal/service/cloudbroker/vfpool/schema.go
Normal file
394
internal/service/cloudbroker/vfpool/schema.go
Normal file
@@ -0,0 +1,394 @@
|
||||
package vfpool
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func dataSourceVFPoolSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"vfpool_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
},
|
||||
"account_access": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"rg_access": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vfs": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vf_list": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"nic_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"vfs_info": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"claimed": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"vm_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func dataSourceVFPoolListSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"by_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by ID",
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by Grid ID",
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by name",
|
||||
},
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by description",
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Find by status",
|
||||
},
|
||||
"account_access": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by accountAccess",
|
||||
},
|
||||
"rg_access": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Find by rgAccess",
|
||||
},
|
||||
"sort_by": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "sort by one of supported fields, format +|-(field)",
|
||||
},
|
||||
"page": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page number",
|
||||
},
|
||||
"size": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Page size",
|
||||
},
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"account_access": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vfpool_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"rg_access": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vfs": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vf_list": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"nic_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"vfs_info": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"claimed": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"vm_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"entry_count": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
func resourceVFPoolSchemaMake() map[string]*schema.Schema {
|
||||
res := map[string]*schema.Schema{
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Description: "Name of device",
|
||||
},
|
||||
"description": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Description: "Description",
|
||||
},
|
||||
"account_access": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of account IDs",
|
||||
},
|
||||
"rg_access": {
|
||||
Type: schema.TypeSet,
|
||||
Computed: true,
|
||||
Optional: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
Description: "List of RG IDs",
|
||||
},
|
||||
"config": {
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Required: true,
|
||||
},
|
||||
"nic_name": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
},
|
||||
"vf_ids": {
|
||||
Required: true,
|
||||
Type: schema.TypeList,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
},
|
||||
MinItems: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
Description: "List of dict describing configuration data",
|
||||
},
|
||||
"enable": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
"created_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"gid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vfpool_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"status": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"updated_time": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vfs": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"node_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"vf_list": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"nic_name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"vfs_info": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"claimed": {
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
},
|
||||
"vm_id": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
209
internal/service/cloudbroker/vfpool/utility_vfpool.go
Normal file
209
internal/service/cloudbroker/vfpool/utility_vfpool.go
Normal file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package vfpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/vfpool"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/service/cloudbroker/ic"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func utilityVFpoolCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*vfpool.RecordVFPool, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := vfpool.GetRequest{}
|
||||
|
||||
if d.Id() != "" {
|
||||
vfpoolId, _ := strconv.ParseUint(d.Id(), 10, 64)
|
||||
req.VFPoolID = vfpoolId
|
||||
} else {
|
||||
req.VFPoolID = uint64(d.Get("vfpool_id").(int))
|
||||
}
|
||||
|
||||
vfpoolData, err := c.CloudBroker().VFPool().Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return vfpoolData, nil
|
||||
}
|
||||
|
||||
func utilityVFPoolEnabled(ctx context.Context, m interface{}, enable bool, vfPoolID uint64, configOk bool) error {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
if enable && configOk {
|
||||
req := vfpool.EnableRequest{
|
||||
VFPoolID: vfPoolID,
|
||||
}
|
||||
_, err := c.CloudBroker().VFPool().Enable(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if enable && !configOk {
|
||||
return fmt.Errorf("you must provide configuration for this resource, after enabling it")
|
||||
}
|
||||
if !enable {
|
||||
req := vfpool.DisableRequest{
|
||||
VFPoolID: vfPoolID,
|
||||
}
|
||||
_, err := c.CloudBroker().VFPool().Disable(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
log.Debugf("utilityVFPoolEnabled: enable=%v vfPool ID %d after completing its resource configuration", enable, vfPoolID)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func utilityVFPoolUpdate(ctx context.Context, d *schema.ResourceData, m interface{}, vfPoolID uint64) error {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
|
||||
vfPool, err := utilityVFpoolCheckPresence(ctx, d, m)
|
||||
if err != nil {
|
||||
d.SetId("")
|
||||
return err
|
||||
}
|
||||
|
||||
req := vfpool.UpdateRequest{
|
||||
VFPoolID: vfPoolID,
|
||||
}
|
||||
|
||||
if d.HasChange("name") {
|
||||
req.Name = d.Get("name").(string)
|
||||
}
|
||||
if d.HasChange("description") {
|
||||
req.Description = d.Get("description").(string)
|
||||
}
|
||||
|
||||
if config, ok := d.GetOk("config"); ok {
|
||||
configArray := config.(*schema.Set).List()
|
||||
req.Config = make([]vfpool.Config, 0, len(configArray))
|
||||
|
||||
for _, access := range configArray {
|
||||
temp := access.(map[string]interface{})
|
||||
|
||||
vfArray := temp["vf_ids"].([]interface{})
|
||||
resVfIds := make([]uint64, 0, len(vfArray))
|
||||
|
||||
for _, vfID := range vfArray {
|
||||
resVfIds = append(resVfIds, uint64(vfID.(int)))
|
||||
}
|
||||
|
||||
reqTemp := vfpool.Config{
|
||||
NodeID: uint64(temp["node_id"].(int)),
|
||||
NicName: temp["nic_name"].(string),
|
||||
VFIDs: resVfIds,
|
||||
}
|
||||
req.Config = append(req.Config, reqTemp)
|
||||
}
|
||||
} else {
|
||||
req.Config = []vfpool.Config{}
|
||||
}
|
||||
|
||||
if accountAccess, ok := d.GetOk("account_access"); ok {
|
||||
accountAccessArray := accountAccess.(*schema.Set).List()
|
||||
|
||||
req.AccountAccess = make([]uint64, 0, len(accountAccessArray))
|
||||
|
||||
for _, access := range accountAccessArray {
|
||||
req.AccountAccess = append(req.AccountAccess, uint64(access.(int)))
|
||||
}
|
||||
|
||||
if err := ic.ExistAccouts(ctx, req.AccountAccess, c); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
req.AccountAccess = []uint64{}
|
||||
}
|
||||
|
||||
if rgAccess, ok := d.GetOk("rg_access"); ok {
|
||||
rgAccessArray := rgAccess.(*schema.Set).List()
|
||||
|
||||
req.RGAccess = make([]uint64, 0, len(rgAccessArray))
|
||||
|
||||
for _, access := range rgAccessArray {
|
||||
req.RGAccess = append(req.RGAccess, uint64(access.(int)))
|
||||
}
|
||||
|
||||
if err := ic.ExistRGs(ctx, req.RGAccess, c); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
req.RGAccess = []uint64{}
|
||||
}
|
||||
|
||||
if vfPool.Status == "ENABLED" || vfPool.Status == "CREATED" {
|
||||
reqDisable := vfpool.DisableRequest{
|
||||
VFPoolID: vfPoolID,
|
||||
}
|
||||
|
||||
log.Debugf("utilityVFPoolUpdate: need to disable vfPool with ID: %d, after update", vfPoolID)
|
||||
_, err = c.CloudBroker().VFPool().Disable(ctx, reqDisable)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Debugf("utilityVFPoolUpdate: disable vfPool with ID: %d, complete", vfPoolID)
|
||||
}
|
||||
|
||||
_, err = c.CloudBroker().VFPool().Update(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Debugf("utilityVFPoolUpdate: update vfPool with ID: %d, complete with params=%v", vfPoolID, req)
|
||||
|
||||
if len(d.Get("config").(*schema.Set).List()) > 0 && d.Get("enable").(bool) {
|
||||
reqEnable := vfpool.EnableRequest{
|
||||
VFPoolID: vfPoolID,
|
||||
}
|
||||
|
||||
log.Debugf("utilityVFPoolUpdate: start to enable vfPool with ID: %d, after update", vfPoolID)
|
||||
_, err = c.CloudBroker().VFPool().Enable(ctx, reqEnable)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Debugf("utilityVFPoolUpdate: enable vfPool with ID: %d, complete", vfPoolID)
|
||||
} else {
|
||||
return (fmt.Errorf("the vfPool is not enabled after update, you must provide configuration for this resource, after enabling it"))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
85
internal/service/cloudbroker/vfpool/utility_vfpool_list.go
Normal file
85
internal/service/cloudbroker/vfpool/utility_vfpool_list.go
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
||||
Authors:
|
||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
||||
Orchestration Technology) with Terraform by Hashicorp.
|
||||
|
||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
||||
|
||||
Please see README.md to learn where to place source code so that it
|
||||
builds seamlessly.
|
||||
|
||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||
*/
|
||||
|
||||
package vfpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/vfpool"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
func utilityVFpoolListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (*vfpool.ListVFPool, error) {
|
||||
c := m.(*controller.ControllerCfg)
|
||||
req := vfpool.ListRequest{}
|
||||
|
||||
if byId, ok := d.GetOk("by_id"); ok {
|
||||
req.ByID = uint64(byId.(int))
|
||||
}
|
||||
if gid, ok := d.GetOk("gid"); ok {
|
||||
req.GID = uint64(gid.(int))
|
||||
}
|
||||
if name, ok := d.GetOk("name"); ok {
|
||||
req.Name = name.(string)
|
||||
}
|
||||
if description, ok := d.GetOk("description"); ok {
|
||||
req.Description = description.(string)
|
||||
}
|
||||
if status, ok := d.GetOk("status"); ok {
|
||||
req.Status = status.(string)
|
||||
}
|
||||
if accountAccess, ok := d.GetOk("account_access"); ok {
|
||||
req.AccountAccess = uint64(accountAccess.(int))
|
||||
}
|
||||
if rgAccess, ok := d.GetOk("rg_access"); ok {
|
||||
req.RGAccess = uint64(rgAccess.(int))
|
||||
}
|
||||
if sortBy, ok := d.GetOk("sort_by"); ok {
|
||||
req.SortBy = sortBy.(string)
|
||||
}
|
||||
if size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(size.(int))
|
||||
}
|
||||
if page, ok := d.GetOk("page"); ok {
|
||||
req.Page = uint64(page.(int))
|
||||
}
|
||||
|
||||
vfpoolList, err := c.CloudBroker().VFPool().List(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return vfpoolList, nil
|
||||
}
|
||||
Reference in New Issue
Block a user