-
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
Web: adding support for computeMode
to App Service plans
#2645
Web: adding support for computeMode
to App Service plans
#2645
Conversation
"type": "string", | ||
"x-ms-enum": { | ||
"name": "ComputeModeOptions", | ||
"modelAsString": false |
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.
Are you sure you want to set "modelAsString":false
this could cause breaking changes when/if the enum values are modified.
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.
Also, you may want to update some of the x-ms-examples
with this property
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.
I copied and paste this from another section below, so I assume that’s intentional ¯_(ツ)_/¯
I can definitely add an example though, sure 👍🏼
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.
As long as you are aware of the implications of breaking changes, we are OK with this. If you think that the value of this enum may change in the future we recommend setting "modelAsString":true
If unsure, we can leave it as is.
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.
pushed changes to update this and the existing reference to true
. There appears to be no examples for creating an App Service Plan at the moment; I can add one but I believe it'd be better for the service team to provide complete samples of the common scenarios?
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.
@tombuildsstuff What is the motivation for adding computemode to App Service Plan. You can get that information about dedicated/shared/dynamic from the App Service Plan SKU. https://docs.microsoft.com/en-us/rest/api/appservice/appserviceplans/createorupdate#skudescription
Consumption Plan:
"sku": {
"name": "Y1",
"tier": "Dynamic",
"size": "Y1",
"family": "Y",
"capacity": 0
}
From: https://docs.microsoft.com/en-us/rest/api/appservice/appserviceplans/getserverfarmskus
{
"value": [
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "F1",
"tier": "Free"
},
"capacity": {
"minimum": 0,
"maximum": 0,
"default": 0,
"scaleType": "none"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "D1",
"tier": "Shared"
},
"capacity": {
"minimum": 0,
"maximum": 0,
"default": 0,
"scaleType": "none"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "B1",
"tier": "Basic"
},
"capacity": {
"minimum": 1,
"maximum": 3,
"default": 1,
"scaleType": "manual"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "B2",
"tier": "Basic"
},
"capacity": {
"minimum": 1,
"maximum": 3,
"default": 1,
"scaleType": "manual"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "B3",
"tier": "Basic"
},
"capacity": {
"minimum": 1,
"maximum": 3,
"default": 1,
"scaleType": "manual"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "S1",
"tier": "Standard"
},
"capacity": {
"minimum": 1,
"maximum": 10,
"default": 1,
"scaleType": "automatic"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "S2",
"tier": "Standard"
},
"capacity": {
"minimum": 1,
"maximum": 10,
"default": 1,
"scaleType": "automatic"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "S3",
"tier": "Standard"
},
"capacity": {
"minimum": 1,
"maximum": 10,
"default": 1,
"scaleType": "automatic"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "P1",
"tier": "Premium"
},
"capacity": {
"minimum": 1,
"maximum": 20,
"default": 1,
"scaleType": "automatic"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "P2",
"tier": "Premium"
},
"capacity": {
"minimum": 1,
"maximum": 20,
"default": 1,
"scaleType": "automatic"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "P3",
"tier": "Premium"
},
"capacity": {
"minimum": 1,
"maximum": 20,
"default": 1,
"scaleType": "automatic"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "I1",
"tier": "Isolated"
},
"capacity": {
"minimum": 1,
"maximum": 20,
"default": 1,
"scaleType": "automatic"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "I2",
"tier": "Isolated"
},
"capacity": {
"minimum": 1,
"maximum": 20,
"default": 1,
"scaleType": "automatic"
}
},
{
"resourceType": "Microsoft.Web/serverfarms",
"sku": {
"name": "I3",
"tier": "Isolated"
},
"capacity": {
"minimum": 1,
"maximum": 20,
"default": 1,
"scaleType": "automatic"
}
}
],
"nextLink": null,
"id": null
}
Automation for azure-libraries-for-javaEncountered a Subprocess error: (azure-libraries-for-java)
Command: ['/usr/local/bin/autorest', '/tmp/tmp_7yy99ro/rest/specification/web/resource-manager/readme.md', '--azure-libraries-for-java-folder=/tmp/tmp_7yy99ro/sdk', '--fluent', '--java', '--multiapi', '--verbose'] AutoRest code generation utility [version: 2.0.4255; node: v7.10.1]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4255/node_modules/@microsoft.azure/autorest-core/dist' (2.0.4255)
Loading AutoRest extension '@microsoft.azure/autorest.java' (~2.1.32->2.1.49)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.38->2.3.38)
FATAL: System.InvalidOperationException: Swagger document contains two or more x-ms-enum extensions with the same name 'ComputeModeOptions' and different values: Shared,Dedicated,Dynamic vs. Shared,Dedicated,Dynamic
at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\ObjectBuilder.cs:line 147
at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 204
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 46
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 271
at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 66
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\Program.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NewPlugin.<Process>d__15.MoveNext()
FATAL: java/imodeler1 - FAILED
FATAL: Error: Plugin imodeler1 reported failure.
Process() cancelled due to exception : Plugin imodeler1 reported failure.
Error: Plugin imodeler1 reported failure. |
Automation for azure-sdk-for-goEncountered a Subprocess error: (azure-sdk-for-go)
Command: ['/usr/local/bin/autorest', '/tmp/tmp5xwcwdro/rest/specification/web/resource-manager/readme.md', '--go', '--go-sdk-folder=/tmp/tmp5xwcwdro/sdk', '--multiapi', '--package-version=latest', '--use=@microsoft.azure/autorest.go@~2.1.87', "--user-agent='Azure-SDK-For-Go/latest services'", '--verbose'] AutoRest code generation utility [version: 2.0.4255; node: v7.10.1]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4255/node_modules/@microsoft.azure/autorest-core/dist' (2.0.4255)
Loading AutoRest extension '@microsoft.azure/autorest.go' (~2.1.87->2.1.88)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.38->2.3.38)
Processing batch task - {"tag":"package-2016-09"} .
FATAL: System.InvalidOperationException: Swagger document contains two or more x-ms-enum extensions with the same name 'ComputeModeOptions' and different values: Shared,Dedicated,Dynamic vs. Shared,Dedicated,Dynamic
at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\ObjectBuilder.cs:line 147
at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 204
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 46
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SchemaBuilder.cs:line 131
at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 271
at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\SwaggerModeler.cs:line 66
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISH8kiit\38_20171116T010915\autorest.modeler\src\Program.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NewPlugin.<Process>d__15.MoveNext()
FATAL: go/imodeler1 - FAILED
FATAL: Error: Plugin imodeler1 reported failure.
Process() cancelled due to exception : Plugin imodeler1 reported failure.
Failure during batch task - {"tag":"package-2016-09"} -- Error: Plugin imodeler1 reported failure..
Error: Plugin imodeler1 reported failure. |
Automation for azure-sdk-for-pythonEncountered a Subprocess error: (azure-sdk-for-python)
Command: ['/usr/local/bin/autorest', '/tmp/tmpidflw4h_/rest/specification/web/resource-manager/readme.md', '--multiapi', '--python', '--python-mode=update', '--python-sdks-folder=/tmp/tmpidflw4h_/sdk', '--use=@microsoft.azure/autorest.python@2.1.40', '--version=preview'] AutoRest code generation utility [version: 2.0.4255; node: v7.10.1]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '/tmp/.autorest/@microsoft.azure_autorest-core@2.0.4259/node_modules/@microsoft.azure/autorest-core/dist' (2.0.4259)
Loading AutoRest extension '@microsoft.azure/autorest.python' (2.1.40->2.1.40)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.44->2.3.44)
FATAL: System.InvalidOperationException: Swagger document contains two or more x-ms-enum extensions with the same name 'ComputeModeOptions' and different values: Shared,Dedicated,Dynamic vs. Shared,Dedicated,Dynamic
at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\ObjectBuilder.cs:line 147
at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\SchemaBuilder.cs:line 217
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\SchemaBuilder.cs:line 48
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\SchemaBuilder.cs:line 133
at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\SchemaBuilder.cs:line 133
at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\SwaggerModeler.cs:line 310
at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\SwaggerModeler.cs:line 66
at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in C:\Users\ci\AppData\Local\Temp\PUBLISHu1dw1\44_20171214T003644\autorest.modeler\src\Program.cs:line 60
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NewPlugin.<Process>d__15.MoveNext()
FATAL: python/imodeler1 - FAILED
FATAL: Error: Plugin imodeler1 reported failure.
Process() cancelled due to exception : Plugin imodeler1 reported failure.
Error: Plugin imodeler1 reported failure. |
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.
LGTM
], | ||
"type": "string", | ||
"x-ms-enum": { | ||
"name": "ComputeModeOptions", |
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.
Looks like you are redefining the same enum ComputeModeOptions
multiple times but with different values for "modelAsString"
. What you may do is
- Create a single definition for it and have it referenced wherever required
- Modify
"modelAsString":true
for each definition ofComputeModeOptions
I'd recommend the former
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.
yeah I was just trying to debug that 😄
I've gone with the latter for the moment to get the build to pass, and I'll now look into the former :)
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.
pushed a change for the former 🤞
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.
@dsgouda sorry to pester, but would you be able to advise/explain how I can fix this build on Java and Go, since it appears fine in the Node build?
215ad7e
to
39f9498
Compare
16775c5
to
372c1a5
Compare
Hey Tom! Nice to see you here again! we'll tag someone from the Web team to review and Ack and we can move forward! |
@naveedaz PTAL since you may have some context regarding this spec. |
@naveedaz replying out of the in-line thread to be able to scroll to the bottom and see the latest reply - hope you don't mind :) AFAIK in order to create a Function App in a Consumption plan this is required, as can be seen in this ARM Template - if that's not the case is there any documentation we can reference about this? All of the examples I've seen for creating a Consumption plan referencing the ARM Templates which have this field present, which is why we believe it's required, but maybe we're wrong 😄 At the moment customers are unable to deploy Function Apps into a Consumption Plan with Terraform since this field is missing - hence the disclaimer here: https://www.terraform.io/docs/providers/azurerm/r/function_app.html Thanks! |
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.
Needs review
@tombuildsstuff The template excerpt below will achieve what you are looking for: |
@naveedaz I've taken a look and this appears correct, as such I've opened hashicorp/terraform-provider-azurerm#981. Given this field is available in the API (and ARM Templates) - should it be exposed in the Swagger either way? Thanks! |
@tombuildsstuff and is referenced in the App Service Plan model: https://github.com/Azure/azure-rest-api-specs/blob/master/specification/web/resource-manager/Microsoft.Web/stable/2016-03-01/CommonDefinitions.json#L379 |
@naveedaz right - however this value isn't configurable using the current Swagger (the value is only retrievable) - hence this PR :) |
@tombuildsstuff
|
@naveedaz the field Whilst admittedly the field lives within the SKU block, which is available in the SDK - the Hope that helps clarify what I mean :) Thanks! |
@tombuildsstuff |
@naveedaz ok cool, thanks for confirming that - I'll close this PR in the meantime :) I guess there's two outstanding issues which need to be fixed as a result of this PR:
No. 2 is particularly important in our case since many folks are either using/looking at ARM Templates in order to determine which configuration of fields needs to be set in other tooling (such as Terraform) in order to achieve certain configurations. @salameer @naveedaz where would be the best place to file bugs for these two issues? :) Thanks! |
Automation for azure-sdk-for-nodeNothing to generate for azure-sdk-for-node |
For #2 Please create an issue on https://github.com/Azure/azure-quickstart-templates against the template: https://github.com/Azure/azure-quickstart-templates/blob/master/101-function-app-create-dynamic/azuredeploy.json. I am not aware of a good place for documenting api-version differences. We will need to figure that out. |
@naveedaz opened Azure/azure-quickstart-templates#4352 to cover No. 2 @salameer would you be able to comment on the best way forward to fix No. 1? :) Thanks! |
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: AutoRest Linter Guidelines | AutoRest Linter Issues | Send feedback Thanks for your co-operation. |
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
I've based this on this ARM Template: https://github.com/Azure/azure-quickstart-templates/blob/master/101-function-app-create-dynamic/azuredeploy.json#L48 - which appears that it's possible to create a Dynamic App Service Plan without the App Service Environment. This is currently blocking hashicorp/terraform-provider-azurerm#960