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

Fixing global parameters for siterecovery and resourcehealth #1753

Closed
wants to merge 5 commits into from

Conversation

amarzavery
Copy link
Contributor

@amarzavery amarzavery commented Sep 27, 2017

No description provided.

…Moreover it is not being used anywhere. So removing it.
@@ -548,13 +548,6 @@
"description": "The name of the resource group.",
"x-ms-parameter-location": "method"
},
"ResourceTypeParameter": {
Copy link
Contributor

Choose a reason for hiding this comment

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

it appears this wasn't been used in the spec or any others in the repo, right? so removing it shouldn't cause any harm.

Copy link
Contributor Author

@amarzavery amarzavery Sep 27, 2017

Choose a reason for hiding this comment

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

it was not being used and having it in the global parameters section was causing this to be a client property.

@@ -564,13 +564,6 @@
"description": "The name of the resource group.",
"x-ms-parameter-location": "method"
},
"ResourceTypeParameter": {
Copy link
Contributor

Choose a reason for hiding this comment

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

same situation as above here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup

@@ -14122,14 +14122,16 @@
"in": "path",
"description": "The name of the resource group where the recovery services vault is present.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
Copy link
Contributor

Choose a reason for hiding this comment

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

what issue was not having this causing? what's the breaking change on generated code due to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

new SiteRecoveryManagementClient(credentials, subscriptionId, resourceGroupName, resourceName);
This makes the client require resourceGroupName and resourceName in the client constructor. Both of these become client properties and that is incorrect. I had filed an issue in the linter repo about this. If it is management-plane swagger then the linter should warn if it sees anything else apart from subscriptionId and apiVersion and does not have x-ms-parameter-location set to method. Azure/azure-openapi-validator#84

Choose a reason for hiding this comment

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

As responded over the mail thread:

As per our scenarios, customers are more likely to work in the context of a single ResourceName, so, It makes more sense to have ResourceGroupName and ResourceName in global parameters section for recoveryservicessiterecovery specification. For more context we have:

  1. https://github.com/Azure/azure-rest-api-specs/blob/current/specification/recoveryservices/resource-manager/Microsoft.RecoveryServices/2016-06-01/vaults.json which defines CRUD on ResourceName and hence, ResourceGroupName and ResourceName are already method parameters.
  2. However, specification at https://github.com/Azure/azure-rest-api-specs/tree/current/specification/recoveryservicessiterecovery/resource-manager is mostly sused by customer in the context of a single ResourceName. So, initializing ResourceGroupName and ResourceName at the time of client initialization aligns better to our customer scenario.

Moreover, any change as suggested in the thread would be a breaking change for our existing clients like PowerShell and Ibiza (requires passing ResourceGroupName and ResourceName explicitly as input to every call rather than just once at sdk client initialization) as I can understand, which we would not be able to take at this point.
Let us know if we are missing some point to understand here.

Thanks,
Avneesh

@veronicagg
Copy link
Contributor

@mukum would you be ok with these updates?

…ters wherever applicable in service fabric management plane.
@veronicagg
Copy link
Contributor

@amarzavery is there a reason for adding Service Fabric changes to this PR? It'd be good to split them in another PR, since we'd want to have someone from that team take a look.

@amarzavery
Copy link
Contributor Author

All of them are fixing the same thing. Hence grouped them together.

@veronicagg
Copy link
Contributor

@sankalpsoni for ResourceHealth spec update, any concerns with the update?

"2016-09-01"
],
"default": "2016-09-01"
"type": "string"
Copy link
Contributor Author

@amarzavery amarzavery Sep 28, 2017

Choose a reason for hiding this comment

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

@samedder - Can you please take a look at changes I made in the service fabric resource-manager spec.

  • Some of the global parameters missed the "x-ms-parameter-location": "method" extension.
  • The enum array is not required in the first place and it had an incorrect value as well. If the value has to be present then it should be in sync with the api-version in the file path that is "2017-07-01-preview" in this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

@chingchenmsft needs to sign off on this. I believe this may break our clients so he should verify.

Copy link
Contributor Author

@amarzavery amarzavery Sep 28, 2017

Choose a reason for hiding this comment

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

@juhacket - I believe these changes were made by you and merged in the PR #1717. Can you please take a look?

Copy link
Member

Choose a reason for hiding this comment

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

Can you fix the description as well? "This is a required parameter and it's value must be "2016-09-01"."

@@ -7399,7 +7399,7 @@
},
"ServicePlacementPreferPrimaryDomainPolicyDescription": {
"x-ms-discriminator-value": "PreferPrimaryDomain",
"description": "Describes the policy to be used for placement of a Service Fabric service where the service's Primary replicas should optimally be placed in a particular domain.\n\nThis placement policy is usually used with fault domains in scenarios where the Service Fabric cluster is geographically distributed in order to indicate that a services primary replica should be located in a particular fault domain, which in geo-distributed scenarios usually aligns with regional or datacenter boundaries. Note that since this is an optimization it is possible that the Primary replica may not end up located in this domain due to failures, capacity limits, or other constraints.\n",
"description": "Describes the policy to be used for placement of a Service Fabric service where the service's Primary replicas should optimally be placed in a particular domain.\n\nThis placement policy is usually used with fault domains in scenarios where the Service Fabric cluster is geographically distributed in order to indicate that a service's primary replica should be located in a particular fault domain, which in geo-distributed scenarios usually aligns with regional or datacenter boundaries. Note that since this is an optimization it is possible that the Primary replica may not end up located in this domain due to failures, capacity limits, or other constraints.\n",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@samedder - In this commit I have replaced the MS Word style single quote with simple single quote as it generates wonky characters in the generated client documentation.

"2016-09-01"
],
"default": "2016-09-01"
"type": "string"
Copy link
Contributor

Choose a reason for hiding this comment

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

@chingchenmsft needs to sign off on this. I believe this may break our clients so he should verify.

@QingChenmsft
Copy link
Contributor

@juhacket is the owner now, need his sign off.

@azuresdkciprbot
Copy link

Hi There,

I am the AutoRest Linter Azure bot. I am here to help. My task is to analyze the situation from the AutoRest linter perspective. Please review the below analysis result:

File: specification/recoveryservicessiterecovery/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 23
After the PR: Warning(s): 0 Error(s): 23

File: specification/resourcehealth/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 1
After the PR: Warning(s): 0 Error(s): 1

File: specification/servicefabric/data-plane/readme.md
Before the PR: Warning(s): 0 Error(s): 652
After the PR: Warning(s): 0 Error(s): 652

File: specification/servicefabric/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 40
After the PR: Warning(s): 0 Error(s): 40

💡 Please review potentially introduced Error(s)/Warning(s): Analysis Report 💡

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@amarzavery
Copy link
Contributor Author

@lmazuel - Can you help take a look at the python generator issue over here.

Traceback (most recent call last):
  File "/SwaggerToSdkMain.py", line 142, in <module>
    main()
  File "/SwaggerToSdkMain.py", line 139, in main
    args.autorest_bin)
  File "/SwaggerToSdkMain.py", line 36, in generate_sdk
    config = read_config(sdk_repo.working_tree_dir, config_path)
  File "/SwaggerToSdkCore.py", line 435, in read_config
    return json.loads(config_fd.read())
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 45 column 5 (char 1387)

@azuresdkciprbot
Copy link

Hi There,

I am the AutoRest Linter Azure bot. I am here to help. My task is to analyze the situation from the AutoRest linter perspective. Please review the below analysis result:

File: specification/recoveryservicessiterecovery/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 23
After the PR: Warning(s): 0 Error(s): 23

File: specification/resourcehealth/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 1
After the PR: Warning(s): 0 Error(s): 1

File: specification/servicefabric/data-plane/readme.md
Before the PR: Warning(s): 0 Error(s): 652
After the PR: Warning(s): 0 Error(s): 652

File: specification/servicefabric/resource-manager/readme.md
Before the PR: Warning(s): 0 Error(s): 40
After the PR: Warning(s): 0 Error(s): 40

💡 Please review potentially introduced Error(s)/Warning(s): Analysis Report 💡

AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback

Thanks for your co-operation.

@lmazuel
Copy link
Member

lmazuel commented Oct 2, 2017

@amarzavery CI fixed

@veronicagg
Copy link
Contributor

@amarzavery I believe we're missing response from ResourceHealth on the change. SiteRecovery changes would need to be updated based on the response from the team. Are we signed off from Service Fabric side?

@amarzavery
Copy link
Contributor Author

closing this in favor of #1793 and #1794

@amarzavery amarzavery closed this Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants