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

Swagger and Examples for the new Scoped tokens feature of Azure Container registry #5543

Merged
merged 10 commits into from
May 20, 2019

Conversation

mnltejaswini
Copy link
Contributor

Latest improvements:

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

Contribution checklist:

  • I have reviewed the documentation for the workflow.
  • Validation tools were run on swagger spec(s) and have all been fixed in this PR.
  • The OpenAPI Hub was used for checking validation status and next steps.

ARM API Review Checklist

  • Service team MUST add the "WaitForARMFeedback" label if the management plane API changes fall into one of the below categories.
  • adding/removing APIs.
  • adding/removing properties.
  • adding/removing API-version.
  • adding a new service in Azure.

Failure to comply may result in delays for manifest application. Note this does not apply to data plane APIs.

  • If you are blocked on ARM review and want to get the PR merged urgently, please get the ARM oncall for reviews (RP Manifest Approvers team under Azure Resource Manager service) from IcM and reach out to them.
    Please follow the link to find more details on API review process.

Feature Description

Scoped tokens gives ability for users to create tokens with fine grained scope to the artifacts of the registry. Registry administrator defines the permission maps/sets by creating scope maps. After the permission sets are defined by creating scope maps, tokens can be created for a registry with specific scope map. Users can generate credentials for a token and the permissions of the credentials are bound to a token and thereby transitively bound to the scope map.
We are adding two new resources "scopeMaps" and "tokens" under the top level resource "registries". ScopeMaps model the permission sets and tokens are the mapping to the specific scope map.

@AutorestCI
Copy link

AutorestCI commented Apr 3, 2019

Automation for azure-sdk-for-go

Nothing to generate for azure-sdk-for-go

@AutorestCI
Copy link

AutorestCI commented Apr 3, 2019

Automation for azure-sdk-for-python

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-python#5203

@AutorestCI
Copy link

AutorestCI commented Apr 3, 2019

Automation for azure-sdk-for-ruby

Encountered a Subprocess error: (azure-sdk-for-ruby)

Command: ['/usr/local/bin/autorest', '/tmp/tmpnds_adqx/rest/specification/containerregistry/resource-manager/readme.md', '--perform-load=false', '--swagger-to-sdk', '--output-artifact=configuration.json', '--input-file=foo', '--output-folder=/tmp/tmpem2k9nx3']
Finished with return code 7
and output:

AutoRest code generation utility [version: 2.0.4283; node: v8.12.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Failure:
Error: Unable to start AutoRest Core from /root/.autorest/@[email protected]/node_modules/@microsoft.azure/autorest-core
Error: Unable to start AutoRest Core from /root/.autorest/@[email protected]/node_modules/@microsoft.azure/autorest-core
    at main (/opt/node_modules/autorest/dist/app.js:232:19)
    at <anonymous>

/root/.autorest/@[email protected]/node_modules/@microsoft.azure/autorest-core/dist/app.js:33
    autorest_core_1.Shutdown();
    ^
ReferenceError: autorest_core_1 is not defined
    at process.on (/root/.autorest/@[email protected]/node_modules/@microsoft.azure/autorest-core/dist/app.js:33:5)
    at emitOne (events.js:121:20)
    at process.emit (events.js:211:7)
    at process.emit (/node_modules/source-map-support/source-map-support.js:439:21)
fs.js:612
  return binding.close(fd);
                 ^

Error: EBADF: bad file descriptor, close
    at Object.fs.closeSync (fs.js:612:18)
    at StaticVolumeFile.shutdown (/opt/node_modules/autorest/dist/static-loader.js:352:10)
    at StaticFilesystem.shutdown (/opt/node_modules/autorest/dist/static-loader.js:406:17)
    at process.exit.n [as exit] (/opt/node_modules/autorest/dist/static-loader.js:169:11)
    at printErrorAndExit (/node_modules/source-map-support/source-map-support.js:423:11)
    at process.emit (/node_modules/source-map-support/source-map-support.js:435:16)
    at process._fatalException (bootstrap_node.js:391:26)

@AutorestCI
Copy link

AutorestCI commented Apr 3, 2019

Automation for azure-sdk-for-js

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-js#3013

@AutorestCI
Copy link

AutorestCI commented Apr 3, 2019

Automation for azure-sdk-for-java

The initial PR has been merged into your service PR:
Azure/azure-sdk-for-java#3165

@azuresdkci
Copy link
Contributor

Can one of the admins verify this patch?

@adxsdknet
Copy link

adxsdknet commented Apr 3, 2019

@KrisBash KrisBash added the WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required label Apr 4, 2019
adxsdknet added a commit to adxsdknet/azure-sdk-for-net that referenced this pull request Apr 4, 2019
REST Spec PR 'Azure/azure-rest-api-specs#5543'
REST Spec PR Author 'mnltejaswini'
REST Spec PR Last commit
@kpajdzik
Copy link
Contributor

kpajdzik commented Apr 5, 2019

If you haven't taken a look at our new onboarding experience at OpenAPIHub, it's a convenient way to create your PR when you're copying from an existing API version or when you're editing your existing specs. If you have any feedback or questions, feel free to use the feedback button on top of the site for help. Thanks!

Also, regarding "[Do not merge]" tag, take a look at GitHub pull requests drafts - https://github.blog/2019-02-14-introducing-draft-pull-requests/.

Copy link
Contributor

@KrisBash KrisBash left a comment

Choose a reason for hiding this comment

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

A few small comments to review

"$ref": "#/definitions/ScopeMap"
}
},
"201": {
Copy link
Contributor

Choose a reason for hiding this comment

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

A 202 would be more accurate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for PUT /PATCH resource we are following the AzureAsync header pattern rather than Location header pattern as recommended by https://armwiki.azurewebsites.net/faq/Intro.html?q=async

"$ref": "#/definitions/Token"
}
},
"201": {
Copy link
Contributor

Choose a reason for hiding this comment

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

202?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here

"type": "string"
},
"name": {
"description": "Specifies name of the password which should be regenerated if any -- password or password1.",
Copy link
Contributor

Choose a reason for hiding this comment

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

The description doesn't match the 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.

Fixed it.

"type": "string",
"x-ms-enum": {
"name": "PasswordName",
"modelAsString": false
Copy link
Contributor

Choose a reason for hiding this comment

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

modelAsString: true would allow for future enum additions without breaking API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it

"type": "string",
"x-ms-enum": {
"name": "PasswordName",
"modelAsString": false
Copy link
Contributor

Choose a reason for hiding this comment

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

See prior comment on modelAsString: true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it

}
}
},
"ProxyResource": {
Copy link
Contributor

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.

Fixed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KrisBash The parent swagger has some description mismatch with that defined in common types. The build breaks for that. I will fix the parent swagger and this change separate to this PR. For now I added the custom proxy resource schema to the definitions.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a recommendation, not blocking. thanks

@KrisBash KrisBash added ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review ARMChangesRequested <valid label in PR review process>add this label when require changes after ARM review WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required and removed WaitForARMFeedback <valid label in PR review process> add this label when ARM review is required ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review labels Apr 9, 2019
@mnltejaswini
Copy link
Contributor Author

@KrisBash Addressed your feedback.

@mnltejaswini
Copy link
Contributor Author

@kpajdzik We will be rolling out RP changes to Production starting next week after Build. Once it si deployed, I will resolve conflicts and remove the tag Do not Update tag on the title.

adxsdknet added a commit to adxsdknet/azure-sdk-for-net that referenced this pull request May 7, 2019
REST Spec PR 'Azure/azure-rest-api-specs#5543'
REST Spec PR Author 'mnltejaswini'
REST Spec PR Last commit
@kpajdzik
Copy link
Contributor

@mnltejaswini, is it ready to merge?

@mnltejaswini
Copy link
Contributor Author

mnltejaswini commented May 16, 2019

@kpajdzik Thank you for checking on it. The rollout is in progress. Its start was delayed due to some internal reasons. By next week, the rollout should be completed.

@mnltejaswini
Copy link
Contributor Author

Not sure why the SDK python failed. It complains INFO:swaggertosdk.autorest_tools: File "./scripts/multiapi_init_gen.py", line 22, in
INFO:swaggertosdk.autorest_tools: import azure.common
INFO:swaggertosdk.autorest_tools:ModuleNotFoundError: No module named 'azure'
INFO:swaggertosdk.autorest_tools:
INFO:swaggertosdk.autorest_tools:During handling of the above exception, another exception occurred:
INFO:swaggertosdk.autorest_tools:
INFO:swaggertosdk.autorest_tools:Traceback (most recent call last):
INFO:swaggertosdk.autorest_tools: File "./scripts/multiapi_init_gen.py", line 26, in
INFO:swaggertosdk.autorest_tools: import azure.common
INFO:swaggertosdk.autorest_tools:ModuleNotFoundError: No module named 'azure'
ERROR:swaggertosdk.autorest_tools:Command 'python ./scripts/multiapi_init_gen.py azure-mgmt-containerregistry' returned non-zero exit status 1.

@kpajdzik
Copy link
Contributor

Not sure why the SDK python failed. It complains INFO:swaggertosdk.autorest_tools: File "./scripts/multiapi_init_gen.py", line 22, in
INFO:swaggertosdk.autorest_tools: import azure.common
INFO:swaggertosdk.autorest_tools:ModuleNotFoundError: No module named 'azure'
INFO:swaggertosdk.autorest_tools:
INFO:swaggertosdk.autorest_tools:During handling of the above exception, another exception occurred:
INFO:swaggertosdk.autorest_tools:
INFO:swaggertosdk.autorest_tools:Traceback (most recent call last):
INFO:swaggertosdk.autorest_tools: File "./scripts/multiapi_init_gen.py", line 26, in
INFO:swaggertosdk.autorest_tools: import azure.common
INFO:swaggertosdk.autorest_tools:ModuleNotFoundError: No module named 'azure'
ERROR:swaggertosdk.autorest_tools:Command 'python ./scripts/multiapi_init_gen.py azure-mgmt-containerregistry' returned non-zero exit status 1.

I don't think you should be worried. @lmazuel to confirm.

@mnltejaswini mnltejaswini changed the title [Do not merge] Swagger and Examples for the new Scoped tokens feature of Azure Container registry Swagger and Examples for the new Scoped tokens feature of Azure Container registry May 17, 2019
@mnltejaswini
Copy link
Contributor Author

@kpajdzik we have rolled out to the region where this feature will be enabled. If you reviewed it, it is good for merging.

@kpajdzik
Copy link
Contributor

@sergey-shandar - this is ready to merge

@sergey-shandar
Copy link
Contributor

@lmazuel could you have a look why Python is failing?

@sergey-shandar sergey-shandar merged commit f1b1a70 into Azure:master May 20, 2019
dsgouda pushed a commit to Azure/azure-sdk-for-net that referenced this pull request May 20, 2019
* .NET SDK Resource Provider:'ContainerRegistry'
REST Spec PR 'Azure/azure-rest-api-specs#5543'
REST Spec PR Author 'mnltejaswini'
REST Spec PR Last commit

* .NET SDK Resource Provider:'ContainerRegistry'
REST Spec PR 'Azure/azure-rest-api-specs#5543'
REST Spec PR Author 'mnltejaswini'
REST Spec PR Last commit
mentat9 pushed a commit to mentat9/azure-sdk-for-net that referenced this pull request Jun 10, 2019
…6161)

* .NET SDK Resource Provider:'ContainerRegistry'
REST Spec PR 'Azure/azure-rest-api-specs#5543'
REST Spec PR Author 'mnltejaswini'
REST Spec PR Last commit

* .NET SDK Resource Provider:'ContainerRegistry'
REST Spec PR 'Azure/azure-rest-api-specs#5543'
REST Spec PR Author 'mnltejaswini'
REST Spec PR Last commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARMSignedOff <valid label in PR review process>add this label when ARM approve updates after review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants