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

feat(resourcemanager): allow empty resource names in ResourceIdenitifer #24044

Closed

Conversation

archerzz
Copy link
Member

@archerzz archerzz commented Sep 16, 2021

  1. change the parsing logic to allow empty resource names
  2. add validation on trailing "/" so that the split won't create excessive resource name
  3. change serialization logic to correctly covert id with empty resource names back to string
  4. only validate the the format of subscription id when it's not empty
  5. add unit test cases

AB#6161

All SDK Contribution checklist:

This checklist is used to make sure that common guidelines for a pull request are followed.

  • Please open PR in Draft mode if it is:
    • Work in progress or not intended to be merged.
    • Encountering multiple pipeline failures and working on fixes.
  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • I have read the contribution guidelines.
  • The pull request does not introduce breaking changes.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code. (Track 2 only)
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK. Please double check nuget.org current release version.

Additional management plane SDK specific contribution checklist:

Note: Only applies to Microsoft.Azure.Management.[RP] or Azure.ResourceManager.[RP]

  • Include updated management metadata.
  • Update AzureRP.props to add/remove version info to maintain up to date API versions.

Management plane SDK Troubleshooting

  • If this is very first SDK for a services and you are adding new service folders directly under /SDK, please add new service label and/or contact assigned reviewer.

  • If the check fails at the Verify Code Generation step, please ensure:

    • Do not modify any code in generated folders.
    • Do not selectively include/remove generated files in the PR.
    • Do use generate.ps1/cmd to generate this PR instead of calling autorest directly.
      Please pay attention to the @microsoft.csharp version output after running generate.ps1. If it is lower than current released version (2.3.82), please run it again as it should pull down the latest version.

    Note: We have recently updated the PSH module called by generate.ps1 to emit additional data. This would help reduce/eliminate the Code Verification check error. Please run following command:

      `dotnet msbuild eng/mgmt.proj /t:Util /p:UtilityName=InstallPsModules`
    

Old outstanding PR cleanup

Please note:
If PRs (including draft) has been out for more than 60 days and there are no responses from our query or followups, they will be closed to maintain a concise list for our reviewers.

@archerzz archerzz requested a review from m-nash September 16, 2021 14:09
@ArthurMa1978 ArthurMa1978 added the Mgmt This issue is related to a management-plane library. label Sep 17, 2021
@archerzz archerzz marked this pull request as ready for review September 18, 2021 04:32
@archerzz
Copy link
Member Author

archerzz commented Sep 18, 2021

For the original issue AB#6161, I have contacted two network PMs, but no response yet :(

From what I can see, the possible solutions are:

  1. Allow empty subscriptionId and resourceGroupName, e.g. this PR
  2. Add a directive to enforce a model not be a Resource
  3. If Id is not used anywhere, we can delete Id from the swagger definition
  4. If this model is deprecated, we can even just remove this API.

@archerzz
Copy link
Member Author

I searched the swagger examples, and it looks like Id is not used. Instead, community values like "12076:20002" is used. So we could consider option #3 above.

@ghost ghost added the no-recent-activity There has been no recent activity on this issue. label Nov 19, 2021
@ghost
Copy link

ghost commented Nov 19, 2021

Hi @archerzz. Thank you, for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days.

@ghost ghost closed this Nov 26, 2021
@ghost
Copy link

ghost commented Nov 26, 2021

Hi @archerzz. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing "/reopen" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the "no-recent-activity" label; otherwise, this is likely to be closed again with the next cleanup pass.

@archerzz archerzz reopened this Dec 13, 2021
@ghost ghost closed this Dec 20, 2021
@ghost
Copy link

ghost commented Dec 20, 2021

Hi @archerzz. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing "/reopen" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the "no-recent-activity" label; otherwise, this is likely to be closed again with the next cleanup pass.

@archerzz archerzz reopened this Jan 10, 2022
@archerzz archerzz force-pushed the empty-names-in-resource-identifier branch from 8313823 to 70c80cd Compare January 10, 2022 03:11
@ghost ghost removed the no-recent-activity There has been no recent activity on this issue. label Jan 10, 2022
@archerzz
Copy link
Member Author

archerzz commented Jan 10, 2022

Here is the sample (there is no subid in actual response btw):

{
            "id": "/subscriptions//resourceGroups//providers/Microsoft.Network/bgpServiceCommunities/Exchange",
            "name": "skype",
            "type": "Microsoft.Network/bgpServiceCommunities",
            "properties": {
              "serviceName": "skype",
              "bgpCommunities": [
                {
                  "serviceSupportedRegion": "Global",
                  "communityName": "Skype For Business Online",
                  "communityValue": "12076:5030",
                  "communityPrefixes": [
                    "13.67.56.225/32",
                    "13.67.186.105/32"
                  ],
                  "isAuthorizedToUse": true,
                  "serviceGroup": "O365"
                }
              ]
            }
          },

From what I can see:

  • the values in bgpCommunities are used, instead of id
  • this API is listing only, and there is no get/create/delete API.
  • this API is more like listing constants v.s. resources

So I think we can just remove id property from the definition when generating network SDK.

@archerzz
Copy link
Member Author

After discussion, we decided to adopt option #2, e.g. skip inheritance type replacement for BgpServiceCommunity.

@archerzz archerzz closed this Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Merge Mgmt This issue is related to a management-plane library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants