diff --git a/eng/mgmt/mgmtmetadata/security_resource-manager.txt b/eng/mgmt/mgmtmetadata/security_resource-manager.txt
index e170507f1260..0deb4e70615b 100644
--- a/eng/mgmt/mgmtmetadata/security_resource-manager.txt
+++ b/eng/mgmt/mgmtmetadata/security_resource-manager.txt
@@ -1,14 +1,14 @@
-Installing AutoRest version: v2
+Installing AutoRest version: v2
AutoRest installed successfully.
Commencing code generation
Generating CSharp code
Executing AutoRest command
-acmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/security/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\GitHub\azure-sdk-for-net\sdk
-2020-05-03 15:03:14 UTC
+cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/security/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\Rome\apiVteam\azure-sdk-for-net\sdk
+2020-11-04 11:48:54 UTC
Azure-rest-api-specs repository information
GitHub fork: Azure
Branch: master
-Commit: 4bfc60521b88d21c9cd4c44cc367e080ecc4af81
+Commit: 32b4d058d54d206bdf6b336677a3182feab7c07b
AutoRest information
Requested version: v2
Bootstrapper version: autorest@2.0.4413
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/AzSdk.RP.props b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/AzSdk.RP.props
index 62423a292098..a244123e64e6 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/AzSdk.RP.props
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/AzSdk.RP.props
@@ -1,7 +1,7 @@
- Security_2015-06-01-preview;Security_2019-01-01;Security_2019-01-01-preview;Security_2017-08-01-preview;Security_2017-08-01;Security_2019-08-01;Security_2018-06-01;
+ Security_2015-06-01-preview;Security_2019-01-01;Security_2019-01-01-preview;Security_2017-08-01-preview;Security_2017-08-01;Security_2019-08-01;Security_2018-06-01;Security_2020-01-01;
$(PackageTags);$(CommonTags);$(AzureApiTag);
\ No newline at end of file
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs
index 3938fd49d061..524870971a85 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs
@@ -51,7 +51,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
public SecurityCenterClient Client { get; private set; }
///
- /// Gets a list of application control VM/server groups for the subscription.
+ /// Gets a list of application control machine groups for the subscription.
///
///
/// Include the policy rules
@@ -80,7 +80,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> ListWithHttpMessagesAsync(bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ListWithHttpMessagesAsync(bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -217,7 +217,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -230,7 +230,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -253,7 +253,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
/// Gets an application control VM/server group.
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
///
/// Headers that will be added to request.
@@ -276,7 +276,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -414,7 +414,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -427,7 +427,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -447,10 +447,10 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
}
///
- /// Update an application control VM/server group
+ /// Update an application control machine group
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
///
///
@@ -475,7 +475,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> PutWithHttpMessagesAsync(string groupName, AppWhitelistingGroup body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> PutWithHttpMessagesAsync(string groupName, AdaptiveApplicationControlGroup body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -624,7 +624,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -637,7 +637,7 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -657,10 +657,10 @@ internal AdaptiveApplicationControlsOperations(SecurityCenterClient client)
}
///
- /// Delete an application control VM/server group
+ /// Delete an application control machine group
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
///
/// Headers that will be added to request.
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs
index 73722ded1f71..d43ddfb37085 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs
@@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Security
public static partial class AdaptiveApplicationControlsOperationsExtensions
{
///
- /// Gets a list of application control VM/server groups for the subscription.
+ /// Gets a list of application control machine groups for the subscription.
///
///
/// The operations group for this extension method.
@@ -33,13 +33,13 @@ public static partial class AdaptiveApplicationControlsOperationsExtensions
///
/// Return output in a summarized form
///
- public static AppWhitelistingGroups List(this IAdaptiveApplicationControlsOperations operations, bool? includePathRecommendations = default(bool?), bool? summary = default(bool?))
+ public static AdaptiveApplicationControlGroups List(this IAdaptiveApplicationControlsOperations operations, bool? includePathRecommendations = default(bool?), bool? summary = default(bool?))
{
return operations.ListAsync(includePathRecommendations, summary).GetAwaiter().GetResult();
}
///
- /// Gets a list of application control VM/server groups for the subscription.
+ /// Gets a list of application control machine groups for the subscription.
///
///
/// The operations group for this extension method.
@@ -53,7 +53,7 @@ public static partial class AdaptiveApplicationControlsOperationsExtensions
///
/// The cancellation token.
///
- public static async Task ListAsync(this IAdaptiveApplicationControlsOperations operations, bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ListAsync(this IAdaptiveApplicationControlsOperations operations, bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListWithHttpMessagesAsync(includePathRecommendations, summary, null, cancellationToken).ConfigureAwait(false))
{
@@ -68,9 +68,9 @@ public static partial class AdaptiveApplicationControlsOperationsExtensions
/// The operations group for this extension method.
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
- public static AppWhitelistingGroup Get(this IAdaptiveApplicationControlsOperations operations, string groupName)
+ public static AdaptiveApplicationControlGroup Get(this IAdaptiveApplicationControlsOperations operations, string groupName)
{
return operations.GetAsync(groupName).GetAwaiter().GetResult();
}
@@ -82,12 +82,12 @@ public static AppWhitelistingGroup Get(this IAdaptiveApplicationControlsOperatio
/// The operations group for this extension method.
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
///
/// The cancellation token.
///
- public static async Task GetAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetWithHttpMessagesAsync(groupName, null, cancellationToken).ConfigureAwait(false))
{
@@ -96,36 +96,36 @@ public static AppWhitelistingGroup Get(this IAdaptiveApplicationControlsOperatio
}
///
- /// Update an application control VM/server group
+ /// Update an application control machine group
///
///
/// The operations group for this extension method.
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
///
///
- public static AppWhitelistingGroup Put(this IAdaptiveApplicationControlsOperations operations, string groupName, AppWhitelistingGroup body)
+ public static AdaptiveApplicationControlGroup Put(this IAdaptiveApplicationControlsOperations operations, string groupName, AdaptiveApplicationControlGroup body)
{
return operations.PutAsync(groupName, body).GetAwaiter().GetResult();
}
///
- /// Update an application control VM/server group
+ /// Update an application control machine group
///
///
/// The operations group for this extension method.
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
///
///
///
/// The cancellation token.
///
- public static async Task PutAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, AppWhitelistingGroup body, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task PutAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, AdaptiveApplicationControlGroup body, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.PutWithHttpMessagesAsync(groupName, body, null, cancellationToken).ConfigureAwait(false))
{
@@ -134,13 +134,13 @@ public static AppWhitelistingGroup Put(this IAdaptiveApplicationControlsOperatio
}
///
- /// Delete an application control VM/server group
+ /// Delete an application control machine group
///
///
/// The operations group for this extension method.
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
public static void Delete(this IAdaptiveApplicationControlsOperations operations, string groupName)
{
@@ -148,13 +148,13 @@ public static void Delete(this IAdaptiveApplicationControlsOperations operations
}
///
- /// Delete an application control VM/server group
+ /// Delete an application control machine group
///
///
/// The operations group for this extension method.
///
///
- /// Name of an application control VM/server group
+ /// Name of an application control machine group
///
///
/// The cancellation token.
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperations.cs
index 8f1f65d9ee66..13a4681b3563 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperations.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperations.cs
@@ -101,7 +101,7 @@ internal AdvancedThreatProtectionOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{settingName}", System.Uri.EscapeDataString(settingName));
List _queryParameters = new List();
if (apiVersion != null)
@@ -294,7 +294,7 @@ internal AdvancedThreatProtectionOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{settingName}", System.Uri.EscapeDataString(settingName));
List _queryParameters = new List();
if (apiVersion != null)
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperations.cs
index c3eeac560762..2db369a32189 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperations.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperations.cs
@@ -53,15 +53,6 @@ internal AlertsOperations(SecurityCenterClient client)
///
/// List all the alerts that are associated with the subscription
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
///
/// Headers that will be added to request.
///
@@ -83,7 +74,7 @@ internal AlertsOperations(SecurityCenterClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListWithHttpMessagesAsync(string filter = default(string), string select = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -96,7 +87,7 @@ internal AlertsOperations(SecurityCenterClient client)
throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
}
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -105,9 +96,6 @@ internal AlertsOperations(SecurityCenterClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("filter", filter);
- tracingParameters.Add("select", select);
- tracingParameters.Add("expand", expand);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
@@ -120,18 +108,6 @@ internal AlertsOperations(SecurityCenterClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
- if (filter != null)
- {
- _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
- }
- if (select != null)
- {
- _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select)));
- }
- if (expand != null)
- {
- _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
- }
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -264,15 +240,6 @@ internal AlertsOperations(SecurityCenterClient client)
/// The name of the resource group within the user's subscription. The name is
/// case insensitive.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
///
/// Headers that will be added to request.
///
@@ -294,7 +261,7 @@ internal AlertsOperations(SecurityCenterClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), string select = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -326,7 +293,7 @@ internal AlertsOperations(SecurityCenterClient client)
throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -336,9 +303,6 @@ internal AlertsOperations(SecurityCenterClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("filter", filter);
- tracingParameters.Add("select", select);
- tracingParameters.Add("expand", expand);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
}
@@ -352,18 +316,6 @@ internal AlertsOperations(SecurityCenterClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
- if (filter != null)
- {
- _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
- }
- if (select != null)
- {
- _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select)));
- }
- if (expand != null)
- {
- _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
- }
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -493,15 +445,6 @@ internal AlertsOperations(SecurityCenterClient client)
/// List all the alerts that are associated with the subscription that are
/// stored in a specific location
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
///
/// Headers that will be added to request.
///
@@ -523,7 +466,7 @@ internal AlertsOperations(SecurityCenterClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListSubscriptionLevelAlertsByRegionWithHttpMessagesAsync(string filter = default(string), string select = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListSubscriptionLevelAlertsByRegionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -540,7 +483,7 @@ internal AlertsOperations(SecurityCenterClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation");
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -549,9 +492,6 @@ internal AlertsOperations(SecurityCenterClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("filter", filter);
- tracingParameters.Add("select", select);
- tracingParameters.Add("expand", expand);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListSubscriptionLevelAlertsByRegion", tracingParameters);
}
@@ -565,18 +505,6 @@ internal AlertsOperations(SecurityCenterClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
- if (filter != null)
- {
- _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
- }
- if (select != null)
- {
- _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select)));
- }
- if (expand != null)
- {
- _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
- }
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -710,15 +638,6 @@ internal AlertsOperations(SecurityCenterClient client)
/// The name of the resource group within the user's subscription. The name is
/// case insensitive.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
///
/// Headers that will be added to request.
///
@@ -740,7 +659,7 @@ internal AlertsOperations(SecurityCenterClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListResourceGroupLevelAlertsByRegionWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), string select = default(string), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListResourceGroupLevelAlertsByRegionWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (Client.SubscriptionId == null)
{
@@ -776,7 +695,7 @@ internal AlertsOperations(SecurityCenterClient client)
throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -786,9 +705,6 @@ internal AlertsOperations(SecurityCenterClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("resourceGroupName", resourceGroupName);
- tracingParameters.Add("filter", filter);
- tracingParameters.Add("select", select);
- tracingParameters.Add("expand", expand);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListResourceGroupLevelAlertsByRegion", tracingParameters);
}
@@ -803,18 +719,6 @@ internal AlertsOperations(SecurityCenterClient client)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
- if (filter != null)
- {
- _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter)));
- }
- if (select != null)
- {
- _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select)));
- }
- if (expand != null)
- {
- _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand)));
- }
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
@@ -988,7 +892,7 @@ internal AlertsOperations(SecurityCenterClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "alertName");
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1209,7 +1113,7 @@ internal AlertsOperations(SecurityCenterClient client)
throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1405,7 +1309,7 @@ internal AlertsOperations(SecurityCenterClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "alertName");
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1536,6 +1440,182 @@ internal AlertsOperations(SecurityCenterClient client)
return _result;
}
+ ///
+ /// Update the alert's state
+ ///
+ ///
+ /// Name of the alert object
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task UpdateSubscriptionLevelStateToResolveWithHttpMessagesAsync(string alertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ if (Client.AscLocation == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation");
+ }
+ if (alertName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "alertName");
+ }
+ string apiVersion = "2020-01-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("alertName", alertName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "UpdateSubscriptionLevelStateToResolve", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation));
+ _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
///
/// Update the alert's state
///
@@ -1581,7 +1661,7 @@ internal AlertsOperations(SecurityCenterClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "alertName");
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1596,10 +1676,211 @@ internal AlertsOperations(SecurityCenterClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/reactivate").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation));
+ _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Update the alert's state
+ ///
+ ///
+ /// Name of the alert object
+ ///
+ ///
+ /// The name of the resource group within the user's subscription. The name is
+ /// case insensitive.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task UpdateResourceGroupLevelStateToResolveWithHttpMessagesAsync(string alertName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ if (Client.AscLocation == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation");
+ }
+ if (alertName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "alertName");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ }
+ }
+ string apiVersion = "2020-01-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("alertName", alertName);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "UpdateResourceGroupLevelStateToResolve", 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.Security/locations/{ascLocation}/alerts/{alertName}/resolve").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation));
_url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -1780,7 +2061,7 @@ internal AlertsOperations(SecurityCenterClient client)
throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1981,7 +2262,7 @@ internal AlertsOperations(SecurityCenterClient client)
throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
- string apiVersion = "2019-01-01";
+ string apiVersion = "2020-01-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1997,7 +2278,7 @@ internal AlertsOperations(SecurityCenterClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/reactivate").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation));
_url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName));
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperationsExtensions.cs
index b0c9b6285371..a6fa8ea8e4ad 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperationsExtensions.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperationsExtensions.cs
@@ -27,18 +27,9 @@ public static partial class AlertsOperationsExtensions
///
/// The operations group for this extension method.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
- public static IPage List(this IAlertsOperations operations, string filter = default(string), string select = default(string), string expand = default(string))
+ public static IPage List(this IAlertsOperations operations)
{
- return operations.ListAsync(filter, select, expand).GetAwaiter().GetResult();
+ return operations.ListAsync().GetAwaiter().GetResult();
}
///
@@ -47,21 +38,12 @@ public static partial class AlertsOperationsExtensions
///
/// The operations group for this extension method.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
///
/// The cancellation token.
///
- public static async Task> ListAsync(this IAlertsOperations operations, string filter = default(string), string select = default(string), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListAsync(this IAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListWithHttpMessagesAsync(filter, select, expand, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -77,18 +59,9 @@ public static partial class AlertsOperationsExtensions
/// The name of the resource group within the user's subscription. The name is
/// case insensitive.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
- public static IPage ListByResourceGroup(this IAlertsOperations operations, string resourceGroupName, string filter = default(string), string select = default(string), string expand = default(string))
+ public static IPage ListByResourceGroup(this IAlertsOperations operations, string resourceGroupName)
{
- return operations.ListByResourceGroupAsync(resourceGroupName, filter, select, expand).GetAwaiter().GetResult();
+ return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult();
}
///
@@ -101,21 +74,12 @@ public static partial class AlertsOperationsExtensions
/// The name of the resource group within the user's subscription. The name is
/// case insensitive.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
///
/// The cancellation token.
///
- public static async Task> ListByResourceGroupAsync(this IAlertsOperations operations, string resourceGroupName, string filter = default(string), string select = default(string), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListByResourceGroupAsync(this IAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, filter, select, expand, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -128,18 +92,9 @@ public static partial class AlertsOperationsExtensions
///
/// The operations group for this extension method.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
- public static IPage ListSubscriptionLevelAlertsByRegion(this IAlertsOperations operations, string filter = default(string), string select = default(string), string expand = default(string))
+ public static IPage ListSubscriptionLevelAlertsByRegion(this IAlertsOperations operations)
{
- return operations.ListSubscriptionLevelAlertsByRegionAsync(filter, select, expand).GetAwaiter().GetResult();
+ return operations.ListSubscriptionLevelAlertsByRegionAsync().GetAwaiter().GetResult();
}
///
@@ -149,21 +104,12 @@ public static partial class AlertsOperationsExtensions
///
/// The operations group for this extension method.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
///
/// The cancellation token.
///
- public static async Task> ListSubscriptionLevelAlertsByRegionAsync(this IAlertsOperations operations, string filter = default(string), string select = default(string), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListSubscriptionLevelAlertsByRegionAsync(this IAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListSubscriptionLevelAlertsByRegionWithHttpMessagesAsync(filter, select, expand, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListSubscriptionLevelAlertsByRegionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -180,18 +126,9 @@ public static partial class AlertsOperationsExtensions
/// The name of the resource group within the user's subscription. The name is
/// case insensitive.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
- public static IPage ListResourceGroupLevelAlertsByRegion(this IAlertsOperations operations, string resourceGroupName, string filter = default(string), string select = default(string), string expand = default(string))
+ public static IPage ListResourceGroupLevelAlertsByRegion(this IAlertsOperations operations, string resourceGroupName)
{
- return operations.ListResourceGroupLevelAlertsByRegionAsync(resourceGroupName, filter, select, expand).GetAwaiter().GetResult();
+ return operations.ListResourceGroupLevelAlertsByRegionAsync(resourceGroupName).GetAwaiter().GetResult();
}
///
@@ -205,21 +142,12 @@ public static partial class AlertsOperationsExtensions
/// The name of the resource group within the user's subscription. The name is
/// case insensitive.
///
- ///
- /// OData filter. Optional.
- ///
- ///
- /// OData select. Optional.
- ///
- ///
- /// OData expand. Optional.
- ///
///
/// The cancellation token.
///
- public static async Task> ListResourceGroupLevelAlertsByRegionAsync(this IAlertsOperations operations, string resourceGroupName, string filter = default(string), string select = default(string), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListResourceGroupLevelAlertsByRegionAsync(this IAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListResourceGroupLevelAlertsByRegionWithHttpMessagesAsync(resourceGroupName, filter, select, expand, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListResourceGroupLevelAlertsByRegionWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -334,6 +262,37 @@ public static void UpdateSubscriptionLevelAlertStateToDismiss(this IAlertsOperat
(await operations.UpdateSubscriptionLevelAlertStateToDismissWithHttpMessagesAsync(alertName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
+ ///
+ /// Update the alert's state
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the alert object
+ ///
+ public static void UpdateSubscriptionLevelStateToResolve(this IAlertsOperations operations, string alertName)
+ {
+ operations.UpdateSubscriptionLevelStateToResolveAsync(alertName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Update the alert's state
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the alert object
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UpdateSubscriptionLevelStateToResolveAsync(this IAlertsOperations operations, string alertName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.UpdateSubscriptionLevelStateToResolveWithHttpMessagesAsync(alertName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
///
/// Update the alert's state
///
@@ -365,6 +324,45 @@ public static void UpdateSubscriptionLevelAlertStateToReactivate(this IAlertsOpe
(await operations.UpdateSubscriptionLevelAlertStateToReactivateWithHttpMessagesAsync(alertName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
+ ///
+ /// Update the alert's state
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the alert object
+ ///
+ ///
+ /// The name of the resource group within the user's subscription. The name is
+ /// case insensitive.
+ ///
+ public static void UpdateResourceGroupLevelStateToResolve(this IAlertsOperations operations, string alertName, string resourceGroupName)
+ {
+ operations.UpdateResourceGroupLevelStateToResolveAsync(alertName, resourceGroupName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Update the alert's state
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the alert object
+ ///
+ ///
+ /// The name of the resource group within the user's subscription. The name is
+ /// case insensitive.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UpdateResourceGroupLevelStateToResolveAsync(this IAlertsOperations operations, string alertName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.UpdateResourceGroupLevelStateToResolveWithHttpMessagesAsync(alertName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
///
/// Update the alert's state
///
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperations.cs
new file mode 100644
index 000000000000..218a659c1e10
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperations.cs
@@ -0,0 +1,992 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// AlertsSuppressionRulesOperations operations.
+ ///
+ internal partial class AlertsSuppressionRulesOperations : IServiceOperations, IAlertsSuppressionRulesOperations
+ {
+ ///
+ /// Initializes a new instance of the AlertsSuppressionRulesOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal AlertsSuppressionRulesOperations(SecurityCenterClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityCenterClient
+ ///
+ public SecurityCenterClient Client { get; private set; }
+
+ ///
+ /// List of all the dismiss rules for the given subscription
+ ///
+ ///
+ /// Type of the alert to get rules for
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string alertType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ string apiVersion = "2019-01-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("alertType", alertType);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (alertType != null)
+ {
+ _queryParameters.Add(string.Format("AlertType={0}", System.Uri.EscapeDataString(alertType)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given
+ /// subscription
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string alertsSuppressionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ if (alertsSuppressionRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "alertsSuppressionRuleName");
+ }
+ string apiVersion = "2019-01-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("alertsSuppressionRuleName", alertsSuppressionRuleName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ 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}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{alertsSuppressionRuleName}", System.Uri.EscapeDataString(alertsSuppressionRuleName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Update existing rule or create new rule if it doesn't exist
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ ///
+ /// Suppression rule object
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> UpdateWithHttpMessagesAsync(string alertsSuppressionRuleName, AlertsSuppressionRule alertsSuppressionRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ if (alertsSuppressionRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "alertsSuppressionRuleName");
+ }
+ if (alertsSuppressionRule == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "alertsSuppressionRule");
+ }
+ if (alertsSuppressionRule != null)
+ {
+ alertsSuppressionRule.Validate();
+ }
+ string apiVersion = "2019-01-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("alertsSuppressionRuleName", alertsSuppressionRuleName);
+ tracingParameters.Add("alertsSuppressionRule", alertsSuppressionRule);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{alertsSuppressionRuleName}", System.Uri.EscapeDataString(alertsSuppressionRuleName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(alertsSuppressionRule != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertsSuppressionRule, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete dismiss alert rule for this subscription.
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string alertsSuppressionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ if (alertsSuppressionRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "alertsSuppressionRuleName");
+ }
+ string apiVersion = "2019-01-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("alertsSuppressionRuleName", alertsSuppressionRuleName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{alertsSuppressionRuleName}", System.Uri.EscapeDataString(alertsSuppressionRuleName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// List of all the dismiss rules for the given subscription
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperationsExtensions.cs
new file mode 100644
index 000000000000..d1d174bcfe3a
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperationsExtensions.cs
@@ -0,0 +1,200 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for AlertsSuppressionRulesOperations.
+ ///
+ public static partial class AlertsSuppressionRulesOperationsExtensions
+ {
+ ///
+ /// List of all the dismiss rules for the given subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Type of the alert to get rules for
+ ///
+ public static IPage List(this IAlertsSuppressionRulesOperations operations, string alertType = default(string))
+ {
+ return operations.ListAsync(alertType).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List of all the dismiss rules for the given subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Type of the alert to get rules for
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IAlertsSuppressionRulesOperations operations, string alertType = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(alertType, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given
+ /// subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ public static AlertsSuppressionRule Get(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName)
+ {
+ return operations.GetAsync(alertsSuppressionRuleName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given
+ /// subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(alertsSuppressionRuleName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Update existing rule or create new rule if it doesn't exist
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ ///
+ /// Suppression rule object
+ ///
+ public static AlertsSuppressionRule Update(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName, AlertsSuppressionRule alertsSuppressionRule)
+ {
+ return operations.UpdateAsync(alertsSuppressionRuleName, alertsSuppressionRule).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Update existing rule or create new rule if it doesn't exist
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ ///
+ /// Suppression rule object
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task UpdateAsync(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName, AlertsSuppressionRule alertsSuppressionRule, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.UpdateWithHttpMessagesAsync(alertsSuppressionRuleName, alertsSuppressionRule, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete dismiss alert rule for this subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ public static void Delete(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName)
+ {
+ operations.DeleteAsync(alertsSuppressionRuleName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete dismiss alert rule for this subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The unique name of the suppression alert rule
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(alertsSuppressionRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// List of all the dismiss rules for the given subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IAlertsSuppressionRulesOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// List of all the dismiss rules for the given subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IAlertsSuppressionRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperations.cs
index 9204237839ed..1c5f938d1b19 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperations.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperations.cs
@@ -101,7 +101,7 @@ internal AssessmentsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/assessments").ToString();
- _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope));
+ _url = _url.Replace("{scope}", scope);
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -293,7 +293,7 @@ internal AssessmentsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{assessmentName}", System.Uri.EscapeDataString(assessmentName));
List _queryParameters = new List();
if (apiVersion != null)
@@ -500,7 +500,7 @@ internal AssessmentsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{assessmentName}", System.Uri.EscapeDataString(assessmentName));
List _queryParameters = new List();
if (apiVersion != null)
@@ -712,7 +712,7 @@ internal AssessmentsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{assessmentName}", System.Uri.EscapeDataString(assessmentName));
List _queryParameters = new List();
if (apiVersion != null)
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperations.cs
index bc3295d06fb8..bcdd9739ba99 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperations.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperations.cs
@@ -101,7 +101,7 @@ internal ComplianceResultsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/complianceResults").ToString();
- _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope));
+ _url = _url.Replace("{scope}", scope);
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -289,7 +289,7 @@ internal ComplianceResultsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{complianceResultName}", System.Uri.EscapeDataString(complianceResultName));
List _queryParameters = new List();
if (apiVersion != null)
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperations.cs
index 301070d6be91..307faa6dcacc 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperations.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperations.cs
@@ -101,7 +101,7 @@ internal CompliancesOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/compliances").ToString();
- _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope));
+ _url = _url.Replace("{scope}", scope);
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -291,7 +291,7 @@ internal CompliancesOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/compliances/{complianceName}").ToString();
- _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope));
+ _url = _url.Replace("{scope}", scope);
_url = _url.Replace("{complianceName}", System.Uri.EscapeDataString(complianceName));
List _queryParameters = new List();
if (apiVersion != null)
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperations.cs
new file mode 100644
index 000000000000..0c991b90f231
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperations.cs
@@ -0,0 +1,992 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// ConnectorsOperations operations.
+ ///
+ internal partial class ConnectorsOperations : IServiceOperations, IConnectorsOperations
+ {
+ ///
+ /// Initializes a new instance of the ConnectorsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal ConnectorsOperations(SecurityCenterClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityCenterClient
+ ///
+ public SecurityCenterClient Client { get; private set; }
+
+ ///
+ /// Cloud accounts connectors of a subscription
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ string apiVersion = "2020-01-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Details of a specific cloud account connector
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string connectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ if (connectorName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "connectorName");
+ }
+ string apiVersion = "2020-01-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("connectorName", connectorName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ 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}/providers/Microsoft.Security/connectors/{connectorName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{connectorName}", System.Uri.EscapeDataString(connectorName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Create a cloud account connector or update an existing one. Connect to your
+ /// cloud account. For AWS, use either account credentials or role-based
+ /// authentication. For GCP, use account organization credentials.
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ ///
+ /// Settings for hybrid compute management. These settings are relevant only
+ /// for Arc autoProvision (Hybrid Compute).
+ ///
+ ///
+ /// Settings for authentication management, these settings are relevant only
+ /// for the cloud connector.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string connectorName, HybridComputeSettingsProperties hybridComputeSettings = default(HybridComputeSettingsProperties), AuthenticationDetailsProperties authenticationDetails = default(AuthenticationDetailsProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ if (connectorName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "connectorName");
+ }
+ if (hybridComputeSettings != null)
+ {
+ hybridComputeSettings.Validate();
+ }
+ string apiVersion = "2020-01-01-preview";
+ ConnectorSetting connectorSetting = new ConnectorSetting();
+ if (hybridComputeSettings != null || authenticationDetails != null)
+ {
+ connectorSetting.HybridComputeSettings = hybridComputeSettings;
+ connectorSetting.AuthenticationDetails = authenticationDetails;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("connectorName", connectorName);
+ tracingParameters.Add("connectorSetting", connectorSetting);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{connectorName}", System.Uri.EscapeDataString(connectorName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(connectorSetting != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(connectorSetting, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete a cloud account connector from a subscription
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string connectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ }
+ }
+ if (connectorName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "connectorName");
+ }
+ string apiVersion = "2020-01-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("connectorName", connectorName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{connectorName}", System.Uri.EscapeDataString(connectorName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Cloud accounts connectors of a subscription
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperationsExtensions.cs
new file mode 100644
index 000000000000..448906574d71
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperationsExtensions.cs
@@ -0,0 +1,206 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for ConnectorsOperations.
+ ///
+ public static partial class ConnectorsOperationsExtensions
+ {
+ ///
+ /// Cloud accounts connectors of a subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static IPage List(this IConnectorsOperations operations)
+ {
+ return operations.ListAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Cloud accounts connectors of a subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IConnectorsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Details of a specific cloud account connector
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ public static ConnectorSetting Get(this IConnectorsOperations operations, string connectorName)
+ {
+ return operations.GetAsync(connectorName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Details of a specific cloud account connector
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IConnectorsOperations operations, string connectorName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(connectorName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Create a cloud account connector or update an existing one. Connect to your
+ /// cloud account. For AWS, use either account credentials or role-based
+ /// authentication. For GCP, use account organization credentials.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ ///
+ /// Settings for hybrid compute management. These settings are relevant only
+ /// for Arc autoProvision (Hybrid Compute).
+ ///
+ ///
+ /// Settings for authentication management, these settings are relevant only
+ /// for the cloud connector.
+ ///
+ public static ConnectorSetting CreateOrUpdate(this IConnectorsOperations operations, string connectorName, HybridComputeSettingsProperties hybridComputeSettings = default(HybridComputeSettingsProperties), AuthenticationDetailsProperties authenticationDetails = default(AuthenticationDetailsProperties))
+ {
+ return operations.CreateOrUpdateAsync(connectorName, hybridComputeSettings, authenticationDetails).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create a cloud account connector or update an existing one. Connect to your
+ /// cloud account. For AWS, use either account credentials or role-based
+ /// authentication. For GCP, use account organization credentials.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ ///
+ /// Settings for hybrid compute management. These settings are relevant only
+ /// for Arc autoProvision (Hybrid Compute).
+ ///
+ ///
+ /// Settings for authentication management, these settings are relevant only
+ /// for the cloud connector.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IConnectorsOperations operations, string connectorName, HybridComputeSettingsProperties hybridComputeSettings = default(HybridComputeSettingsProperties), AuthenticationDetailsProperties authenticationDetails = default(AuthenticationDetailsProperties), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(connectorName, hybridComputeSettings, authenticationDetails, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete a cloud account connector from a subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ public static void Delete(this IConnectorsOperations operations, string connectorName)
+ {
+ operations.DeleteAsync(connectorName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete a cloud account connector from a subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the cloud account connector
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IConnectorsOperations operations, string connectorName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(connectorName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Cloud accounts connectors of a subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IConnectorsOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Cloud accounts connectors of a subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IConnectorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceOperations.cs
new file mode 100644
index 000000000000..fdf84d888ffd
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceOperations.cs
@@ -0,0 +1,243 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// DeviceOperations operations.
+ ///
+ internal partial class DeviceOperations : IServiceOperations, IDeviceOperations
+ {
+ ///
+ /// Initializes a new instance of the DeviceOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal DeviceOperations(SecurityCenterClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityCenterClient
+ ///
+ public SecurityCenterClient Client { get; private set; }
+
+ ///
+ /// Get device.
+ ///
+ ///
+ /// The identifier of the resource.
+ ///
+ ///
+ /// Identifier of the device.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceId, string deviceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceId");
+ }
+ if (deviceId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "deviceId");
+ }
+ string apiVersion = "2020-08-06-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("resourceId", resourceId);
+ tracingParameters.Add("deviceId", deviceId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/devices/{deviceId}").ToString();
+ _url = _url.Replace("{resourceId}", resourceId);
+ _url = _url.Replace("{deviceId}", System.Uri.EscapeDataString(deviceId));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceOperationsExtensions.cs
new file mode 100644
index 000000000000..b5f731974a69
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceOperationsExtensions.cs
@@ -0,0 +1,65 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for DeviceOperations.
+ ///
+ public static partial class DeviceOperationsExtensions
+ {
+ ///
+ /// Get device.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The identifier of the resource.
+ ///
+ ///
+ /// Identifier of the device.
+ ///
+ public static Device Get(this IDeviceOperations operations, string resourceId, string deviceId)
+ {
+ return operations.GetAsync(resourceId, deviceId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get device.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The identifier of the resource.
+ ///
+ ///
+ /// Identifier of the device.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IDeviceOperations operations, string resourceId, string deviceId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceId, deviceId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs
index 6e980ad08309..5b6b3778b606 100644
--- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs
@@ -100,7 +100,7 @@ internal DeviceSecurityGroupsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -290,7 +290,7 @@ internal DeviceSecurityGroupsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName));
List _queryParameters = new List();
if (apiVersion != null)
@@ -489,7 +489,7 @@ internal DeviceSecurityGroupsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName));
List _queryParameters = new List();
if (apiVersion != null)
@@ -700,7 +700,7 @@ internal DeviceSecurityGroupsOperations(SecurityCenterClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString();
- _url = _url.Replace("{resourceId}", System.Uri.EscapeDataString(resourceId));
+ _url = _url.Replace("{resourceId}", resourceId);
_url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName));
List _queryParameters = new List();
if (apiVersion != null)
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForHubOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForHubOperations.cs
new file mode 100644
index 000000000000..c152521ca69d
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForHubOperations.cs
@@ -0,0 +1,432 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// DevicesForHubOperations operations.
+ ///
+ internal partial class DevicesForHubOperations : IServiceOperations, IDevicesForHubOperations
+ {
+ ///
+ /// Initializes a new instance of the DevicesForHubOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal DevicesForHubOperations(SecurityCenterClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityCenterClient
+ ///
+ public SecurityCenterClient Client { get; private set; }
+
+ ///
+ /// Get list of the devices for the specified IoT Hub resource.
+ ///
+ ///
+ /// The identifier of the resource.
+ ///
+ ///
+ /// Limit the number of items returned in a single page
+ ///
+ ///
+ /// Skip token used for pagination
+ ///
+ ///
+ /// Get devices only from specific type, Managed or Unmanaged. Possible values
+ /// include: 'Managed', 'Unmanaged'
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string resourceId, int? limit = default(int?), string skipToken = default(string), string deviceManagementType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceId");
+ }
+ string apiVersion = "2020-08-06-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("resourceId", resourceId);
+ tracingParameters.Add("limit", limit);
+ tracingParameters.Add("skipToken", skipToken);
+ tracingParameters.Add("deviceManagementType", deviceManagementType);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/devices").ToString();
+ _url = _url.Replace("{resourceId}", resourceId);
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (limit != null)
+ {
+ _queryParameters.Add(string.Format("$limit={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(limit, Client.SerializationSettings).Trim('"'))));
+ }
+ if (skipToken != null)
+ {
+ _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken)));
+ }
+ if (deviceManagementType != null)
+ {
+ _queryParameters.Add(string.Format("deviceManagementType={0}", System.Uri.EscapeDataString(deviceManagementType)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get list of the devices for the specified IoT Hub resource.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForHubOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForHubOperationsExtensions.cs
new file mode 100644
index 000000000000..fd720b59218f
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForHubOperationsExtensions.cs
@@ -0,0 +1,113 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for DevicesForHubOperations.
+ ///
+ public static partial class DevicesForHubOperationsExtensions
+ {
+ ///
+ /// Get list of the devices for the specified IoT Hub resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The identifier of the resource.
+ ///
+ ///
+ /// Limit the number of items returned in a single page
+ ///
+ ///
+ /// Skip token used for pagination
+ ///
+ ///
+ /// Get devices only from specific type, Managed or Unmanaged. Possible values
+ /// include: 'Managed', 'Unmanaged'
+ ///
+ public static IPage List(this IDevicesForHubOperations operations, string resourceId, int? limit = default(int?), string skipToken = default(string), string deviceManagementType = default(string))
+ {
+ return operations.ListAsync(resourceId, limit, skipToken, deviceManagementType).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get list of the devices for the specified IoT Hub resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The identifier of the resource.
+ ///
+ ///
+ /// Limit the number of items returned in a single page
+ ///
+ ///
+ /// Skip token used for pagination
+ ///
+ ///
+ /// Get devices only from specific type, Managed or Unmanaged. Possible values
+ /// include: 'Managed', 'Unmanaged'
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IDevicesForHubOperations operations, string resourceId, int? limit = default(int?), string skipToken = default(string), string deviceManagementType = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceId, limit, skipToken, deviceManagementType, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get list of the devices for the specified IoT Hub resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IDevicesForHubOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get list of the devices for the specified IoT Hub resource.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IDevicesForHubOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForSubscriptionOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForSubscriptionOperations.cs
new file mode 100644
index 000000000000..3a225ef704bc
--- /dev/null
+++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DevicesForSubscriptionOperations.cs
@@ -0,0 +1,435 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Security
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// DevicesForSubscriptionOperations operations.
+ ///
+ internal partial class DevicesForSubscriptionOperations : IServiceOperations, IDevicesForSubscriptionOperations
+ {
+ ///
+ /// Initializes a new instance of the DevicesForSubscriptionOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal DevicesForSubscriptionOperations(SecurityCenterClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityCenterClient
+ ///
+ public SecurityCenterClient Client { get; private set; }
+
+ ///
+ /// Get list of the devices by their subscription.
+ ///
+ ///
+ /// Limit the number of items returned in a single page
+ ///
+ ///
+ /// Skip token used for pagination
+ ///
+ ///
+ /// Get devices only from specific type, Managed or Unmanaged. Possible values
+ /// include: 'Managed', 'Unmanaged'
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(int? limit = default(int?), string skipToken = default(string), string deviceManagementType = default(string), Dictionary