1.0.0
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package utilities
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/vfpool"
|
||||
)
|
||||
|
||||
func VFPoolCheckPresence(ctx context.Context, vfPoolID uint64, c *decort.DecortClient) (*vfpool.RecordVFPool,
|
||||
error) {
|
||||
req := vfpool.GetRequest{VFPoolID: vfPoolID}
|
||||
|
||||
tflog.Info(ctx, "VFPoolCheckPresence: before call CloudAPI().VFPool().Get", map[string]any{"req": req})
|
||||
vfPool, err := c.CloudAPI().VFPool().Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("VFPoolCheckPresence: cannot get info about vfpool")
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "VFPoolCheckPresence: response from CloudAPI().VFPool().Get", map[string]any{"response": vfPool})
|
||||
|
||||
return vfPool, err
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package utilities
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/vfpool"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/vfpool/models"
|
||||
)
|
||||
|
||||
func VFPoolListCheckPresence(ctx context.Context, plan *models.ListVFPoolModel, c *decort.DecortClient) (*vfpool.ListVFPool,
|
||||
error) {
|
||||
req := vfpool.ListRequest{}
|
||||
|
||||
if !plan.ByID.IsNull() {
|
||||
req.ByID = uint64(plan.ByID.ValueInt64())
|
||||
}
|
||||
if !plan.GID.IsNull() {
|
||||
req.GID = uint64(plan.GID.ValueInt64())
|
||||
}
|
||||
if !plan.Name.IsNull() {
|
||||
req.Name = plan.Name.ValueString()
|
||||
}
|
||||
if !plan.Description.IsNull() {
|
||||
req.Description = plan.Description.ValueString()
|
||||
}
|
||||
if !plan.Status.IsNull() {
|
||||
req.Status = plan.Status.ValueString()
|
||||
}
|
||||
if !plan.AccountAccess.IsNull() {
|
||||
req.AccountAccess = uint64(plan.AccountAccess.ValueInt64())
|
||||
}
|
||||
if !plan.RgAccess.IsNull() {
|
||||
req.RGAccess = uint64(plan.RgAccess.ValueInt64())
|
||||
}
|
||||
if !plan.SortBy.IsNull() {
|
||||
req.SortBy = plan.SortBy.ValueString()
|
||||
}
|
||||
if !plan.Page.IsNull() {
|
||||
req.Page = uint64(plan.Page.ValueInt64())
|
||||
}
|
||||
if !plan.Size.IsNull() {
|
||||
req.Size = uint64(plan.Size.ValueInt64())
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "VFPoolListCheckPresence: before call CloudAPI().VFPool().List", map[string]any{"req": req})
|
||||
vfPool, err := c.CloudAPI().VFPool().List(ctx, req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("VFPoolListCheckPresence: cannot get info about vfpool list")
|
||||
}
|
||||
|
||||
tflog.Info(ctx, "VFPoolListCheckPresence: response from CloudAPI().VFPool().Get", map[string]any{"response": vfPool})
|
||||
|
||||
return vfPool, err
|
||||
}
|
||||
Reference in New Issue
Block a user