Skip to content

Commit

Permalink
Added SecurityAlert List API
Browse files Browse the repository at this point in the history
Added List api to:
Manged Server + Managed Database
Logical Server + Logical Database
  • Loading branch information
t-robalt committed Jan 20, 2019
1 parent aa18874 commit 0927a35
Show file tree
Hide file tree
Showing 8 changed files with 738 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,59 @@
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies": {
"get": {
"tags": [
"ManagedDatabaseSecurityAlertPolicies"
],
"description": "Gets a list of managed database's security alert policies.",
"operationId": "ManagedDatabaseSecurityAlertPolicies_ListByDatabase",
"parameters": [
{
"$ref": "#/parameters/ResourceGroupParameter"
},
{
"name": "managedInstanceName",
"in": "path",
"description": "The name of the managed instance.",
"required": true,
"type": "string"
},
{
"name": "databaseName",
"in": "path",
"description": "The name of the managed database for which the security alert policies are defined.",
"required": true,
"type": "string"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "Successfully retrieved the managed database security alert policies.",
"schema": {
"$ref": "#/definitions/ManagedDatabaseSecurityAlertPolicyListResult"
}
},
"default": {
"description": "*** Error Responses: ***\n\n * 400 SecurityAlertPoliciesInvalidStorageAccountName - The provided storage account is not valid or does not exist.\n\n * 400 SecurityAlertPoliciesInvalidStorageAccountCredentials - The provided storage account access key is not valid.\n\n * 400 InvalidServerSecurityAlertPolicyCreateRequest - The create server Threat Detection security alert policy request does not exist or has no properties object.\n\n * 400 DataSecurityInvalidUserSuppliedParameter - An invalid parameter value was provided by the client.\n\n * 400 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 400 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 404 SubscriptionDoesNotHaveServer - The requested server was not found\n\n * 404 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 409 ServerSecurityAlertPolicyInProgress - Set server security alert policy is already in progress\n\n * 409 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 500 DatabaseIsUnavailable - Loading failed. Please try again later.\n\n * 500 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 500 GetServerSecurityAlertPolicyFailed - Failed to get Threat Detection settings"
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
},
"x-ms-examples": {
"Get a list of the database's threat detection policies.": {
"$ref": "./examples/ManagedDatabaseSecurityAlertListByDatabase.json"
}
}
}
}
},
"definitions": {
Expand All @@ -170,7 +223,7 @@
"type": "object",
"properties": {
"state": {
"description": "Specifies the state of the policy, whether it is enabled or disabled.",
"description": "Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database.",
"enum": [
"New",
"Enabled",
Expand Down Expand Up @@ -236,6 +289,25 @@
"x-ms-client-flatten": true
}
}
},
"ManagedDatabaseSecurityAlertPolicyListResult": {
"description": "A list of the managed database's security alert policies.",
"type": "object",
"properties": {
"value": {
"description": "Array of results.",
"type": "array",
"items": {
"$ref": "#/definitions/ManagedDatabaseSecurityAlertPolicy"
},
"readOnly": true
},
"nextLink": {
"description": "Link to retrieve next page of results.",
"type": "string",
"readOnly": true
}
}
}
},
"parameters": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,48 @@
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies": {
"get": {
"tags": [
"ManagedServerSecurityAlertPolicies"
],
"description": "Get the managed server's threat detection policies.",
"operationId": "ManagedServerSecurityAlertPolicies_ListByInstance",
"parameters": [
{
"$ref": "#/parameters/ResourceGroupParameter"
},
{
"$ref": "#/parameters/ManagedInstanceNameParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "Successfully retrieved the managed server threat detection policies.",
"schema": {
"$ref": "#/definitions/ManagedServerSecurityAlertPolicyListResult"
}
},
"default": {
"description": "*** Error Responses: ***\n\n * 400 SecurityAlertPoliciesInvalidStorageAccountName - The provided storage account is not valid or does not exist.\n\n * 400 SecurityAlertPoliciesInvalidStorageAccountCredentials - The provided storage account access key is not valid.\n\n * 400 InvalidServerSecurityAlertPolicyCreateRequest - The create server Threat Detection security alert policy request does not exist or has no properties object.\n\n * 400 DataSecurityInvalidUserSuppliedParameter - An invalid parameter value was provided by the client.\n\n * 400 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 400 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 404 SubscriptionDoesNotHaveServer - The requested server was not found\n\n * 404 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 409 ServerSecurityAlertPolicyInProgress - Set server security alert policy is already in progress\n\n * 409 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 500 DatabaseIsUnavailable - Loading failed. Please try again later.\n\n * 500 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 500 GetServerSecurityAlertPolicyFailed - Failed to get Threat Detection settings"
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
},
"x-ms-examples": {
"Get the managed server's threat detection policies": {
"$ref": "./examples/ManagedServerSecurityAlertListByInstance.json"
}
}
}
}
},
"definitions": {
Expand All @@ -146,7 +188,7 @@
"type": "object",
"properties": {
"state": {
"description": "Specifies the state of the policy, whether it is enabled or disabled.",
"description": "Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database.",
"enum": [
"New",
"Enabled",
Expand Down Expand Up @@ -212,6 +254,25 @@
"x-ms-client-flatten": true
}
}
},
"ManagedServerSecurityAlertPolicyListResult": {
"description": "A list of the managed Server's security alert policies.",
"type": "object",
"properties": {
"value": {
"description": "Array of results.",
"type": "array",
"items": {
"$ref": "#/definitions/ManagedServerSecurityAlertPolicy"
},
"readOnly": true
},
"nextLink": {
"description": "Link to retrieve next page of results.",
"type": "string",
"readOnly": true
}
}
}
},
"parameters": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"parameters": {
"subscriptionId": "00000000-1111-2222-3333-444444444444",
"resourceGroupName": "securityalert-6852",
"managedInstanceName": "securityalert-2080",
"databaseName": "testdb",
"api-version": "2017-03-01=preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-6852/providers/Microsoft.Sql/managedInstances/securityalert-2080/databases/testdb",
"name": "default",
"type": "Microsoft.Sql/managedInstances/databases/securityAlertPolicies",
"location": "Japan East",
"kind": "V12",
"properties": {
"state": "Enabled",
"emailAccountAdmins": "true",
"emailAddresses": ["test@microsoft.com","user@microsoft.com"],
"disabledAlerts": ["Usage_Anomaly"],
"retentionDays": 0,
"storageAccountAccessKey": "",
"storageEndpoint": ""
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"parameters": {
"subscriptionId": "00000000-1111-2222-3333-444444444444",
"resourceGroupName": "securityalert-4799",
"managedInstanceName": "securityalert-6440",
"api-version": "2017-03-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/managedInstances/securityalert-6440",
"name": "Default",
"type": "Microsoft.Sql/managedInstances/securityAlertPolicies",
"properties": {
"state": "Disabled",
"emailAccountAdmins": true,
"emailAddresses": [ "test@microsoft.com;user@microsoft.com" ],
"disabledAlerts": ["Access_Anomaly"],
"retentionDays": 0,
"storageAccountAccessKey": "",
"storageEndpoint": ""
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"parameters": {
"subscriptionId": "00000000-1111-2222-3333-444444444444",
"resourceGroupName": "securityalert-4799",
"serverName": "securityalert-6440",
"api-version": "2017-03-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.Sql/servers/securityalert-6440/securityAlertPolicies",
"name": "Default",
"type": "Microsoft.Sql/servers/securityAlertPolicies",
"properties": {
"state": "Disabled",
"emailAccountAdmins": true,
"emailAddresses": [ "test@microsoft.com;user@microsoft.com" ],
"disabledAlerts": ["Access_Anomaly"],
"retentionDays": 0,
"storageAccountAccessKey": "",
"storageEndpoint": "https://mystorage.blob.core.windows.net"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,48 @@
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/securityAlertPolicies": {
"get": {
"tags": [
"ServerSecurityAlertPolicies"
],
"description": "Get the server's threat detection policies.",
"operationId": "ServerSecurityAlertPolicies_ListByServer",
"parameters": [
{
"$ref": "#/parameters/ResourceGroupParameter"
},
{
"$ref": "#/parameters/ServerNameParameter"
},
{
"$ref": "#/parameters/SubscriptionIdParameter"
},
{
"$ref": "#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
"description": "Successfully retrieved the server threat detection policies.",
"schema": {
"$ref": "#/definitions/LogicalServerSecurityAlertPolicyListResult"
}
},
"default": {
"description": "*** Error Responses: ***\n\n * 400 SecurityAlertPoliciesInvalidStorageAccountName - The provided storage account is not valid or does not exist.\n\n * 400 SecurityAlertPoliciesInvalidStorageAccountCredentials - The provided storage account access key is not valid.\n\n * 400 InvalidServerSecurityAlertPolicyCreateRequest - The create server Threat Detection security alert policy request does not exist or has no properties object.\n\n * 400 DataSecurityInvalidUserSuppliedParameter - An invalid parameter value was provided by the client.\n\n * 400 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 400 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 404 SubscriptionDoesNotHaveServer - The requested server was not found\n\n * 404 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 409 ServerSecurityAlertPolicyInProgress - Set server security alert policy is already in progress\n\n * 409 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 500 DatabaseIsUnavailable - Loading failed. Please try again later.\n\n * 500 UpsertServerSecurityAlertPolicyFailed - An error has occurred while saving Threat detection settings, please try again later\n\n * 500 GetServerSecurityAlertPolicyFailed - Failed to get Threat Detection settings"
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
},
"x-ms-examples": {
"List the server's threat detection policies": {
"$ref": "./examples/ServerSecurityAlertsListByServer.json"
}
}
}
}
},
"definitions": {
Expand All @@ -146,7 +188,7 @@
"type": "object",
"properties": {
"state": {
"description": "Specifies the state of the policy, whether it is enabled or disabled.",
"description": "Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific database.",
"enum": [
"New",
"Enabled",
Expand Down Expand Up @@ -188,6 +230,12 @@
"format": "int32",
"description": "Specifies the number of days to keep in the Threat Detection audit logs.",
"type": "integer"
},
"creationTime": {
"format": "date-time",
"description": "Specifies the UTC creation time of the policy.",
"type": "string",
"readOnly": true
}
}
},
Expand All @@ -206,6 +254,25 @@
"x-ms-client-flatten": true
}
}
},
"LogicalServerSecurityAlertPolicyListResult": {
"description": "A list of the server's security alert policies.",
"type": "object",
"properties": {
"value": {
"description": "Array of results.",
"type": "array",
"items": {
"$ref": "#/definitions/ServerSecurityAlertPolicy"
},
"readOnly": true
},
"nextLink": {
"description": "Link to retrieve next page of results.",
"type": "string",
"readOnly": true
}
}
}
},
"parameters": {
Expand Down
Loading

0 comments on commit 0927a35

Please sign in to comment.