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

[HDInsight] Add ListBillingSpecs API to HDInsight's stable and preview version #6360

Merged
merged 4 commits into from
Jun 28, 2019
Merged
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
@@ -0,0 +1,63 @@
{
"parameters": {
"location": "East US 2",
"api-version": "2015-03-01-preview",
"subscriptionId": "subid"
},
"responses": {
"200": {
"body": {
"vmSizes": [
"A5",
"A6",
"A7"
],
"vmSizeFilters": [
{
"filterMode": "Exclude",
"regions": null,
"clusterFlavors": null,
"nodeTypes": null,
"clusterVersions": null,
"osType": null,
"vmSizes": null
}
],
"billingResources": [
{
"region": "East US 2",
"billingMeters": [],
"diskBillingMeters": []
},
{
"region": "default",
"billingMeters": [
{
"meterParameter": "default",
"meter": "11111111-1111-1111-1111-111111111111",
"unit": "CoreHours"
},
{
"meterParameter": "Kafka",
"meter": "11111111-1111-1111-1111-111111111111",
"unit": "CoreHours"
}
],
"diskBillingMeters": [
{
"diskRpMeter": "11111111-1111-1111-1111-111111111111",
"sku": "All",
"tier": "Standard"
},
{
"diskRpMeter": "11111111-1111-1111-1111-111111111111",
"sku": "All",
"tier": "Standard"
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,45 @@
}
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs": {
"get": {
"tags": [
"Regions"
],
"operationId": "Locations_ListBillingSpecs",
"description": "Lists the billingSpecs for the specified subscription and location.",
"x-ms-examples": {
"Get the subscription billingSpecs for the specified location": {
"$ref": "./examples/HDI_Locations_ListBillingSpecs.json"
}
},
"parameters": [
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/LocationParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./operations.json#/definitions/ErrorResponse"
}
},
"200": {
"description": "OK response definition.",
"schema": {
"$ref": "#/definitions/BillingResponseListResult"
}
}
}
}
}
},
"definitions": {
Expand Down Expand Up @@ -338,6 +377,169 @@
}
}
}
},
"BillingResponseListResult": {
Copy link

@NelsonDaniel NelsonDaniel Jun 24, 2019

Choose a reason for hiding this comment

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

type: object #Resolved

"type": "object",
"description": "The response for the operation to get regional billingSpecs for a subscription.",
"properties": {
"vmSizes": {
"description": "The virtual machine sizes to include or exclude.",
"type": "array",
"items": {
"type": "string"
}
},
"vmSizeFilters": {
"description": "The virtual machine filtering mode. Effectively this can enabling or disabling the virtual machine sizes in a particular set.",
"type": "array",
"items": {
"$ref": "#/definitions/VmSizeCompatibilityFilterV2"
}
},
"billingResources": {
"description": "The billing and managed disk billing resources for a region.",
"type": "array",
"items": {
"$ref": "#/definitions/BillingResources"
}
}
}
},
"VmSizeCompatibilityFilterV2": {
Copy link

@NelsonDaniel NelsonDaniel Jun 24, 2019

Choose a reason for hiding this comment

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

type: object #Resolved

"type": "object",
"description": "This class represent a single filter object that defines a multidimensional set. The dimensions of this set are Regions, ClusterFlavors, NodeTypes and ClusterVersions. The constraint should be defined based on the following: FilterMode (Exclude vs Include), VMSizes (the vm sizes in affect of exclusion/inclusion) and the ordering of the Filters. Later filters override previous settings if conflicted.",
"properties": {
"filterMode": {
Copy link

@NelsonDaniel NelsonDaniel Jun 24, 2019

Choose a reason for hiding this comment

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

from the description there is just two states. Would bool or enum fit better here? #Resolved

"description": "The filtering mode. Effectively this can enabling or disabling the VM sizes in a particular set.",
"type": "string",
"enum": [
"Exclude",
"Include"
],
"x-ms-enum": {
"name": "FilterMode",
"modelAsString": true
}
},
"regions": {
"description": "The list of regions under the effect of the filter.",
"type": "array",
"items": {
"type": "string"
}
},
"clusterFlavors": {
"description": "The list of cluster flavors under the effect of the filter.",
"type": "array",
"items": {
"type": "string"
}
},
"nodeTypes": {
"description": "The list of node types affected by the filter.",
"type": "array",
"items": {
"type": "string"
}
},
"clusterVersions": {
"description": "The list of cluster versions affected in Major.Minor format.",
"type": "array",
"items": {
"type": "string"
}
},
"osType": {
"description": "The OSType affected, Windows or Linux.",
"type": "array",
"items": {
"type": "string",
"enum": [
"Windows",
"Linux"
],
"x-ms-enum": {
"name": "OSType",
"modelAsString": false

Choose a reason for hiding this comment

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

I think this should be "modelAsString" : true
@ravbhatnagar, do you agree?

Copy link
Contributor

Choose a reason for hiding this comment

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

We want to reuse the exising OSType definition here. If we change "modelAsString" as true for this OSType definition, we will get the following error:

FATAL: System.InvalidOperationException: Swagger document contains two or more x-ms-enum extensions with the same name 'OSType' and different values: Windows,Linux vs. Windows,Linux
   at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/ObjectBuilder.cs:line 150
   at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/SchemaBuilder.cs:line 217
   at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/SchemaBuilder.cs:line 48
   at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/ObjectBuilder.cs:line 182
   at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/SchemaBuilder.cs:line 217
   at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/SchemaBuilder.cs:line 48
   at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/SchemaBuilder.cs:line 133
   at AutoRest.Modeler.ObjectBuilder.BuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/ObjectBuilder.cs:line 182
   at AutoRest.Modeler.SchemaBuilder.ParentBuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/SchemaBuilder.cs:line 217
   at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/SchemaBuilder.cs:line 48
   at AutoRest.Modeler.SchemaBuilder.BuildServiceType(String serviceTypeName, Boolean required) in /opt/vsts/work/1/s/src/SchemaBuilder.cs:line 133
   at AutoRest.Modeler.SwaggerModeler.BuildCompositeTypes() in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 348
   at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in /opt/vsts/work/1/s/src/SwaggerModeler.cs:line 66
   at AutoRest.Modeler.Program.<ProcessInternal>d__2.MoveNext() in /opt/vsts/work/1/s/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: csharp/imodeler1 - FAILED
FATAL: Error: Plugin imodeler1 reported failure.
Process() cancelled due to exception : Plugin imodeler1 reported failure.
  Error: Plugin imodeler1 reported failure.

Choose a reason for hiding this comment

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

That definition should also be corrected

Copy link
Contributor

Choose a reason for hiding this comment

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

We cannot do this because our SDK is GA now and it will be a breaking change. We will fix the issue in the next API version. Created a GitHub issue #6505 to track this.

}
}
},
"vmSizes": {
"description": "The list of virtual machine sizes to include or exclude.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"BillingResources": {
Copy link

@NelsonDaniel NelsonDaniel Jun 24, 2019

Choose a reason for hiding this comment

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

type: object #Resolved

"type": "object",
"description": "The billing resources.",
"properties": {
"region": {
"description": "The region or location.",
"type": "string"
},
"billingMeters": {
"description": "The billing meter information.",
"type": "array",
"items": {
"$ref": "#/definitions/BillingMeters"
}
},
"diskBillingMeters": {
"description": "The managed disk billing information.",
"type": "array",
"items": {
"$ref": "#/definitions/DiskBillingMeters"
}
}
}
},
"BillingMeters": {
Copy link

@NelsonDaniel NelsonDaniel Jun 24, 2019

Choose a reason for hiding this comment

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

type: object #Resolved

"type": "object",
"description": "The billing meters.",
"properties": {
"meterParameter": {
"description": "The virtual machine sizes.",
"type": "string"
},
"meter": {
"description": "The HDInsight meter guid.",
"type": "string"
},
"unit": {
"description": "The unit of meter, VMHours or CoreHours.",
"type": "string"
}
}
},
"DiskBillingMeters": {
"type": "object",
"description": "The disk billing meters.",
"properties": {
"diskRpMeter": {
"description": "The managed disk meter guid.",
"type": "string"
},
"sku": {
"description": "The managed disk billing sku, P30 or S30.",
"type": "string"
},
"tier": {
idear1203 marked this conversation as resolved.
Show resolved Hide resolved
"description": "The managed disk billing tier, Standard or Premium.",
"type": "string",
"enum": [
"Standard",
"Premium"
],
"x-ms-enum": {
"name": "Tier",
"modelAsString": false

Choose a reason for hiding this comment

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

Please change this to true.

Choose a reason for hiding this comment

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

I think this should be "modelAsString" : true
@ravbhatnagar, do you agree?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes sure

Copy link
Contributor

Choose a reason for hiding this comment

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

We cannot do this because our SDK is GA now and it will be a breaking change. We will fix the issue in the next API version. Created a GitHub issue #6505 to track this.

}
}
}
}
},
"parameters": {
Expand All @@ -353,7 +555,7 @@
"in": "path",
"required": true,
"type": "string",
"description": "The location.",
"description": "The Azure location (region) for which to make the request.",
"x-ms-parameter-location": "method"
},
"ApiVersionParameter": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"parameters": {
"location": "East US 2",
"api-version": "2018-06-01-preview",
"subscriptionId": "subid"
},
"responses": {
"200": {
"body": {
"vmSizes": [
"A5",
"A6",
"A7"
],
"vmSizeFilters": [
{
"filterMode": "Exclude",
"regions": null,
"clusterFlavors": null,
"nodeTypes": null,
"clusterVersions": null,
"osType": null,
"vmSizes": null
}
],
"billingResources": [
{
"region": "East US 2",
"billingMeters": [],
"diskBillingMeters": []
},
{
"region": "default",
"billingMeters": [
{
"meterParameter": "default",
"meter": "11111111-1111-1111-1111-111111111111",
"unit": "CoreHours"
},
{
"meterParameter": "Kafka",
"meter": "11111111-1111-1111-1111-111111111111",
"unit": "CoreHours"
}
],
"diskBillingMeters": [
{
"diskRpMeter": "11111111-1111-1111-1111-111111111111",
"sku": "All",
"tier": "Standard"
},
{
"diskRpMeter": "11111111-1111-1111-1111-111111111111",
"sku": "All",
"tier": "Standard"
}
]
}
]
}
}
}
}
Loading