Skip to content

Generator: Update SDK /services/postgresflex#8450

Open
stackit-pipeline wants to merge 5 commits into
mainfrom
oas-bot-28926724566/postgresflex
Open

Generator: Update SDK /services/postgresflex#8450
stackit-pipeline wants to merge 5 commits into
mainfrom
oas-bot-28926724566/postgresflex

Conversation

@stackit-pipeline

@stackit-pipeline stackit-pipeline commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Relates to STACKITSDK-468

Generated from GitHub run 28926724566
spec comparison: stackitcloud/stackit-api-specifications@9873a8f...72230b8

@stackit-pipeline stackit-pipeline requested a review from a team as a code owner July 8, 2026 07:59
@GokceGK

GokceGK commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

#8315

Comment on lines +15 to +17
const (
InstanceStateEmpty = ""
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const (
InstanceStateEmpty = ""
)

shouldn't be needed anymore

Comment on lines +33 to +45
switch s.State {
default:
return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceId, s.State)
case InstanceStateEmpty:
return false, nil, nil
case postgresflex.STATE_PROGRESSING:
return false, nil, nil
case postgresflex.STATE_READY:
instanceCreated = true
instanceGetResponse = s
case postgresflex.STATE_FAILURE:
return true, s, fmt.Errorf("create failed for instance with id %s", instanceId)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to write this a bit different.
It should check only for ready state and error state.
In case of ready it should behave like now. In case of an error state it should fail with an error, like in the FAILURE state.

In the default case, it should continue to wait and not thrown an error. This makes it more robust in case the API provides new states and is similar to the behavior of our WaiterHelper function

if err == nil {
return true, instanceGetResponse, nil
}
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick

Suggested change
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
var oapiErr *oapierror.GenericOpenAPIError
ok := errors.As(err, &oapiErr)

Comment on lines +58 to +60
if oapiErr.StatusCode < 500 {
return true, instanceGetResponse, fmt.Errorf("users request after instance creation returned %d status code", oapiErr.StatusCode)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be probably changed to an explicit 423 check to continue to wait. In every other error code, we can probably assume that something went completely wrong.

Suggested change
if oapiErr.StatusCode < 500 {
return true, instanceGetResponse, fmt.Errorf("users request after instance creation returned %d status code", oapiErr.StatusCode)
}
if oapiErr.StatusCode != 423 {
return true, instanceGetResponse, fmt.Errorf("users request after instance creation returned %d status code", oapiErr.StatusCode)
}

But need to double check this

return handler
}

// DeleteUserWaitHandler will wait for delete

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For users there is also a create waiter needed because it's also asynchronus

os.Exit(1)
}

fmt.Printf("Created user \"%s\" associated to instance \"%s\".\n", username, instanceResp.Name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Created user \"%s\" associated to instance \"%s\".\n", username, instanceResp.Name)
fmt.Printf("Created user %q associated to instance %q.\n", username, instanceResp.Name)

fmt.Fprintf(os.Stderr, "Error when waiting for PostgreSQL Flex user deletion: %v", err)
}

fmt.Printf("Deleted PostgreSQL Flex user \"%s\".\n", instanceId)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Deleted PostgreSQL Flex user \"%s\".\n", instanceId)
fmt.Printf("Deleted PostgreSQL Flex user %q.\n", instanceId)

fmt.Fprintf(os.Stderr, "Error when waiting for PostgreSQL Flex instance deletion: %v", err)
}

fmt.Printf("Deleted PostgreSQL Flex instance \"%s\".\n", instanceId)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("Deleted PostgreSQL Flex instance \"%s\".\n", instanceId)
fmt.Printf("Deleted PostgreSQL Flex instance %q.\n", instanceId)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants