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

[Resources/locks] Added GetAtResourceLevel #666

Merged
merged 6 commits into from
Dec 21, 2016
Merged

Conversation

mcardosos
Copy link
Contributor

@mcardosos mcardosos commented Nov 3, 2016

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

  • The title of the PR 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 information on cleaning up the commits in your pull request, see this page.
  • Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
  • If applicable, the PR references the bug/issue that it fixes.
  • Swagger files are correctly named (e.g. the api-version in the path should match the api-version in the spec).

Quality of Swagger

  • I have read the contribution guidelines.
  • My spec meets the review criteria:
    • The spec conforms to the Swagger 2.0 specification.
    • Validation errors from the Linter extension for VS Code have all been fixed for this spec. (Note: for large, previously checked in specs, there will likely be many errors shown. Please contact our team so we can set a timeframe for fixing these errors if your PR is not going to address them).
    • The spec follows the patterns described in the Swagger good patterns document unless the service API makes this impossible.

@@ -325,6 +325,76 @@
"description": "OK"
}
}
},
"get": {
Copy link
Contributor

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?

Copy link
Contributor

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 ?

Copy link
Contributor

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.",
Copy link
Contributor

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",
Copy link
Contributor

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?

@amarzavery
Copy link
Contributor

@vivsriaus @TianoMS - Can you please review these fixes and let us know the status?

@@ -173,6 +173,125 @@
}
}
},
"/{resourceId}/providers/Microsoft.Authorization/locks/{lockName}": {
Copy link
Contributor

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

@vivsriaus
Copy link
Contributor

@amarzavery Just one nit, other than that this LGTM

@mcardosos
Copy link
Contributor Author

@vivsriaus done

@amarzavery
Copy link
Contributor

amarzavery commented Nov 27, 2016

@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:
"ManagementLocks_Get" -> will be renamed to "ManagementLocks_GetAtSubscriptionLevel" and a new method is being added "ManagementLocks_GetAtResourceLevel".

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.

Copy link
Contributor

@veronicagg veronicagg left a 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. "
Copy link
Contributor

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?

Copy link
Contributor

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}".

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

Copy link
Contributor

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}"
Copy link
Contributor

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."

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@salameer
Copy link
Member

salameer commented Dec 9, 2016

Hi @veronicagg are we ready to merge here?

@veronicagg
Copy link
Contributor

@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.

@amarzavery amarzavery merged commit d7903f7 into Azure:master Dec 21, 2016
@AutorestCI
Copy link

No modification for Python

@AutorestCI
Copy link

No modification for NodeJS

@AutorestCI
Copy link

@mcardosos mcardosos deleted the locks branch September 12, 2017 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants