1.2.0
This commit is contained in:
@@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/ic"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/k8s/models"
|
||||
)
|
||||
|
||||
func CheckParamsExistenceCP(ctx context.Context, plan *models.ResourceK8SCPModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func CheckParamsExistenceCP(ctx context.Context, plan *models.ResourceK8SCPModel, c *client.Client) diag.Diagnostics {
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
if err := ic.ExistRG(ctx, uint64(plan.RGID.ValueInt64()), c); err != nil {
|
||||
@@ -31,7 +31,7 @@ func CheckParamsExistenceCP(ctx context.Context, plan *models.ResourceK8SCPModel
|
||||
return diags
|
||||
}
|
||||
|
||||
func CheckParamsExistenceWG(ctx context.Context, plan *models.ResourceK8SWGModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func CheckParamsExistenceWG(ctx context.Context, plan *models.ResourceK8SWGModel, c *client.Client) diag.Diagnostics {
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
if err := ic.ExistK8s(ctx, uint64(plan.K8SID.ValueInt64()), c); err != nil {
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8ci"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/k8s/models"
|
||||
)
|
||||
|
||||
func K8ciListCheckPresence(ctx context.Context, state *models.K8ciListModel, c *decort.DecortClient) (*k8ci.ListK8CI, error) {
|
||||
func K8ciListCheckPresence(ctx context.Context, state *models.K8ciListModel, c *client.Client) (*k8ci.ListK8CI, error) {
|
||||
tflog.Info(ctx, "Get k8ci list info")
|
||||
|
||||
req := k8ci.ListRequest{}
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/k8s/models"
|
||||
)
|
||||
|
||||
func K8sListCheckPresence(ctx context.Context, state *models.K8SListModel, c *decort.DecortClient) (*k8s.ListK8SClusters, error) {
|
||||
func K8sListCheckPresence(ctx context.Context, state *models.K8SListModel, c *client.Client) (*k8s.ListK8SClusters, error) {
|
||||
tflog.Info(ctx, "Get k8s list info")
|
||||
|
||||
req := k8s.ListRequest{}
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/k8s/models"
|
||||
)
|
||||
|
||||
func K8sListDeletedCheckPresence(ctx context.Context, state *models.K8SListDeletedModel, c *decort.DecortClient) (*k8s.ListK8SClusters, error) {
|
||||
func K8sListDeletedCheckPresence(ctx context.Context, state *models.K8SListDeletedModel, c *client.Client) (*k8s.ListK8SClusters, error) {
|
||||
tflog.Info(ctx, "Get k8s list deleted info")
|
||||
|
||||
req := k8s.ListDeletedRequest{}
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/compute"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/lb"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/tasks"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/k8s/models"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/status"
|
||||
)
|
||||
@@ -130,7 +130,7 @@ func CreateRequestResourceK8CP(ctx context.Context, plan *models.ResourceK8SCPMo
|
||||
return req
|
||||
}
|
||||
|
||||
func CheckResourceK8SCPCreateAndDeleteWG(ctx context.Context, plan *models.ResourceK8SCPModel, c *decort.DecortClient, resp string) diag.Diagnostics {
|
||||
func CheckResourceK8SCPCreateAndDeleteWG(ctx context.Context, plan *models.ResourceK8SCPModel, c *client.Client, resp string) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Start CheckResourceK8CPCreateAndDeleteWG", map[string]any{"name": plan.Name.ValueString()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -205,7 +205,7 @@ func CheckResourceK8SCPCreateAndDeleteWG(ctx context.Context, plan *models.Resou
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8SCPResourceCheckPresence(ctx context.Context, k8SID uint64, c *decort.DecortClient) (*k8s.RecordK8S, error) {
|
||||
func K8SCPResourceCheckPresence(ctx context.Context, k8SID uint64, c *client.Client) (*k8s.RecordK8S, error) {
|
||||
tflog.Info(ctx, "Get info about cluster with ID", map[string]any{"k8s_id": k8SID})
|
||||
|
||||
cluster, err := c.CloudAPI().K8S().Get(ctx, k8s.GetRequest{K8SID: k8SID})
|
||||
@@ -217,7 +217,7 @@ func K8SCPResourceCheckPresence(ctx context.Context, k8SID uint64, c *decort.Dec
|
||||
return cluster, nil
|
||||
}
|
||||
|
||||
func K8sListForResourceCheckPresence(ctx context.Context, k8SID uint64, c *decort.DecortClient) (*k8s.ListK8SClusters, error) {
|
||||
func K8sListForResourceCheckPresence(ctx context.Context, k8SID uint64, c *client.Client) (*k8s.ListK8SClusters, error) {
|
||||
tflog.Info(ctx, "Get info in List about cluster with ID", map[string]any{"k8s_id": k8SID})
|
||||
|
||||
req := k8s.ListRequest{
|
||||
@@ -234,7 +234,7 @@ func K8sListForResourceCheckPresence(ctx context.Context, k8SID uint64, c *decor
|
||||
return k8sList, nil
|
||||
}
|
||||
|
||||
func ComputeCheckPresence(ctx context.Context, computeID uint64, c *decort.DecortClient) (*compute.RecordCompute, error) {
|
||||
func ComputeCheckPresence(ctx context.Context, computeID uint64, c *client.Client) (*compute.RecordCompute, error) {
|
||||
tflog.Info(ctx, "Start utilityComputeCheckPresence", map[string]any{"compute_id": computeID})
|
||||
|
||||
req := compute.GetRequest{
|
||||
@@ -250,7 +250,7 @@ func ComputeCheckPresence(ctx context.Context, computeID uint64, c *decort.Decor
|
||||
return compute, nil
|
||||
}
|
||||
|
||||
func K8SCPUpdateNameOrDescription(ctx context.Context, plan, state *models.ResourceK8SCPModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8SCPUpdateNameOrDescription(ctx context.Context, plan, state *models.ResourceK8SCPModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Update info about cluster with ID", map[string]any{"k8s_id": plan.Id.ValueString()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -283,7 +283,7 @@ func K8SCPUpdateNameOrDescription(ctx context.Context, plan, state *models.Resou
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8SCPReadStatus(ctx context.Context, plan *models.ResourceK8SCPModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8SCPReadStatus(ctx context.Context, plan *models.ResourceK8SCPModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Read status cluster with ID", map[string]any{"k8s_id": plan.Id.ValueString()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -341,7 +341,7 @@ func K8SCPReadStatus(ctx context.Context, plan *models.ResourceK8SCPModel, c *de
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8SCPRestore(ctx context.Context, plan *models.ResourceK8SCPModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8SCPRestore(ctx context.Context, plan *models.ResourceK8SCPModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Restore cluster with ID", map[string]any{"k8s_id": plan.Id.ValueString()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -362,7 +362,7 @@ func K8SCPRestore(ctx context.Context, plan *models.ResourceK8SCPModel, c *decor
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8SCPEnableDisable(ctx context.Context, plan *models.ResourceK8SCPModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8SCPEnableDisable(ctx context.Context, plan *models.ResourceK8SCPModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Enable/Disable cluster with ID", map[string]any{"k8s_id": plan.Id.ValueString()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -392,7 +392,7 @@ func K8SCPEnableDisable(ctx context.Context, plan *models.ResourceK8SCPModel, c
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8SCPStartStop(ctx context.Context, plan *models.ResourceK8SCPModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8SCPStartStop(ctx context.Context, plan *models.ResourceK8SCPModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Start/Stop cluster with ID", map[string]any{"k8s_id": plan.Id.ValueString()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -426,7 +426,7 @@ func K8SCPStartStop(ctx context.Context, plan *models.ResourceK8SCPModel, c *dec
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8SCPDeleteMaster(ctx context.Context, plan *models.ResourceK8SCPModel, state *models.ResourceK8SCPModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8SCPDeleteMaster(ctx context.Context, plan *models.ResourceK8SCPModel, state *models.ResourceK8SCPModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Delete Master node from cluster with ID", map[string]any{"k8s_id": plan.Id.ValueString()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -463,7 +463,7 @@ func K8SCPDeleteMaster(ctx context.Context, plan *models.ResourceK8SCPModel, sta
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8CPUpdateSysctlParams(ctx context.Context, plan *models.ResourceK8SCPModel, state *models.ResourceK8SCPModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8CPUpdateSysctlParams(ctx context.Context, plan *models.ResourceK8SCPModel, state *models.ResourceK8SCPModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Update LB parameters from cluster with ID", map[string]any{"k8s_id": plan.Id.ValueString()})
|
||||
diags := diag.Diagnostics{}
|
||||
result := make([]map[string]interface{}, 0, len(plan.LBSysctlParams.Elements()))
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/k8s"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/tasks"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/client"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-dynamix/internal/service/cloudapi/k8s/models"
|
||||
)
|
||||
|
||||
@@ -85,7 +85,7 @@ func CreateRequestResourceK8WG(ctx context.Context, plan *models.ResourceK8SWGMo
|
||||
return req
|
||||
}
|
||||
|
||||
func ResourceK8SWGCreate(ctx context.Context, plan *models.ResourceK8SWGModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func ResourceK8SWGCreate(ctx context.Context, plan *models.ResourceK8SWGModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Start ResourceK8SWGCreate", map[string]any{"name": plan.Name.ValueString(), "k8s_id": plan.K8SID.ValueInt64()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -141,7 +141,7 @@ func ResourceK8SWGCreate(ctx context.Context, plan *models.ResourceK8SWGModel, c
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8SWGResourceCheckPresence(ctx context.Context, plan *models.ResourceK8SWGModel, c *decort.DecortClient) (*k8s.ItemK8SGroup, uint64, error) {
|
||||
func K8SWGResourceCheckPresence(ctx context.Context, plan *models.ResourceK8SWGModel, c *client.Client) (*k8s.ItemK8SGroup, uint64, error) {
|
||||
tflog.Info(ctx, "Get info about wg with ID", map[string]any{"wg_id": plan.Id.ValueString()})
|
||||
|
||||
var wgId int
|
||||
@@ -182,7 +182,7 @@ func K8SWGResourceCheckPresence(ctx context.Context, plan *models.ResourceK8SWGM
|
||||
return nil, 0, fmt.Errorf("not found wg with id: %d in k8s cluster: %d", wgId, cluster.ID)
|
||||
}
|
||||
|
||||
func K8SWGUpdateCloudInit(ctx context.Context, plan, state *models.ResourceK8SWGModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8SWGUpdateCloudInit(ctx context.Context, plan, state *models.ResourceK8SWGModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Update cloud init in wg with id", map[string]any{"wg_id": state.WorkerGroupId.ValueInt64(), "k8s_id": state.K8SID.ValueInt64()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
@@ -203,7 +203,7 @@ func K8SWGUpdateCloudInit(ctx context.Context, plan, state *models.ResourceK8SWG
|
||||
return diags
|
||||
}
|
||||
|
||||
func K8SWGUpdateNumWorkers(ctx context.Context, plan, state *models.ResourceK8SWGModel, c *decort.DecortClient) diag.Diagnostics {
|
||||
func K8SWGUpdateNumWorkers(ctx context.Context, plan, state *models.ResourceK8SWGModel, c *client.Client) diag.Diagnostics {
|
||||
tflog.Info(ctx, "Update num workers in wg with id", map[string]any{"wg_id": state.WorkerGroupId.ValueInt64(), "k8s_id": state.K8SID.ValueInt64()})
|
||||
|
||||
diags := diag.Diagnostics{}
|
||||
|
||||
Reference in New Issue
Block a user