This commit is contained in:
asteam
2025-01-21 12:16:49 +03:00
parent 76ea459b3d
commit 60e23338ad
751 changed files with 17877 additions and 1908 deletions

View File

@@ -5,7 +5,6 @@ import (
"context"
"fmt"
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
account "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/account"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/disks"
@@ -20,9 +19,10 @@ import (
stack "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack"
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/vfpool"
vins "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/vins"
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
)
func ExistRG(ctx context.Context, rgId uint64, c *decort.DecortClient) error {
func ExistRG(ctx context.Context, rgId uint64, c *client.Client) error {
req := rg.ListRequest{
ByID: rgId,
IncludeDeleted: false,
@@ -40,7 +40,7 @@ func ExistRG(ctx context.Context, rgId uint64, c *decort.DecortClient) error {
return nil
}
func ExistImage(ctx context.Context, imageId uint64, c *decort.DecortClient) error {
func ExistImage(ctx context.Context, imageId uint64, c *client.Client) error {
req := image.ListRequest{
ByID: imageId,
}
@@ -57,7 +57,7 @@ func ExistImage(ctx context.Context, imageId uint64, c *decort.DecortClient) err
return nil
}
func ExistVins(ctx context.Context, vinsId uint64, c *decort.DecortClient) error {
func ExistVins(ctx context.Context, vinsId uint64, c *client.Client) error {
req := vins.ListRequest{
ByID: vinsId,
IncludeDeleted: false,
@@ -75,7 +75,7 @@ func ExistVins(ctx context.Context, vinsId uint64, c *decort.DecortClient) error
return nil
}
func ExistVinses(ctx context.Context, vinsIds []uint64, c *decort.DecortClient) []error {
func ExistVinses(ctx context.Context, vinsIds []uint64, c *client.Client) []error {
var errs []error
req := vins.ListRequest{
@@ -106,7 +106,7 @@ func ExistVinses(ctx context.Context, vinsIds []uint64, c *decort.DecortClient)
return errs
}
func ExistExtNets(ctx context.Context, extNetIds []uint64, c *decort.DecortClient) []error {
func ExistExtNets(ctx context.Context, extNetIds []uint64, c *client.Client) []error {
var errs []error
req := extnet.ListRequest{}
@@ -135,7 +135,7 @@ func ExistExtNets(ctx context.Context, extNetIds []uint64, c *decort.DecortClien
return errs
}
func ExistExtNetInLb(ctx context.Context, extNetId uint64, c *decort.DecortClient) error {
func ExistExtNetInLb(ctx context.Context, extNetId uint64, c *client.Client) error {
if extNetId == 0 {
return nil
}
@@ -155,7 +155,7 @@ func ExistExtNetInLb(ctx context.Context, extNetId uint64, c *decort.DecortClien
return nil
}
func ExistExtNetInRG(ctx context.Context, extNetId, accountId uint64, c *decort.DecortClient) error {
func ExistExtNetInRG(ctx context.Context, extNetId, accountId uint64, c *client.Client) error {
req := extnet.ListRequest{
AccountID: accountId,
ByID: extNetId,
@@ -173,7 +173,7 @@ func ExistExtNetInRG(ctx context.Context, extNetId, accountId uint64, c *decort.
return nil
}
func ExistExtNetInVins(ctx context.Context, extNetId int, c *decort.DecortClient) error {
func ExistExtNetInVins(ctx context.Context, extNetId int, c *client.Client) error {
if extNetId == 0 || extNetId == -1 {
return nil
}
@@ -193,7 +193,7 @@ func ExistExtNetInVins(ctx context.Context, extNetId int, c *decort.DecortClient
return nil
}
func ExistExtNet(ctx context.Context, extNetId uint64, c *decort.DecortClient) error {
func ExistExtNet(ctx context.Context, extNetId uint64, c *client.Client) error {
req := extnet.ListRequest{
ByID: extNetId,
@@ -212,7 +212,7 @@ func ExistExtNet(ctx context.Context, extNetId uint64, c *decort.DecortClient) e
return nil
}
func ExistVinsInLb(ctx context.Context, vinsId uint64, c *decort.DecortClient) error {
func ExistVinsInLb(ctx context.Context, vinsId uint64, c *client.Client) error {
if vinsId == 0 {
return nil
}
@@ -233,7 +233,7 @@ func ExistVinsInLb(ctx context.Context, vinsId uint64, c *decort.DecortClient) e
return nil
}
func ExistGID(ctx context.Context, gid uint64, c *decort.DecortClient) error {
func ExistGID(ctx context.Context, gid uint64, c *client.Client) error {
req := location.ListRequest{}
gridList, err := c.CloudAPI().Locations().List(ctx, req)
@@ -250,7 +250,7 @@ func ExistGID(ctx context.Context, gid uint64, c *decort.DecortClient) error {
return fmt.Errorf("GID with id %v not found", gid)
}
func ExistStack(ctx context.Context, stackId uint64, c *decort.DecortClient) error {
func ExistStack(ctx context.Context, stackId uint64, c *client.Client) error {
req := stack.ListRequest{
ByID: stackId,
}
@@ -268,7 +268,7 @@ func ExistStack(ctx context.Context, stackId uint64, c *decort.DecortClient) err
}
// // ExistStackInPcidevice checks if compute exists with specified stackId and specified non-deleted rgId.
// func ExistStackInPcidevice(ctx context.Context, stackId, rgId uint64, c *decort.DecortClient) error {
// func ExistStackInPcidevice(ctx context.Context, stackId, rgId uint64, c *client.Client) error {
// req := rg.ListRequest{
// ByID: rgId,
// IncludeDeleted: false,
@@ -297,7 +297,7 @@ func ExistStack(ctx context.Context, stackId uint64, c *decort.DecortClient) err
// return fmt.Errorf("no compute found with stack_id %v and rg_id %v", stackId, rgId)
// }
func ExistLB(ctx context.Context, lbId uint64, c *decort.DecortClient) error {
func ExistLB(ctx context.Context, lbId uint64, c *client.Client) error {
req := lb.ListRequest{
ByID: lbId,
@@ -316,7 +316,7 @@ func ExistLB(ctx context.Context, lbId uint64, c *decort.DecortClient) error {
}
func ExistDiskID(ctx context.Context, diskId uint64, c *decort.DecortClient) error {
func ExistDiskID(ctx context.Context, diskId uint64, c *client.Client) error {
req := disks.ListRequest{
ByID: diskId,
@@ -338,7 +338,7 @@ func ExistDiskID(ctx context.Context, diskId uint64, c *decort.DecortClient) err
return nil
}
func ExistAccount(ctx context.Context, accountId uint64, c *decort.DecortClient) error {
func ExistAccount(ctx context.Context, accountId uint64, c *client.Client) error {
req := account.ListRequest{
ByID: accountId,
}
@@ -355,7 +355,7 @@ func ExistAccount(ctx context.Context, accountId uint64, c *decort.DecortClient)
return nil
}
func ExistK8CI(ctx context.Context, k8ciId uint64, c *decort.DecortClient) error {
func ExistK8CI(ctx context.Context, k8ciId uint64, c *client.Client) error {
req := k8ci.ListRequest{
ByID: k8ciId,
}
@@ -372,7 +372,7 @@ func ExistK8CI(ctx context.Context, k8ciId uint64, c *decort.DecortClient) error
return nil
}
func ExistExtNetInK8s(ctx context.Context, extNetId uint64, c *decort.DecortClient) error {
func ExistExtNetInK8s(ctx context.Context, extNetId uint64, c *client.Client) error {
if extNetId == 0 {
return nil
}
@@ -392,7 +392,7 @@ func ExistExtNetInK8s(ctx context.Context, extNetId uint64, c *decort.DecortClie
return nil
}
func ExistVinsInK8s(ctx context.Context, vinsId uint64, c *decort.DecortClient) error {
func ExistVinsInK8s(ctx context.Context, vinsId uint64, c *client.Client) error {
if vinsId == 0 {
return nil
}
@@ -413,7 +413,7 @@ func ExistVinsInK8s(ctx context.Context, vinsId uint64, c *decort.DecortClient)
return nil
}
func ExistK8s(ctx context.Context, k8sId uint64, c *decort.DecortClient) error {
func ExistK8s(ctx context.Context, k8sId uint64, c *client.Client) error {
req := k8s.ListRequest{
ByID: k8sId,
}
@@ -430,7 +430,7 @@ func ExistK8s(ctx context.Context, k8sId uint64, c *decort.DecortClient) error {
return nil
}
func ExistVFPool(ctx context.Context, vfpoolId uint64, c *decort.DecortClient) error {
func ExistVFPool(ctx context.Context, vfpoolId uint64, c *client.Client) error {
req := vfpool.ListRequest{
ByID: vfpoolId,
@@ -449,7 +449,7 @@ func ExistVFPool(ctx context.Context, vfpoolId uint64, c *decort.DecortClient) e
return nil
}
func ExistDPDK(ctx context.Context, dpdkId uint64, c *decort.DecortClient) error {
func ExistDPDK(ctx context.Context, dpdkId uint64, c *client.Client) error {
req := dpdknet.ListRequest{
ByID: dpdkId,
@@ -473,7 +473,7 @@ func ExistDPDK(ctx context.Context, dpdkId uint64, c *decort.DecortClient) error
return nil
}
func ExistSnapshotInCompute(ctx context.Context, computeID uint64, label string, c *decort.DecortClient) error {
func ExistSnapshotInCompute(ctx context.Context, computeID uint64, label string, c *client.Client) error {
req := compute.SnapshotListRequest{
ComputeID: computeID,
}
@@ -492,7 +492,7 @@ func ExistSnapshotInCompute(ctx context.Context, computeID uint64, label string,
return fmt.Errorf("snapshot with label %v for compute with id %d not found", label, computeID)
}
func ExistLBBackend(ctx context.Context, lbId uint64, bName string, c *decort.DecortClient) error {
func ExistLBBackend(ctx context.Context, lbId uint64, bName string, c *client.Client) error {
lb, err := c.CloudAPI().LB().Get(ctx, lb.GetRequest{LBID: lbId})
if err != nil {
return err
@@ -508,7 +508,7 @@ func ExistLBBackend(ctx context.Context, lbId uint64, bName string, c *decort.De
return fmt.Errorf("backend with name %v not found", bName)
}
func ExistLBFrontend(ctx context.Context, lbId uint64, fName string, c *decort.DecortClient) error {
func ExistLBFrontend(ctx context.Context, lbId uint64, fName string, c *client.Client) error {
lb, err := c.CloudAPI().LB().Get(ctx, lb.GetRequest{LBID: lbId})
if err != nil {
return err