Skip to content

services: split create and update to allow renaming#93

Open
adrianosela wants to merge 1 commit intomainfrom
adrianosela/92-create-or-update-does-not-allow-rename
Open

services: split create and update to allow renaming#93
adrianosela wants to merge 1 commit intomainfrom
adrianosela/92-create-or-update-does-not-allow-rename

Conversation

@adrianosela
Copy link
Copy Markdown

Deprecates CreateOrUpdate in favor of Create and Update. The current unified approach does not support renaming a service in place without deleting and re-creating it (causing it to receive new automatically allocated IPs).

Fixes #92

Deprecates CreateOrUpdate in favor of Create and Update.

Fixes #92
@rajsinghtech rajsinghtech self-requested a review March 30, 2026 23:17
// CreateOrUpdate creates or updates a [Service].
func (sr *ServicesResource) CreateOrUpdate(ctx context.Context, svc Service) error {
// Create creates a new [Service].
func (sr *ServicesResource) Create(ctx context.Context, svc Service) error {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Alternatively, we could pass a varidic option to CreateOrUpdate here like WithExistingName(name string)...


// CreateOrUpdate creates or updates a [Service].
func (sr *ServicesResource) CreateOrUpdate(ctx context.Context, svc Service) error {
// Create creates a new [Service].
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.

The API uses PUT as an upsert - calling Create on an existing service will silently update it rather than error. Worth a doc comment noting this.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No Way To Rename A Service

2 participants