Skip to content

Commit

Permalink
Add MatchConditions to azcore (#22476)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendrixMSFT committed Feb 29, 2024
1 parent da33ad0 commit d742ee8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions sdk/azcore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

* Added logging event `log.EventResponseError` that will contain the contents of `ResponseError.Error()` whenever an `azcore.ResponseError` is created.
* Added `runtime.NewResponseErrorWithErrorCode` for creating an `azcore.ResponseError` with a caller-supplied error code.
* Added type `MatchConditions` for use in conditional requests.

### Breaking Changes

Expand Down
9 changes: 9 additions & 0 deletions sdk/azcore/etag.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@ func (e ETag) WeakEquals(other ETag) bool {
func (e ETag) IsWeak() bool {
return len(e) >= 4 && strings.HasPrefix(string(e), "W/\"") && strings.HasSuffix(string(e), "\"")
}

// MatchConditions specifies HTTP options for conditional requests.
type MatchConditions struct {
// Optionally limit requests to resources that have a matching ETag.
IfMatch *ETag

// Optionally limit requests to resources that do not match the ETag.
IfNoneMatch *ETag
}

0 comments on commit d742ee8

Please sign in to comment.