From 5d73592abfb03654245b53641285bcf730d0c807 Mon Sep 17 00:00:00 2001 From: eswatad <51605025+eswatad@users.noreply.github.com> Date: Wed, 5 Jan 2022 09:00:23 +0200 Subject: [PATCH] [DO NOT MERGE ] Introduce new scanners resource type (#17107) * introduce new scanners resource type * fix error * fixing errors * fixing errors * fix error * fixing errors * fixing comments * adding new tag --- .../Scanners/DeleteScanner_example.json | 12 + .../examples/Scanners/GetScanner_example.json | 27 ++ .../ListBySubscriptionScanners_example.json | 44 +++ .../Scanners/ListScanners_example.json | 45 +++ .../examples/Scanners/PutScanner_example.json | 28 ++ .../preview/2021-12-01-preview/scanners.json | 302 ++++++++++++++++++ .../security/resource-manager/readme.md | 16 + 7 files changed, 474 insertions(+) create mode 100644 specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/DeleteScanner_example.json create mode 100644 specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/GetScanner_example.json create mode 100644 specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/ListBySubscriptionScanners_example.json create mode 100644 specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/ListScanners_example.json create mode 100644 specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/PutScanner_example.json create mode 100644 specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/scanners.json diff --git a/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/DeleteScanner_example.json b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/DeleteScanner_example.json new file mode 100644 index 000000000000..348ef6f73b34 --- /dev/null +++ b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/DeleteScanner_example.json @@ -0,0 +1,12 @@ +{ + "parameters": { + "api-version": "2021-12-01-preview", + "subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "resourceGroupName": "myResourceGroup", + "scannerName": "scanner" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/GetScanner_example.json b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/GetScanner_example.json new file mode 100644 index 000000000000..84ccc7029f44 --- /dev/null +++ b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/GetScanner_example.json @@ -0,0 +1,27 @@ +{ + "parameters": { + "api-version": "2021-12-01-preview", + "subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "resourceGroupName": "myResourceGroup", + "scannerName": "scanner" + }, + "responses": { + "200": { + "body": { + "id": "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myResourceGroup/providers/Microsoft.Security/scanners/scanner", + "name": "scanner", + "type": "Microsoft.Security/scanners", + "location": "East US", + "etag": "etag value", + "systemData": { + "createdBy": "user@contoso.com", + "createdByType": "User", + "createdAt": "2021-08-31T13:47:50.328Z", + "lastModifiedBy": "user@contoso.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-31T13:47:50.328Z" + } + } + } + } +} diff --git a/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/ListBySubscriptionScanners_example.json b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/ListBySubscriptionScanners_example.json new file mode 100644 index 000000000000..1b1ef6f5bf59 --- /dev/null +++ b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/ListBySubscriptionScanners_example.json @@ -0,0 +1,44 @@ +{ + "parameters": { + "api-version": "2021-12-01-preview", + "subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myResourceGroup/providers/Microsoft.Security/scanners/scanner1", + "name": "1f3afdf9-d0c9-4c3d-847f-89da613e70a8", + "type": "Microsoft.Security/scanners", + "location": "East US", + "etag": "etag value", + "systemData": { + "createdBy": "user@contoso.com", + "createdByType": "User", + "createdAt": "2021-08-31T13:47:50.328Z", + "lastModifiedBy": "user@contoso.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-31T13:47:50.328Z" + } + }, + { + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myResourceGroup/providers/Microsoft.Security/scanners/155afdf9-d239-4a5c-847f-89da613e7143", + "name": "155afdf9-d239-4a5c-847f-89da613e7143", + "type": "Microsoft.Security/scanners", + "location": "East US", + "etag": "etag value", + "systemData": { + "createdBy": "user@contoso.com", + "createdByType": "User", + "createdAt": "2021-08-31T13:47:50.328Z", + "lastModifiedBy": "user@contoso.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-31T13:47:50.328Z" + } + } + ] + } + } + } +} diff --git a/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/ListScanners_example.json b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/ListScanners_example.json new file mode 100644 index 000000000000..9317dca68617 --- /dev/null +++ b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/ListScanners_example.json @@ -0,0 +1,45 @@ +{ + "parameters": { + "api-version": "2021-12-01-preview", + "subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "resourceGroupName": "myResourceGroup" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myResourceGroup/providers/Microsoft.Security/scanners/scanner1", + "name": "scanner1", + "type": "Microsoft.Security/scanners", + "location": "East US", + "etag": "etag value", + "systemData": { + "createdBy": "user@contoso.com", + "createdByType": "User", + "createdAt": "2021-08-31T13:47:50.328Z", + "lastModifiedBy": "user@contoso.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-31T13:47:50.328Z" + } + }, + { + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myResourceGroup/providers/Microsoft.Security/scanners/scanner2", + "name": "scanner2", + "type": "Microsoft.Security/scanners", + "location": "East US", + "etag": "etag value", + "systemData": { + "createdBy": "user@contoso.com", + "createdByType": "User", + "createdAt": "2021-08-31T13:47:50.328Z", + "lastModifiedBy": "user@contoso.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-31T13:47:50.328Z" + } + } + ] + } + } + } +} diff --git a/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/PutScanner_example.json b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/PutScanner_example.json new file mode 100644 index 000000000000..e9be864aae15 --- /dev/null +++ b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/examples/Scanners/PutScanner_example.json @@ -0,0 +1,28 @@ +{ + "parameters": { + "api-version": "2021-12-01-preview", + "subscriptionId": "20ff7fc3-e762-44dd-bd96-b71116dcdc23", + "resourceGroupName": "myResourceGroup", + "scannerName": "scanner", + "scanner": {} + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myResourceGroup/provider/Microsoft.Security/scanners/scanner", + "name": "scanner", + "type": "Microsoft.Security/scanners", + "location": "East US", + "etag": "etag value", + "systemData": { + "createdBy": "user@contoso.com", + "createdByType": "User", + "createdAt": "2021-08-31T13:47:50.328Z", + "lastModifiedBy": "user@contoso.com", + "lastModifiedByType": "User", + "lastModifiedAt": "2021-08-31T13:47:50.328Z" + } + } + } + } +} diff --git a/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/scanners.json b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/scanners.json new file mode 100644 index 000000000000..85438ae6187f --- /dev/null +++ b/specification/security/resource-manager/Microsoft.Security/preview/2021-12-01-preview/scanners.json @@ -0,0 +1,302 @@ +{ + "swagger": "2.0", + "info": { + "title": "Security Center", + "description": "API spec for Microsoft.Security (Azure Security Center) resource provider", + "version": "2021-12-01-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}/providers/Microsoft.Security/scanners": { + "get": { + "x-ms-examples": { + "List security scanners by subscription level scope": { + "$ref": "./examples/Scanners/ListBySubscriptionScanners_example.json" + } + }, + "tags": [ + "Scanners" + ], + "description": "Get a list of all relevant security Scanners over a subscription level scope.", + "operationId": "Scanners_ListBySubscription", + "parameters": [ + { + "$ref": "../../../common/v1/types.json#/parameters/ApiVersion" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/SubscriptionId" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ScannersList" + } + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "../../../common/v1/types.json#/definitions/CloudError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/scanners": { + "get": { + "x-ms-examples": { + "List security scanners": { + "$ref": "./examples/Scanners/ListScanners_example.json" + } + }, + "tags": [ + "Scanners" + ], + "description": "Get security scanners on all your resources inside a scope", + "operationId": "Scanners_List", + "parameters": [ + { + "$ref": "../../../common/v1/types.json#/parameters/ApiVersion" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/SubscriptionId" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/ResourceGroupName" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ScannersList" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../common/v1/types.json#/definitions/CloudError" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/scanners/{scannerName}": { + "get": { + "x-ms-examples": { + "Get a specific security scanner by scope and scannerName": { + "$ref": "./examples/Scanners/GetScanner_example.json" + } + }, + "tags": [ + "Scanners" + ], + "description": "Get a specific security scanner for the requested scope", + "operationId": "Scanners_Get", + "parameters": [ + { + "$ref": "../../../common/v1/types.json#/parameters/ApiVersion" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/SubscriptionId" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/ScannerName" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Scanner" + } + }, + "default": { + "description": "Error response describing why the operation failed", + "schema": { + "$ref": "../../../common/v1/types.json#/definitions/CloudError" + } + } + } + }, + "put": { + "x-ms-examples": { + "Create a security scanner on a specified scope": { + "$ref": "./examples/Scanners/PutScanner_example.json" + } + }, + "tags": [ + "Scanners" + ], + "description": "Create a security scanner on the given scope.", + "operationId": "Scanners_CreateOrUpdate", + "parameters": [ + { + "$ref": "../../../common/v1/types.json#/parameters/ApiVersion" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/SubscriptionId" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/ScannerName" + }, + { + "$ref": "#/parameters/ScannerBody" + } + ], + "responses": { + "200": { + "description": "Successful request to put scanner.", + "schema": { + "$ref": "#/definitions/Scanner" + } + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../common/v1/types.json#/definitions/CloudError" + } + } + } + }, + "delete": { + "x-ms-examples": { + "Delete a security scanner": { + "$ref": "./examples/Scanners/DeleteScanner_example.json" + } + }, + "tags": [ + "Scanners" + ], + "description": "Delete a security Scanners.", + "operationId": "Scanners_Delete", + "parameters": [ + { + "$ref": "../../../common/v1/types.json#/parameters/ApiVersion" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/SubscriptionId" + }, + { + "$ref": "../../../common/v1/types.json#/parameters/ResourceGroupName" + }, + { + "$ref": "#/parameters/ScannerName" + } + ], + "responses": { + "200": { + "description": "OK - Scanner was deleted" + }, + "204": { + "description": "No Content - Scanner does not exist" + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "../../../common/v1/types.json#/definitions/CloudError" + } + } + } + } + } + }, + "definitions": { + "ScannersList": { + "type": "object", + "description": "Page of a Scanners list", + "properties": { + "value": { + "description": "Collection of Scanners in this page", + "readOnly": true, + "type": "array", + "items": { + "$ref": "#/definitions/Scanner" + } + }, + "nextLink": { + "readOnly": true, + "type": "string", + "description": "The URI to fetch the next page" + } + } + }, + "Scanner": { + "type": "object", + "description": "Security Scanner resource", + "properties": { + "systemData": { + "readOnly": true, + "type": "object", + "description": "Azure Resource Manager metadata containing createdBy and modifiedBy information.", + "$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/systemData" + } + }, + "allOf": [ + { + "$ref": "../../../common/v1/types.json#/definitions/TrackedResource" + } + ] + } + }, + "parameters": { + "ScannerName": { + "name": "scannerName", + "in": "path", + "required": true, + "type": "string", + "description": "Security scanner name", + "x-ms-parameter-location": "method" + }, + "ScannerBody": { + "name": "scanner", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Scanner" + }, + "description": "security scanner", + "x-ms-parameter-location": "method" + } + } +} diff --git a/specification/security/resource-manager/readme.md b/specification/security/resource-manager/readme.md index abd1373a9744..4eaebdea41e0 100644 --- a/specification/security/resource-manager/readme.md +++ b/specification/security/resource-manager/readme.md @@ -56,6 +56,10 @@ directive: where: $.paths from: standards.json reason: Suppression of OperationsAPI as it doesn't apply to this specific file. + - suppress: OperationsAPIImplementation + where: $.paths + from: scanners.json + reason: Suppression of OperationsAPI as it doesn't apply to this specific file. ``` ### Basic Information @@ -86,6 +90,18 @@ override-info: title: SecurityCenter ``` +### Tag: package-preview-2021-12 + +These settings apply only when `--tag=package-preview-2021-12` is specified on the command line. + +``` yaml $(tag) == 'package-preview-2021-12' +input-file: + - Microsoft.Security/preview/2021-12-01-preview/scanners.json + +override-info: + title: SecurityCenter +``` + ### Tag: package-composite-v1 These settings apply only when `--tag=package-composite-v1` is specified on the command line.