Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ManagedInstanceDTCs APIs #18770

Conversation

krivi37
Copy link
Contributor

@krivi37 krivi37 commented Apr 21, 2022

MSFT employees can try out our new experience at OpenAPI Hub - one location for using our validation tools and finding your workflow.

Changelog

Add a changelog entry for this PR by answering the following questions:

  1. What's the purpose of the update?
    • new service onboarding
    • new API version
    • update existing version for new feature
    • update existing version to fix swagger quality issue in s360
    • Other, please clarify
  2. When are you targeting to deploy the new service/feature to public regions? Please provide the date or, if the date is not yet available, the month. - It should be deployed next month.
  3. When do you expect to publish the swagger? Please provide date or, the the date is not yet available, the month. - It should be published also next month.
  4. If updating an existing version, please select the specific language SDKs and CLIs that must be refreshed after the swagger is published.
    • SDK of .NET (need service team to ensure code readiness)
    • SDK of Python
    • SDK of Java
    • SDK of Js
    • SDK of Go
    • PowerShell
    • CLI
    • Terraform
    • No refresh required for updates in this PR

Contribution checklist:

If any further question about AME onboarding or validation tools, please view the FAQ.

ARM API Review Checklist

Applicability: ⚠️

If your changes encompass only the following scenarios, you should SKIP this section, as these scenarios do not require ARM review.

  • Change to data plane APIs
  • Adding new properties
  • All removals

Otherwise your PR may be subject to ARM review requirements. Complete the following:

  • Check this box if any of the following apply to the PR so that label "WaitForARMFeedback" will be added automatically to begin ARM API Review. Failure to comply may result in delays to the manifest.

    • Adding a new service
    • Adding new API(s)
    • Adding a new API version
      -[ ] To review changes efficiently, ensure you are using OpenAPIHub to initialize the PR for adding a new version. More details, refer to the wiki.
  • Ensure you've reviewed following guidelines including ARM resource provider contract and REST guidelines. Estimated time (4 hours). This is required before you can request review from ARM API Review board.

  • If you are blocked on ARM review and want to get the PR merged with urgency, please get the ARM oncall for reviews (RP Manifest Approvers team under Azure Resource Manager service) from IcM and reach out to them.

Breaking Change Review Checklist

If any of the following scenarios apply to the PR, request approval from the Breaking Change Review Board as defined in the Breaking Change Policy.

  • Removing API(s) in a stable version
  • Removing properties in a stable version
  • Removing API version(s) in a stable version
  • Updating API in a stable or public preview version with Breaking Change Validation errors
  • Updating API(s) in public preview over 1 year (refer to Retirement of Previews)

Action: to initiate an evaluation of the breaking change, create a new intake using the template for breaking changes. Addition details on the process and office hours are on the Breaking change Wiki.

Please follow the link to find more details on PR review process.

@openapi-workflow-bot
Copy link

Hi, @krivi37 Thanks for your PR. I am workflow bot for review process. Here are some small tips.

  • Please ensure to do self-check against checklists in first PR comment.
  • PR assignee is the person auto-assigned and responsible for your current PR reviewing and merging.
  • For specs comparison cross API versions, Use API Specs Comparison Report Generator
  • If there is CI failure(s), to fix CI error(s) is mandatory for PR merging; or you need to provide justification in PR comment for explanation. How to fix?

  • Any feedback about review process or workflow bot, pls contact swagger and tools team. [email protected]

    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Apr 21, 2022

    Swagger Validation Report

    ️️✔️BreakingChange succeeded [Detail] [Expand]
    There are no breaking changes.
    ️⚠️LintDiff: 2 Warnings warning [Detail]
    The following errors/warnings are introduced by current PR:
    Rule Message
    ⚠️ R4009 - RequiredReadOnlySystemData The response of operation:'ManagedInstanceDtcs_Get' is defined without 'systemData'. Consider adding the systemData to the response.
    Location: Microsoft.Sql/preview/2022-02-01-preview/ManagedInstanceDtcs.json#L62
    ⚠️ R4009 - RequiredReadOnlySystemData The response of operation:'ManagedInstanceDtcs_CreateOrUpdate' is defined without 'systemData'. Consider adding the systemData to the response.
    Location: Microsoft.Sql/preview/2022-02-01-preview/ManagedInstanceDtcs.json#L113
    ️⚠️Avocado: 1 Warnings warning [Detail]
    Rule Message
    ⚠️ MULTIPLE_API_VERSION The default tag contains multiple API versions swaggers.
    readme: specification/sql/resource-manager/readme.md
    tag: specification/sql/resource-manager/readme.md#tag-package-composite-v5
    ️️✔️ModelValidation succeeded [Detail] [Expand]
    Validation passes for ModelValidation.
    ️️✔️SemanticValidation succeeded [Detail] [Expand]
    Validation passes for SemanticValidation.
    ️️✔️Cross-Version Breaking Changes succeeded [Detail] [Expand]
    There are no breaking changes.
    ️️✔️SDK Track2 Validation succeeded [Detail] [Expand]
    Validation passes for SDKTrack2Validation

    ️️✔️PrettierCheck succeeded [Detail] [Expand]
    Validation passes for PrettierCheck.
    ️️✔️SpellCheck succeeded [Detail] [Expand]
    Validation passes for SpellCheck.
    Posted by Swagger Pipeline | How to fix these errors?

    @openapi-workflow-bot
    Copy link

    [Call for Action] To better understand Azure service dev/test scenario, and support Azure service developer better on Swagger and REST API related tests in early phase, please help to fill in with this survey https://aka.ms/SurveyForEarlyPhase. It will take 5 to 10 minutes. If you already complete survey, please neglect this comment. Thanks.

    @ghost ghost added the SQL label Apr 21, 2022
    @openapi-pipeline-app
    Copy link

    openapi-pipeline-app bot commented Apr 21, 2022

    Swagger Generation Artifacts

    ️️✔️ApiDocPreview succeeded [Detail] [Expand]

    Only 0 items are rendered, please refer to log for more details.

    ️⚠️SDK Breaking Change Tracking warning [Detail]

    Only 0 items are rendered, please refer to log for more details.

    ️❌ azure-sdk-for-net failed [Detail]

    Only 0 items are rendered, please refer to log for more details.

    ️⚠️ azure-sdk-for-python-track2 warning [Detail]

    Only 0 items are rendered, please refer to log for more details.

    ️️✔️ azure-sdk-for-net-track2 succeeded [Detail] [Expand]

    Only 0 items are rendered, please refer to log for more details.

    ️⚠️ azure-sdk-for-java warning [Detail]

    Only 0 items are rendered, please refer to log for more details.

    ️️✔️ azure-sdk-for-go succeeded [Detail] [Expand]

    Only 0 items are rendered, please refer to log for more details.

    ️️✔️ azure-sdk-for-go-track2 succeeded [Detail] [Expand]

    Only 0 items are rendered, please refer to log for more details.

    ️⚠️ azure-sdk-for-js warning [Detail]

    Only 0 items are rendered, please refer to log for more details.

    ️⚠️ azure-resource-manager-schemas warning [Detail]

    Only 0 items are rendered, please refer to log for more details.

    Posted by Swagger Pipeline | How to fix these errors?

    @openapi-workflow-bot
    Copy link

    Hi @krivi37, Your PR has some issues. Please fix the CI sequentially by following the order of Avocado, semantic validation, model validation, breaking change, lintDiff. If you have any questions, please post your questions in this channel https://aka.ms/swaggersupport.

    TaskHow to fixPriority
    AvocadoFix-AvocadoHigh
    Semantic validationFix-SemanticValidation-ErrorHigh
    Model validationFix-ModelValidation-ErrorHigh
    LintDiffFix-LintDiffhigh
    If you need further help, please feedback via swagger feedback.

    @ericshape
    Copy link
    Contributor

    systemData is not mandatory in the SQL spec

    @openapi-workflow-bot openapi-workflow-bot bot added the WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required label Apr 22, 2022
    @openapi-workflow-bot
    Copy link

    Hi, @krivi37 your PR are labelled with WaitForARMFeedback. A notification email will be sent out shortly afterwards to notify ARM review board([email protected]).

    },
    "allowOutboundEnabled": {
    "description": "Allow Outbound traffic of managed instance DTC.",
    "type": "boolean"

    Choose a reason for hiding this comment

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

    consider updating these boolean values to enum as explained here :

    https://armwiki.azurewebsites.net/rp_onboarding/process/api_review_best_practices.html

    "Replace boolean/switch properties with better enum"

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Is this really needed? These values should only have True and False as values, and from what I see on the linked post:
    "Even if you still believe [True, False] are the correct values for a property, you should use a string enum with values [True, False] instead of boolean. Enums are always a more flexible and future proof option because they allow additional values to be added in the future in a non-breaking way, e.g. [True, False, Unknown]."

    These values are optional, so not setting them is not a problem (in other words, we don't need the "Unknown" option). Also, since they just determine whether some DTC options are enabled, they can only be "true" or "false". They also cannot be aggregated into a single property since they deal with logically different things.

    Choose a reason for hiding this comment

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

    its not mandatory , but in general is a good rule of thumb. Often we see as a service grows , modelling things as boolean puts you in a corner when the scenario scope expands and you end up needing to have another bool to model something else. In your case it could be something like maybe 3 months down the line you need to have a new state like "allowInboundFromAzureStorage" (hypothetical , I do not know the specifics of your service) and then that ends up becoming another bool rather than an enum which is what it should be. I will not block sgn off on this comment , but would still would urge you to consider fixing this.

    @raosuhas raosuhas added the ARMChangesRequested <valid label in PR review process>add this label when require changes after ARM review label Apr 26, 2022
    "description": "Managed instance DTC settings.",
    "required": true,
    "schema": {
    "$ref": "#/definitions/ManagedInstanceDtc"

    Choose a reason for hiding this comment

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

    ManagedInstanceDtc

    This does not work, since you cannot patch everything in a resource like name and type cannot be patched. Generally teams include a subset of the resource definition with only the properties that can be patched.

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    The name cannot be changed, it is can only be "current" since this is a singleton object, and it is only used as a route in the request. The only properties that are actually getting updated are the ones in the body of the request. The dtcName is in the URL itself

    Copy link

    Choose a reason for hiding this comment

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

    The ones in the body of the request, meaning the "ManagedInstanceDtcProperties" in this case? Think Suhas is suggesting to create a definition and include those that you'll update.

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Hmm, but everything which is listed under ManagedInstanceDtc -> ManagedInstanceDtcProperties can be patched. All the properties are mutable except for "dtcHostNameDnsSuffix" which is declared as read only.

    Copy link

    Choose a reason for hiding this comment

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

    Overall it's just not a good pattern, as user can still pass them, but they are useless. It's a strong recommendation but will not block you on this.

    Copy link

    Choose a reason for hiding this comment

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

    Took a second look on this, if ManagedInstanceDtcProperties is all you needed for patch, why not just pass them?

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    I've passed those

    },
    "202": {
    "description": "Applying DTC settings is in progress"
    }
    Copy link

    @zizw123 zizw123 May 4, 2022

    Choose a reason for hiding this comment

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

    Are you planning to support both sync and async for 200 and 202? For async patch, the recommend pattern is to use 202 and location header. See: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#updating-using-patch #Closed

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Shouldn't swagger document the final Location response which is 200 OK?

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    We are following https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#202-accepted-and-location-headers
    Specifically:
    5.If the operation is complete, return the exact same response that would have been returned had the operation been executed synchronously.
    Swagger/AutoRest needs some way of determining the structure of the final response, and that is done by providing the sync response format here.

    @jorgecotillo jorgecotillo added ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review and removed ARMChangesRequested <valid label in PR review process>add this label when require changes after ARM review labels May 20, 2022
    @openapi-workflow-bot openapi-workflow-bot bot added ARMReview and removed WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required labels May 20, 2022
    @jorgecotillo
    Copy link
    Contributor

    This API is special in the sense that the proxy resource is created by the RP, but the intention is to expose updatable properties via PUT, initially a PATCH API was exposed but didn't make much sense because both request bodies were identical, since the intention is to expose all properties as updatable properties and not only a small subset, PATCH is not required.

    @ericshape
    Copy link
    Contributor

    @raych1 , can you please review and merge this PR? Thanks!

    @raych1 raych1 merged commit f8c9cde into Azure:dev-sql-Microsoft.Sql-2022-02-01-preview May 24, 2022
    ericshape pushed a commit to ericshape/azure-rest-api-specs that referenced this pull request May 31, 2022
    * Added swagger, examples and changed the readme.md file
    
    * Fixed spelling errors and examples
    
    * Added a patch request option and renamed the file to lowercase
    
    * Update readme.md
    
    * Renamed examples for put and patch update
    
    * Extracted resource properties for patch request
    
    * Added new examples and changed existing ones
    
    * Added provisioning state to put request
    
    * Updated put examples
    
    * Changed provisioning status in the update examples
    
    * Updated provisioning state enum
    
    * Removed 202 code from PUT provisioning state response and updated examples accordingly
    
    * Removed patch operation and associated examples, also renamed put examples
    
    * Changed descriptions of some models
    
    * Renamed an example description
    
    Co-authored-by: Stefan Krivokapic <[email protected]>
    ericshape pushed a commit to ericshape/azure-rest-api-specs that referenced this pull request May 31, 2022
    * Added swagger, examples and changed the readme.md file
    
    * Fixed spelling errors and examples
    
    * Added a patch request option and renamed the file to lowercase
    
    * Update readme.md
    
    * Renamed examples for put and patch update
    
    * Extracted resource properties for patch request
    
    * Added new examples and changed existing ones
    
    * Added provisioning state to put request
    
    * Updated put examples
    
    * Changed provisioning status in the update examples
    
    * Updated provisioning state enum
    
    * Removed 202 code from PUT provisioning state response and updated examples accordingly
    
    * Removed patch operation and associated examples, also renamed put examples
    
    * Changed descriptions of some models
    
    * Renamed an example description
    
    Co-authored-by: Stefan Krivokapic <[email protected]>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    ARMReview ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review CI-BreakingChange-Go-V2 CI-BreakingChange-JavaScript SQL
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    8 participants