-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[Resources/locks] Added GetAtResourceLevel #666
Conversation
@@ -325,6 +325,76 @@ | |||
"description": "OK" | |||
} | |||
} | |||
}, | |||
"get": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vivsriaus @TianoMS - Looks like these APIs were missing. @mcardosos from the Azure Go SDK team found this by looking at the MSDN REST API docs. Can you please review the changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}"
"{resourceId}/providers/Microsoft.Authorization/locks/{lockName}"
@TianoMS @vivsriaus - Do you think having the version with resourceId would be helpful ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amarzavery Yes, we've received feedback from people, saying the methods that take in parentResourcePath is not at all intuitive. It is pretty cumbersome to construct the request URI for the above using parentResourcePath. A simpler implementation would be the one suggested by you (similar to this) or a path that points to a a fully qualified /{lockId}
"in": "path", | ||
"required": true, | ||
"type": "string", | ||
"description": "Resource identity.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy paste error in description.This needs to be fixed for the entire spec.
@@ -407,8 +596,8 @@ | |||
"tags": [ | |||
"ManagementLocks" | |||
], | |||
"operationId": "ManagementLocks_Get", | |||
"description": "Gets the management lock of a scope.", | |||
"operationId": "ManagementLocks_GetAtSubscriptionLevel", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vivsriaus @TianoMS -
This will be a breaking change in the SDK. It is the correct change though. Is this acceptable?
@vivsriaus @TianoMS - Can you please review these fixes and let us know the status? |
@@ -173,6 +173,125 @@ | |||
} | |||
} | |||
}, | |||
"/{resourceId}/providers/Microsoft.Authorization/locks/{lockName}": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we please replace {resourceId} with {scope}. In ARM specs, resourceId signifies the fully qualified Id of a resource
@amarzavery Just one nit, other than that this LGTM |
@vivsriaus done |
@lmazuel, @johanste, @veronicagg, @mcardosos @markcowl @vivsriaus @jianghaolu FYI, This PR will cause a breaking change in the generated SDK. However, this is a good breaking change. If all of you guys agree to this then feel free to merge the PR at the earliest. The change is as follows: It will be a breaking change for the SDKs and an easy to fix change inside the Powershell and Xplat CLI/ Py CLI command implementation (Possibly, No breaking change to the command API). In fact, new optional parameters/switches can be added to list management locks at the resource level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just left a comment, rest looks good to me. It does have a breaking change for SDKs as you pointed out, so we should make sure all SDKs are ok with this.
A couple more questions:
1 - I assume the call to the API with resource ID is working, correct? @mcardosos
2 - With "scope" does it mean we could remove the other paths that are more specific? Calling it 'scope' looks to follow a similar format as in'policy management', which appears to group all scopes into one path, and describe what scope could be in the documentation (per https://docs.microsoft.com/en-us/rest/api/resources/policyassignments).
"in": "path", | ||
"required": true, | ||
"type": "string", | ||
"description": "The scope for the lock. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the description for scope indicate what "scope" string should look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point an example helps.
The scope for the lock, where the scope is the unique Azure Resource id in the form "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcardosos - ROFL . I made the same comment as you have fixed. Your fix and my comment were 4 seconds apart.
@@ -186,7 +186,7 @@ | |||
"in": "path", | |||
"required": true, | |||
"type": "string", | |||
"description": "The scope for the lock. " | |||
"description": "The scope for the lock. A scope can be defined at subscription, resource group, or resource level. It looks like this: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Are these other scope strings also valid? Extract below taken from policy management documentation:
"When providing a scope for the assignment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All those are valid yes. Would you prefer that more complete description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcardosos Yes, it'd be good to have a more complete description, as it may get picked up for documentation, and this way users have more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Hi @veronicagg are we ready to merge here? |
@salameer I made one more comment for @mcardosos. This change is a breaking change though, and as @amarzavery mentioned above it may require some changes to PowerShell/CLI, so we should know that all SDKs approve making this change, before merging. |
No modification for Python |
No modification for NodeJS |
This PR would fix issue 394. In the Go SDK, this would also fix issue 440 when regenerating the SDK.
cc @TianoMS
This checklist is used to make sure that common issues in a pull request are addressed. This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
PR information
api-version
in the path should match theapi-version
in the spec).Quality of Swagger