You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.2 KiB
30 lines
1.2 KiB
package utilities
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudbroker/rg/models"
|
|
|
|
"github.com/hashicorp/terraform-plugin-log/tflog"
|
|
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/rg"
|
|
)
|
|
|
|
func RGAffinityGroupComputesCheckPresence(ctx context.Context, plan *models.DataSourceRGAffinityGroupComputesModel, c *decort.DecortClient) (*rg.ListAffinityGroupCompute, error) {
|
|
agCompsReq := rg.AffinityGroupComputesRequest{
|
|
RGID: uint64(plan.RGID.ValueInt64()),
|
|
AffinityGroup: plan.AffinityGroup.ValueString(),
|
|
}
|
|
|
|
tflog.Info(ctx, "RGAffinityGroupComputesCheckPresence: before call CloudBroker().RG().AffinityGroupComputes", map[string]any{"req": agCompsReq})
|
|
agCompsList, err := c.CloudBroker().RG().AffinityGroupComputes(ctx, agCompsReq)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("cannot get info about resource group affinity group computes with error: %w", err)
|
|
}
|
|
|
|
tflog.Info(ctx, "RGAffinityGroupComputesCheckPresence: response from CloudBroker().RG().AffinityGroupComputes", map[string]any{"response": agCompsList})
|
|
|
|
return &agCompsList, err
|
|
}
|