Azure / Azure/autorest.powershell

Generate 'New' for PUT APIs and Generate Update cmdlets for RPs with no (or incomplete) patch

Open
#424 2 comments 0 reactions 0 assignees View on GitHub
feature-request P2
Dominant language
C#
Stars
123
Forks
99
PR merge metrics
No merged PRs in 30d

Description

We need to have a consistent cmdlet API surface for creation / modification across RPs, but not all RPs have PATCH support, and many RPs support a PATCH that only allows setting Tags.

To fix this we should do the following:
- Instead of creating New and Set cmdlets for each put, create once cmdlet called 'New' .
- By Default, New cmdlet should output `if-none-match: *` header to prevent overwriting an existing account
- If the user specifies an ETag, use `if-match: *' in the put call
- Add a parameter `-Overwrite` which will overwrite any existing resource
- New should have only the 'CreateExpanded' parameter set

- If the RP implements a fully-functional patch, represent as we currently do (Update)
- Otherwise, generate an Update cmdlet using GET/PUT to implement PATCH semantics
- UpdateExpanded and UpdateExpandedViaIdentity parameter sets
- Get the resource specified in identity parameters
- Update the resource with the specified expanded body parameters
- Perform the PUT call (use `if-match: ` with the ETag returned from the PUT call if ETags are supported)
- If the PUT fails due to ETag mismatch, retry the Get/PUT mechanism up to two times`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.