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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

},
"ResourceName": {
"name": "resourceName",
"in": "path",
"description": "The name of the recovery services vault.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"ApiVersion": {
"name": "api-version",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

"name": "resourceType",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the resource type."
},
"FilterParameter": {
"name": "$filter",
"in": "query",
Expand All @@ -572,4 +565,4 @@
"x-ms-parameter-location": "method"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

"name": "resourceType",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the resource type."
},
"FilterParameter": {
"name": "$filter",
"in": "query",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

"allOf": [
{
"$ref": "#/definitions/ServicePlacementPolicyDescription"
Expand Down Expand Up @@ -10740,7 +10740,7 @@
},
"ServicesHealthStateFilterOptionalQueryParam": {
"name": "ServicesHealthStateFilter",
"description": "Allows filtering of the services health state objects returned in the result of services health query based on their health state.\nThe possible values for this parameter include integer value of one of the following health states.\nOnly services that match the filter are returned. All services are used to evaluate the aggregated health state.\nIf not specified, all entries are returned. The state values are flag based enumeration, so the value could be a combination of these value\nobtained using bitwise 'OR' operator. For example, if the provided value is 6 then health state of services with HealthState value of OK (2) and Warning (4) will be returned. \n \n- Default - Default value. Matches any HealthState. The value is zero. \n- None - Filter that doesn�t match any HealthState value. Used in order to return no results on a given collection of states. The value is 1. \n- Ok - Filter that matches input with HealthState value Ok. The value is 2. \n- Warning - Filter that matches input with HealthState value Warning. The value is 4. \n- Error - Filter that matches input with HealthState value Error. The value is 8. \n- All - Filter that matches input with any HealthState value. The value is 65535. \n",
"description": "Allows filtering of the services health state objects returned in the result of services health query based on their health state.\nThe possible values for this parameter include integer value of one of the following health states.\nOnly services that match the filter are returned. All services are used to evaluate the aggregated health state.\nIf not specified, all entries are returned. The state values are flag based enumeration, so the value could be a combination of these value\nobtained using bitwise 'OR' operator. For example, if the provided value is 6 then health state of services with HealthState value of OK (2) and Warning (4) will be returned. \n \n- Default - Default value. Matches any HealthState. The value is zero. \n- None - Filter that doesn't match any HealthState value. Used in order to return no results on a given collection of states. The value is 1. \n- Ok - Filter that matches input with HealthState value Ok. The value is 2. \n- Warning - Filter that matches input with HealthState value Warning. The value is 4. \n- Error - Filter that matches input with HealthState value Error. The value is 8. \n- All - Filter that matches input with any HealthState value. The value is 65535. \n",
"in": "query",
"x-ms-parameter-location": "method",
"type": "integer",
Expand Down Expand Up @@ -11238,4 +11238,4 @@
"description": "The server timeout for performing the operation in seconds. This specifies the time duration that the client is willing to wait for the requested operation to complete. The default value for this parameter is 60 seconds."
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4294,7 +4294,7 @@
"/ImageStore/{contentPath}": {
"put": {
"summary": "Uploads contents of the file to the image store.",
"description": "Uploads contents of the file to the image store. Use this API if the file is small enough to upload again if the connection fails. The file's data needs to be added to the request body. The contents will be uploaded to the specified path. Image store service uses a mark file to indicate the availability of the folder. The mark file is an empty file named \"_.dir\". The mark file is generated by the image store service when all files in a folder are uploaded. When using File-by-File approach to upload application package in REST, the image store service isnt aware of the file hierarchy of the application package; you need to create a mark file per folder and upload it last, to let the image store service know that the folder is complete.\n",
"description": "Uploads contents of the file to the image store. Use this API if the file is small enough to upload again if the connection fails. The file's data needs to be added to the request body. The contents will be uploaded to the specified path. Image store service uses a mark file to indicate the availability of the folder. The mark file is an empty file named \"_.dir\". The mark file is generated by the image store service when all files in a folder are uploaded. When using File-by-File approach to upload application package in REST, the image store service isn't aware of the file hierarchy of the application package; you need to create a mark file per folder and upload it last, to let the image store service know that the folder is complete.\n",
"operationId": "UploadFile",
"parameters": [
{
Expand Down Expand Up @@ -8184,7 +8184,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",
"allOf": [
{
"$ref": "#/definitions/ServicePlacementPolicyDescription"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3128,27 +3128,25 @@
"api-version": {
"name": "api-version",
"in": "query",
"description": "The version of the API. This is a required parameter and it's value must be \"2016-09-01\".",
"description": "The version of the API. This is a required parameter.",
"required": true,
"type": "string",
"enum": [
"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"."

},
"applicationName": {
"name": "applicationName",
"in": "path",
"description": "The name of the application resource.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"applicationTypeName": {
"name": "applicationTypeName",
"in": "path",
"description": "The name of the application type name resource",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"clusterNameParameter": {
"name": "clusterName",
Expand Down Expand Up @@ -3199,7 +3197,8 @@
"in": "path",
"description": "The name of the service resource in the format of {applicationName}~{serviceName}.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"subscriptionId": {
"name": "subscriptionId",
Expand All @@ -3213,7 +3212,8 @@
"in": "path",
"description": "The application type version.",
"required": true,
"type": "string"
"type": "string",
"x-ms-parameter-location": "method"
},
"clusterBodyParam": {
"name": "Cluster",
Expand All @@ -3222,7 +3222,8 @@
"required": true,
"schema": {
"$ref": "#/definitions/Cluster"
}
},
"x-ms-parameter-location": "method"
},
"clusterUpdateParameterBody": {
"name": "ClusterUpdateParameters",
Expand All @@ -3231,7 +3232,8 @@
"required": true,
"schema": {
"$ref": "#/definitions/ClusterUpdateParameters"
}
},
"x-ms-parameter-location": "method"
}
}
}