Update SDK dependency (#177)

* Update dependencies

* Update dependencies

* Update dependencies

* Update dependencies

---------

Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
Henrique Santos 2023-12-21 09:33:36 +00:00 committed by GitHub
parent 506d1afdc2
commit c7effac5c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 382 additions and 382 deletions

View file

@ -437,12 +437,12 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
return
}
// Update existing instance
err = r.client.UpdateInstance(ctx, projectId, instanceId).UpdateInstancePayload(*payload).Execute()
err = r.client.PartialUpdateInstance(ctx, projectId, instanceId).PartialUpdateInstancePayload(*payload).Execute()
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
return
}
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
return
@ -463,17 +463,17 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
tflog.Info(ctx, "PostgreSQL instance updated")
}
func toUpdatePayload(model *Model, parameters *parametersModel, parametersPlugins *[]string) (*postgresql.UpdateInstancePayload, error) {
func toUpdatePayload(model *Model, parameters *parametersModel, parametersPlugins *[]string) (*postgresql.PartialUpdateInstancePayload, error) {
if model == nil {
return nil, fmt.Errorf("nil model")
}
if parameters == nil {
return &postgresql.UpdateInstancePayload{
return &postgresql.PartialUpdateInstancePayload{
PlanId: conversion.StringValueToPointer(model.PlanId),
}, nil
}
return &postgresql.UpdateInstancePayload{
return &postgresql.PartialUpdateInstancePayload{
Parameters: &postgresql.InstanceParameters{
EnableMonitoring: conversion.BoolValueToPointer(parameters.EnableMonitoring),
MetricsFrequency: conversion.Int64ValueToPointer(parameters.MetricsFrequency),
@ -674,7 +674,7 @@ func mapParameters(params map[string]interface{}) (types.Object, error) {
func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
projectId := model.ProjectId.ValueString()
res, err := r.client.GetOfferings(ctx, projectId).Execute()
res, err := r.client.ListOfferings(ctx, projectId).Execute()
if err != nil {
return fmt.Errorf("getting PostgreSQL offerings: %w", err)
}
@ -712,7 +712,7 @@ func (r *instanceResource) loadPlanId(ctx context.Context, model *Model) error {
func loadPlanNameAndVersion(ctx context.Context, client *postgresql.APIClient, model *Model) error {
projectId := model.ProjectId.ValueString()
planId := model.PlanId.ValueString()
res, err := client.GetOfferings(ctx, projectId).Execute()
res, err := client.ListOfferings(ctx, projectId).Execute()
if err != nil {
return fmt.Errorf("getting PostgreSQL offerings: %w", err)
}

View file

@ -317,7 +317,7 @@ func TestToUpdatePayload(t *testing.T) {
input *Model
inputParameters *parametersModel
inputParametersPlugins *[]string
expected *postgresql.UpdateInstancePayload
expected *postgresql.PartialUpdateInstancePayload
isValid bool
}{
{
@ -325,7 +325,7 @@ func TestToUpdatePayload(t *testing.T) {
&Model{},
&parametersModel{},
&[]string{},
&postgresql.UpdateInstancePayload{
&postgresql.PartialUpdateInstancePayload{
Parameters: &postgresql.InstanceParameters{
Plugins: &[]string{},
},
@ -348,7 +348,7 @@ func TestToUpdatePayload(t *testing.T) {
"plugin_1",
"plugin_2",
},
&postgresql.UpdateInstancePayload{
&postgresql.PartialUpdateInstancePayload{
Parameters: &postgresql.InstanceParameters{
EnableMonitoring: utils.Ptr(true),
MetricsFrequency: utils.Ptr(int64(123)),
@ -379,7 +379,7 @@ func TestToUpdatePayload(t *testing.T) {
&[]string{
"",
},
&postgresql.UpdateInstancePayload{
&postgresql.PartialUpdateInstancePayload{
Parameters: &postgresql.InstanceParameters{
EnableMonitoring: nil,
MetricsFrequency: utils.Ptr(int64(2123456789)),
@ -409,7 +409,7 @@ func TestToUpdatePayload(t *testing.T) {
},
nil,
nil,
&postgresql.UpdateInstancePayload{
&postgresql.PartialUpdateInstancePayload{
PlanId: utils.Ptr("plan"),
},
true,