Skip to content

Commit

Permalink
[Microsoft.Security] Migrate APIs from Microsoft.ApiSecurity RP (curr…
Browse files Browse the repository at this point in the history
…ently in private preview) to Microsoft.Security RP (#21519)

* Adds base for updating Microsoft.Security from version stable/2021-06-01 to version 2022-11-20-preview

* Updates readme

* Updates API version in new specs and examples

* Add apiCollections.json and relevant examples

* Update readme.md

* Fix validation errors

* Fix validation errors

* One more fix

* Switch to full paths

* More validation fixes

* Try and fix the SDK errors

* Fix avocado error

* Remove operations.json from tag = package-preview-2022-11 based on PR comments
  • Loading branch information
aditdalvi authored Nov 15, 2022
1 parent 3b414eb commit 38995ae
Show file tree
Hide file tree
Showing 7 changed files with 399 additions and 1 deletion.
1 change: 1 addition & 0 deletions custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,7 @@ ODBC
oeverify
offboard
offboards
offboarding
officedocument
OLTP
OIDC
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
{
"swagger": "2.0",
"info": {
"title": "Microsoft Defender for Cloud",
"description": "API spec for Microsoft.Security (Microsoft Defender for Cloud) resource provider",
"version": "2022-11-20-preview"
},
"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}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections": {
"get": {
"x-ms-examples": {
"Gets a list of Azure API Management APIs that have been onboarded to Defender for APIs": {
"$ref": "./examples/ApiCollections/APICollection_List_example.json"
}
},
"tags": [
"D4APICollectionList",
"APIMConfig"
],
"description": "Gets a list of Azure API Management APIs that have been onboarded to Defender for APIs. If an Azure API Management API is onboarded to Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected.",
"summary": "Gets a list of Azure API Management APIs that have been onboarded to Defender for APIs",
"operationId": "APICollection_List",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/ApiManagementServiceNameParameter"
},
{
"$ref": "../../../common/v1/types.json#/parameters/ApiVersion"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ApiCollectionResponseList"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiCollectionId}": {
"get": {
"x-ms-examples": {
"Gets an Azure API Management API if it has been onboarded to Defender for APIs": {
"$ref": "./examples/ApiCollections/APICollection_Get_example.json"
}
},
"tags": [
"D4APICollection",
"APIMConfig"
],
"description": "Gets an Azure API Management API if it has been onboarded to Defender for APIs. If an Azure API Management API is onboarded to Defender for APIs, the system will monitor the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected.",
"summary": "Gets an Azure API Management API if it has been onboarded to Defender for APIs",
"operationId": "APICollection_Get",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/ApiManagementServiceNameParameter"
},
{
"$ref": "#/parameters/ApiCollectionIdParameter"
},
{
"$ref": "../../../common/v1/types.json#/parameters/ApiVersion"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ApiCollectionResponse"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse"
}
}
}
},
"put": {
"x-ms-examples": {
"Onboard an Azure API Management API to Defender for APIs": {
"$ref": "./examples/ApiCollections/APICollectionOnboarding_Create_example.json"
}
},
"tags": [
"OnboardToD4API",
"APIMConfig"
],
"description": "Onboard an Azure API Management API to Defender for APIs. The system will start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected.",
"summary": "Onboard an Azure API Management API to Defender for APIs",
"operationId": "APICollectionOnboarding_Create",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/ApiManagementServiceNameParameter"
},
{
"$ref": "#/parameters/ApiCollectionIdParameter"
},
{
"$ref": "../../../common/v1/types.json#/parameters/ApiVersion"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ApiCollectionResponse"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse"
}
}
}
},
"delete": {
"x-ms-examples": {
"Delete a security recommendation task on a resource": {
"$ref": "./examples/ApiCollections/APICollectionOffboarding_Delete_example.json"
}
},
"tags": [
"OffboardFromD4API",
"APIMConfig"
],
"description": "Offboard an Azure API Management API from Defender for APIs. The system will stop monitoring the operations within the Azure API Management API for intrusive behaviors.",
"summary": "Offboard an Azure API Management API from Defender for APIs",
"operationId": "APICollectionOffboarding_Delete",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "#/parameters/ApiManagementServiceNameParameter"
},
{
"$ref": "#/parameters/ApiCollectionIdParameter"
},
{
"$ref": "../../../common/v1/types.json#/parameters/ApiVersion"
}
],
"responses": {
"200": {
"description": "OK"
},
"204": {
"description": "NoContent"
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse"
}
}
}
}
}
},
"definitions": {
"ApiCollectionResponseList": {
"type": "object",
"description": "Page of a list of API collections as represented by Defender for APIs.",
"properties": {
"value": {
"description": "API collections in this page.",
"readOnly": true,
"type": "array",
"items": {
"$ref": "#/definitions/ApiCollectionResponse"
}
},
"nextLink": {
"readOnly": true,
"type": "string",
"description": "The URI to fetch the next page."
}
}
},
"ApiCollectionResponse": {
"type": "object",
"description": "An API collection as represented by Defender for APIs.",
"properties": {
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/ApiCollectionProperties"
}
},
"allOf": [
{
"$ref": "../../../common/v1/types.json#/definitions/Resource"
}
]
},
"ApiCollectionProperties": {
"type": "object",
"description": "Describes the properties of an API collection.",
"properties": {
"displayName": {
"type": "string",
"description": "The display name of the Azure API Management API."
},
"additionalData": {
"type": "object",
"description": "Additional data regarding the API collection.",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"parameters": {
"ApiManagementServiceNameParameter": {
"name": "serviceName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the API Management service.",
"minLength": 1,
"maxLength": 50,
"pattern": "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$",
"x-ms-parameter-location": "method"
},
"ApiCollectionIdParameter": {
"name": "apiCollectionId",
"in": "path",
"required": true,
"type": "string",
"description": "A string representing the apiCollections resource within the Microsoft.Security provider namespace. This string matches the Azure API Management API name.",
"minLength": 1,
"maxLength": 256,
"x-ms-parameter-location": "method"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parameters": {
"subscriptionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"resourceGroupName": "rg1",
"serviceName": "apimService1",
"apiCollectionId": "echo-api",
"api-version": "2022-11-20-preview"
},
"responses": {
"200": {},
"204": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"parameters": {
"subscriptionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"resourceGroupName": "rg1",
"serviceName": "apimService1",
"apiCollectionId": "echo-api",
"api-version": "2022-11-20-preview"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/providers/Microsoft.Security/apiCollections/echo-api",
"name": "echo-api",
"type": "Microsoft.Security/apiCollections",
"properties": {
"displayName": "echo-api",
"additionalData": {
"apiManagementApiId": "/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"parameters": {
"subscriptionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"resourceGroupName": "rg1",
"serviceName": "apimService1",
"apiCollectionId": "echo-api",
"api-version": "2022-11-20-preview"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/providers/Microsoft.Security/apiCollections/echo-api",
"name": "echo-api",
"type": "Microsoft.Security/apiCollections",
"properties": {
"displayName": "echo-api",
"additionalData": {
"apiManagementApiId": "/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"parameters": {
"subscriptionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"resourceGroupName": "rg1",
"serviceName": "apimService1",
"api-version": "2022-11-20-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/providers/Microsoft.Security/apiCollections/echo-api",
"name": "echo-api",
"type": "Microsoft.Security/apiCollections",
"properties": {
"displayName": "echo-api",
"additionalData": {
"apiManagementApiId": "/subscriptions/3fa85f64-5717-4562-b3fc-2c963f66afa6/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"
}
}
}
]
}
}
}
}
Loading

0 comments on commit 38995ae

Please sign in to comment.