Skip to content
Merged
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
Expand Up @@ -51,7 +51,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
public SqlManagementClient Client { get; private set; }

/// <summary>
/// Gets a vulnerability assessment scan record of a database.
/// Lists the vulnerability assessment scans of a database.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
Expand All @@ -63,9 +63,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='scanId'>
/// The vulnerability assessment scan Id of the scan to retrieve.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
Expand All @@ -87,7 +84,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<VulnerabilityAssessmentScanRecord>> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<IPage<VulnerabilityAssessmentScanRecord>>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
Expand All @@ -101,10 +98,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
if (scanId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "scanId");
}
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
Expand All @@ -122,19 +115,17 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName);
tracingParameters.Add("scanId", scanId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}").ToString();
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
_url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
_url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName));
_url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
Expand Down Expand Up @@ -234,7 +225,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<VulnerabilityAssessmentScanRecord>();
var _result = new AzureOperationResponse<IPage<VulnerabilityAssessmentScanRecord>>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
Expand All @@ -247,7 +238,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<VulnerabilityAssessmentScanRecord>(_responseContent, Client.DeserializationSettings);
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page1<VulnerabilityAssessmentScanRecord>>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
Expand All @@ -267,7 +258,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
}

/// <summary>
/// Executes a Vulnerability Assessment database scan.
/// Gets a vulnerability assessment scan record of a database.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
Expand All @@ -283,32 +274,6 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
/// The vulnerability assessment scan Id of the scan to retrieve.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse> InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// Lists the vulnerability assessment scans of a database.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
Expand All @@ -329,7 +294,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async Task<AzureOperationResponse<IPage<VulnerabilityAssessmentScanRecord>>> ListByDatabaseWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
public async Task<AzureOperationResponse<VulnerabilityAssessmentScanRecord>> GetWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
Expand All @@ -343,6 +308,10 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
{
throw new ValidationException(ValidationRules.CannotBeNull, "databaseName");
}
if (scanId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "scanId");
}
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
Expand All @@ -360,17 +329,19 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
tracingParameters.Add("serverName", serverName);
tracingParameters.Add("databaseName", databaseName);
tracingParameters.Add("vulnerabilityAssessmentName", vulnerabilityAssessmentName);
tracingParameters.Add("scanId", scanId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListByDatabase", tracingParameters);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans").ToString();
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{serverName}", System.Uri.EscapeDataString(serverName));
_url = _url.Replace("{databaseName}", System.Uri.EscapeDataString(databaseName));
_url = _url.Replace("{vulnerabilityAssessmentName}", System.Uri.EscapeDataString(vulnerabilityAssessmentName));
_url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List<string> _queryParameters = new List<string>();
if (apiVersion != null)
Expand Down Expand Up @@ -470,7 +441,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
throw ex;
}
// Create Result
var _result = new AzureOperationResponse<IPage<VulnerabilityAssessmentScanRecord>>();
var _result = new AzureOperationResponse<VulnerabilityAssessmentScanRecord>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
Expand All @@ -483,7 +454,7 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page1<VulnerabilityAssessmentScanRecord>>(_responseContent, Client.DeserializationSettings);
_result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<VulnerabilityAssessmentScanRecord>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
Expand All @@ -502,6 +473,35 @@ internal DatabaseVulnerabilityAssessmentScansOperations(SqlManagementClient clie
return _result;
}

/// <summary>
/// Executes a Vulnerability Assessment database scan.
/// </summary>
/// <param name='resourceGroupName'>
/// The name of the resource group that contains the resource. You can obtain
/// this value from the Azure Resource Manager API or the portal.
/// </param>
/// <param name='serverName'>
/// The name of the server.
/// </param>
/// <param name='databaseName'>
/// The name of the database.
/// </param>
/// <param name='scanId'>
/// The vulnerability assessment scan Id of the scan to retrieve.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public async Task<AzureOperationResponse> InitiateScanWithHttpMessagesAsync(string resourceGroupName, string serverName, string databaseName, string scanId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
AzureOperationResponse _response = await BeginInitiateScanWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, scanId, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// Convert an existing scan result to a human readable format. If already
/// exists nothing happens
Expand Down
Loading