Support Deprecation header #1151
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add new policy to configure
Deprecationheader fieldAdd a new
DeprecationPolicywhich emits aDeprecationheader when a matching API version is used.Description
An API may emit a
Deprecationheader to inform clients that a resource is/will become deprecated (but may still be available past that point). The newDeprecationPolicyallows users to configure this header, as well as the (optional) associated links. This is analogous to the existingSunsetPolicy.The implementation follows the existing
SunsetPolicy(and associated classes likeSunsetPolicyBuilder,SunsetPolicyManageretc) as closely as possible. In an attempt to minimize code duplication between the two, common functionality was extracted into shared base classes/interfaces. There is still some duplication left over, but I chose what seemed like a reasonable a middle ground between streamlining the two policies, and keeping the code clear.At the time of writing this, no tests have been added yet. Since this is a rather large PR with many changed files, I want a second opinion on the implementation before I start pinning everything down in tests. I did at least verify that the solution compiles.
Design choices
This summarizes the linked issue #1128
The new policy is configured like this:
deprecationas per the spec.Fixes #1128