Skip to content
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
@@ -0,0 +1,19 @@
{
"parameters": {
"api-version": "2018-06-01",
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23",
"pricingName": "default"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/VirtualMachines",
"name": "default",
"type": "Microsoft.Security/pricings",
"properties": {
"pricingTier": "Standard"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"parameters": {
"api-version": "2018-06-01",
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23"
},
"responses": {
"200": {
"body": {
"value": [{
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/VirtualMachines",
"name": "VirtualMachines",
"type": "Microsoft.Security/pricings",
"properties": {
"pricingTier": "Standard"
}
},
{
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/SqlServers",
"name": "SqlServers",
"type": "Microsoft.Security/pricings",
"properties": {
"pricingTier": "Standard"
}
},
{
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/AppServices",
"name": "AppServices",
"type": "Microsoft.Security/pricings",
"properties": {
"pricingTier": "Free"
}
}]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"parameters": {
"api-version": "2018-06-01",
"subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23",
"pricingName": "VirtualMachines",
"pricing": {
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/pricings/VirtualMachines",
"name": "VirtualMachines",
"type": "Microsoft.Security/pricings",
"properties": {
"pricingTier": "Standard"
}
}
},
"responses": {
"202": {
"body": ""
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
{
"swagger": "2.0",
"info": {
"title": "Security Center",
"description": "API spec for Microsoft.Security (Azure Security Center) resource provider",
"version": "2018-06-01"
},
"host": "management.azure.com",
"schemes": ["https"],
"consumes": ["application/json"],
"produces": ["application/json"],
"security": [{
"azure_auth": [
"user_impersonation"
]
}],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "impersonate your user account"
}
}
},
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings": {
"get": {
"x-ms-examples": {
"Get pricings on subscription": {
"$ref": "./examples/Pricings/ListPricings_example.json"
}
},
"tags": ["Pricings"],
"description": "Security pricing configurations in the subscription",
"operationId": "Pricings_List",
"parameters": [{
"$ref": "#/parameters/ApiVersion"
}, {
"$ref": "#/parameters/SubscriptionId"
}],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/PricingList"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/CloudError"
}
}
}
}
},
"/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}": {
"get": {
"x-ms-examples": {
"Get pricings on subscription": {
"$ref": "./examples/Pricings/GetPricingByName_example.json"
}
},
"tags": ["Pricings"],
"description": "Security pricing configuration in the subscription",
"operationId": "Pricings_Get",
"parameters": [{
"$ref": "#/parameters/ApiVersion"
}, {
"$ref": "#/parameters/SubscriptionId"
}, {
"$ref": "#/parameters/PricingName"
}],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Pricing"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/CloudError"
}
}
}
},
"put": {
"x-ms-examples": {
"Update pricing on subscription": {
"$ref": "./examples/Pricings/PutPricingByName_example.json"
}
},
Copy link
Member

Choose a reason for hiding this comment

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

Do you need to add x-ms-long-running-operation": true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Current implementation does not expect it.
should it ?

Copy link
Member

Choose a reason for hiding this comment

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

The swagger shows the put as a long running operation that returns a 202, in which case it should have a location header that contains an operation url that can be polled for the status of the put, if that is the case then adding x-ms-long-running-operation will cause code to be generated to support this, if the operation is not async then it should return 200 0r 201 (https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md#response)

"tags": ["Pricings"],
"description": "Security pricing configuration in the subscription",
"operationId": "Pricings_Update",
"parameters": [{
"$ref": "#/parameters/ApiVersion"
}, {
"$ref": "#/parameters/SubscriptionId"
}, {
"$ref": "#/parameters/PricingName"
}, {
"$ref": "#/parameters/Pricing"
}],
"responses": {
"202": {
"description": "Accepted -- Update request accepted; operation will complete asynchronously."
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/CloudError"
}
}
}
}
}
},
"definitions": {
"CloudError": {
"x-ms-external": true,
"type": "object",
"description": "Error response structure.",
"properties": {
"error": {
"x-ms-client-flatten": true,
"description": "Error data",
"$ref": "#/definitions/CloudErrorBody"
}
}
},
"CloudErrorBody": {
"x-ms-external": true,
"type": "object",
"description": "Error details.",
"properties": {
"code": {
"readOnly": true,
"type": "string",
"description": "An identifier for the error. Codes are invariant and are intended to be consumed programmatically."
},
"message": {
"readOnly": true,
"type": "string",
"description": "A message describing the error, intended to be suitable for display in a user interface."
}
}
},
"Resource": {
"type": "object",
"description": "Describes an Azure resource.",
"properties": {
"id": {
"readOnly": true,
"type": "string",
"description": "Resource Id"
},
"name": {
"readOnly": true,
"type": "string",
"description": "Resource name"
},
"type": {
"readOnly": true,
"type": "string",
"description": "Resource type"
}
},
"x-ms-azure-resource": true
},
"PricingList": {
"description": "List of pricing configurations response",
"required": [
"value"
],
"properties": {
"value": {
"type": "array",
"description": "List of pricing configurations",
"items": {
"$ref": "#/definitions/Pricing"
}
}
}
},
"Pricing": {
"type": "object",
"description": "Pricing tier will be applied for the scope based on the resource ID",
"properties": {
"properties": {
"x-ms-client-flatten": true,
"description": "Pricing data",
"$ref": "#/definitions/PricingProperties"
}
},
"allOf": [{
"$ref": "#/definitions/Resource"
}]
},
"PricingProperties": {
"type": "object",
"description": "Pricing properties for the relevant scope",
"properties": {
"pricingTier": {
"type": "string",
"description": "The pricing tier value",
"enum": ["Free", "Standard"],
"x-ms-enum": {
"name": "pricingTier",
"modelAsString": true,
"values": [{
"value": "Free",
"description": "Get free Azure security center experience with basic security features"
},
{
"value": "Standard",
"description": "Get the standard Azure security center experience with advanced security features"
}
]
}
},
"FreeTrialRemainingTime": {
"type": "string",
"format": "duration",
"readOnly": true,
"description": "The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S)."
}
},
"required": [
"pricingTier"
]
}
},
"parameters": {
"SubscriptionId": {
"name": "subscriptionId",
"in": "path",
"required": true,
"pattern": "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$",
"type": "string",
"description": "Azure subscription ID"
},
"ApiVersion": {
"name": "api-version",
"in": "query",
"required": true,
"type": "string",
"enum": ["2018-06-01"],
"description": "API version for the operation"
},
"PricingName": {
"name": "pricingName",
"in": "path",
"required": true,
"type": "string",
"description": "name of the pricing configuration",
"x-ms-parameter-location": "method"
},
"Pricing": {
"name": "pricing",
"in": "body",
"required": true,
"description": "Pricing object",
"schema": {
"$ref": "#/definitions/Pricing"
},
"x-ms-parameter-location": "method"
}
}
}