Skip to content

Commit

Permalink
Add Swagger for Defender for Storage new on-demand malware scan API (A…
Browse files Browse the repository at this point in the history
…zure#30786)

* Copy files from preview/2022-12-01-preview

Copied the files in a separate commit.
This allows reviewers to easily diff subsequent changes against the previous spec.

* Update version to preview/2024-10-01-preview

Updated the API version from preview/2022-12-01-preview to preview/2024-10-01-preview.

* Added tag for 2024-10-01-preview in readme file

* Add Swagger for Defender for Storage new on-demand malware scan API

* Update api-version in examples

* Run prettier on swagger files

* Fix defintions

* Fix BlobsScanSummary definition

* Remove scanRequestTime (will be removed from API)

* Camel casing

* Add get to malwareScanStatus operation name

* Remove extra underscore from operation ids

* Fix MalwareScanStatus top level properties

* Fix examples to match properties

* Extract MalwareScanStatusProperties

* Remove resource reference

* Remove scanId from Cancel and remove get from ScanStatus path

* Change the API structure to include a collection of scans

* Add 'malware' to cancel operation name

* Copy operations API to new api version

* Add opeations example

* Limit example size

* run prettier

* Move example to correct folder

* modify example

* Add opeartions file to readme

* Use common types for operation results
  • Loading branch information
akrabi authored Oct 28, 2024
1 parent 1ceae65 commit 697d0fc
Show file tree
Hide file tree
Showing 9 changed files with 780 additions and 1 deletion.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"parameters": {
"api-version": "2024-10-01-preview",
"resourceId": "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount",
"settingName": "current",
"scanId": "latest"
},
"responses": {
"200": {
"body": {
"properties": {
"scanId": "3fd3c1be-dbff-4d6e-985f-43f9ec1b1146",
"scanStatus": "Canceling",
"scanStatusMessage": "The scan request is being canceled upon user request"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"parameters": {
"api-version": "2024-10-01-preview",
"resourceId": "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount",
"settingName": "current"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/defenderForStorageSettings/current",
"name": "current",
"type": "Microsoft.Security/defenderForStorageSettings",
"properties": {
"isEnabled": true,
"malwareScanning": {
"onUpload": {
"isEnabled": true,
"capGBPerMonth": -1
},
"scanResultsEventGridTopicResourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic"
},
"sensitiveDataDiscovery": {
"isEnabled": false
},
"overrideSubscriptionLevelSettings": true
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"parameters": {
"api-version": "2024-10-01-preview",
"resourceId": "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount",
"settingName": "current",
"scanId": "latest"
},
"responses": {
"200": {
"body": {
"properties": {
"scanId": "0ce362c5-87a5-4030-ba6a-109566cd7b3d",
"scanStatus": "Completed",
"scanStartTime": "2024-09-12T12:20:14.6364816Z",
"scanEndTime": "2024-09-12T12:21:17.5648386Z",
"scanSummary": {
"blobs": {
"totalBlobsScanned": 40,
"maliciousBlobsCount": 10,
"skippedBlobsCount": 0,
"scannedBlobsInGB": 0.019550956785678864
},
"estimatedScanCostUSD": 0.0029326435178518295
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"parameters": {
"api-version": "2024-10-01-preview",
"resourceId": "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount",
"settingName": "current",
"defenderForStorageSetting": {
"properties": {
"isEnabled": true,
"malwareScanning": {
"onUpload": {
"isEnabled": true,
"capGBPerMonth": -1
},
"scanResultsEventGridTopicResourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic"
},
"sensitiveDataDiscovery": {
"isEnabled": true
},
"overrideSubscriptionLevelSettings": true
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/defenderForStorageSettings/current",
"type": "Microsoft.Security/defenderForStorageSettings",
"name": "current",
"properties": {
"isEnabled": true,
"malwareScanning": {
"onUpload": {
"isEnabled": true,
"capGBPerMonth": -1
},
"scanResultsEventGridTopicResourceId": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.EventGrid/topics/sampletopic",
"operationStatus": {
"code": "Succeeded"
}
},
"sensitiveDataDiscovery": {
"isEnabled": true,
"operationStatus": {
"code": "Succeeded"
}
},
"overrideSubscriptionLevelSettings": true
}
}
},
"201": {
"body": {
"id": "/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/defenderForStorageSettings/current",
"type": "Microsoft.Security/defenderForStorageSettings",
"name": "current",
"properties": {
"isEnabled": true,
"malwareScanning": {
"onUpload": {
"isEnabled": false,
"capGBPerMonth": -1
},
"operationStatus": {
"code": "UnknownError",
"message": "Failed to setup data scanner."
}
},
"sensitiveDataDiscovery": {
"isEnabled": false,
"operationStatus": {
"code": "UnknownError",
"message": "Failed to setup data scanner."
}
},
"overrideSubscriptionLevelSettings": true
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"parameters": {
"api-version": "2024-10-01-preview",
"resourceId": "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount",
"settingName": "current"
},
"responses": {
"200": {
"body": {
"properties": {
"scanId": "fc831479-412f-4bc2-8333-a8edda751a80",
"scanStatus": "Queued",
"scanStatusMessage": "The scan request has been queued for scanning"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"parameters": {
"api-version": "2024-10-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"name": "Microsoft.Security/defenderforstoragesettings/read",
"display": {
"provider": "Microsoft Security",
"resource": "DefenderForStorageSettings",
"operation": "Get defenderForStorageSettings",
"description": "Gets the defenderforstoragesettings for the scope"
},
"origin": "user"
},
{
"name": "Microsoft.Security/defenderforstoragesettings/write",
"display": {
"provider": "Microsoft Security",
"resource": "DefenderForStorageSettings",
"operation": "Update defenderForStorageSettings",
"description": "Creates or updates the defenderforstoragesettings for the scope"
},
"origin": "user"
},
{
"name": "Microsoft.Security/defenderforstoragesettings/delete",
"display": {
"provider": "Microsoft Security",
"resource": "DefenderForStorageSettings",
"operation": "Delete defenderForStorageSettings",
"description": "Deletes the defenderforstoragesettings for the scope"
},
"origin": "user"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"swagger": "2.0",
"info": {
"title": "Microsoft Defender for Cloud",
"description": "API spec for Microsoft.Security (Microsoft Defender for Cloud) resource provider",
"version": "2024-10-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": {
"/providers/Microsoft.Security/operations": {
"get": {
"x-ms-examples": {
"List the operations for the Microsoft.Security (Microsoft Defender for Cloud) resource provider": {
"$ref": "./examples/Operations/ListOperations_example.json"
}
},
"tags": [
"Operations"
],
"description": "Exposes all available operations for discovery purposes.",
"operationId": "Operations_List",
"parameters": [
{
"$ref": "../../../../../common-types/resource-management/v6/types.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "../../../../../common-types/resource-management/v6/types.json#/definitions/OperationListResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "../../../../../common-types/resource-management/v6/types.json#/definitions/ErrorResponse"
}
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
}
}
}
12 changes: 11 additions & 1 deletion specification/security/resource-manager/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,23 @@ These are the global settings for the Security API.
title: SecurityCenter
description: API spec for Microsoft.Security (Azure Security Center) resource provider
openapi-type: arm
tag: package-composite-v3
tag: package-preview-2024-10
```
### Composite packages
The following packages may be composed from multiple api-versions.
### Tag: package-preview-2024-10
These settings apply only when `--tag=package-preview-2024-10` is specified on the command line.

```yaml $(tag) == 'package-preview-2024-10'
input-file:
- Microsoft.Security/preview/2024-10-01-preview/defenderForStorageSettings.json
- Microsoft.Security/preview/2024-10-01-preview/operations.json
```

### Tag: package-2024-08

These settings apply only when `--tag=package-2024-08` is specified on the command line.
Expand Down

0 comments on commit 697d0fc

Please sign in to comment.