diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/api/Azure.ResourceManager.SecurityCenter.netstandard2.0.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/api/Azure.ResourceManager.SecurityCenter.netstandard2.0.cs index 1c78fd31e953..2d57029bf12e 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/api/Azure.ResourceManager.SecurityCenter.netstandard2.0.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/api/Azure.ResourceManager.SecurityCenter.netstandard2.0.cs @@ -365,46 +365,6 @@ protected GovernanceRuleResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecurityCenter.GovernanceRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecurityCenter.GovernanceRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class IngestionSettingCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected IngestionSettingCollection() { } - public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string ingestionSettingName, Azure.ResourceManager.SecurityCenter.IngestionSettingData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string ingestionSettingName, Azure.ResourceManager.SecurityCenter.IngestionSettingData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Exists(string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class IngestionSettingData : Azure.ResourceManager.Models.ResourceData - { - public IngestionSettingData() { } - public System.BinaryData Properties { get { throw null; } set { } } - } - public partial class IngestionSettingResource : Azure.ResourceManager.ArmResource - { - public static readonly Azure.Core.ResourceType ResourceType; - protected IngestionSettingResource() { } - public virtual Azure.ResourceManager.SecurityCenter.IngestionSettingData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string ingestionSettingName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetConnectionStrings(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetConnectionStringsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetTokens(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetTokensAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecurityCenter.IngestionSettingData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecurityCenter.IngestionSettingData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class IotSecurityAggregatedAlertCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected IotSecurityAggregatedAlertCollection() { } @@ -1074,10 +1034,6 @@ public static partial class SecurityCenterExtensions public static Azure.ResourceManager.SecurityCenter.GovernanceRuleCollection GetGovernanceRules(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } public static Azure.Pageable GetInformationProtectionPolicies(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetInformationProtectionPoliciesAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetIngestionSetting(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetIngestionSettingAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string ingestionSettingName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.ResourceManager.SecurityCenter.IngestionSettingResource GetIngestionSettingResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.SecurityCenter.IngestionSettingCollection GetIngestionSettings(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } public static Azure.ResourceManager.SecurityCenter.IotSecurityAggregatedAlertResource GetIotSecurityAggregatedAlertResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.SecurityCenter.IotSecurityAggregatedRecommendationResource GetIotSecurityAggregatedRecommendationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Response GetIotSecuritySolution(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string solutionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -2259,9 +2215,6 @@ public static partial class ArmSecurityCenterModelFactory public static Azure.ResourceManager.SecurityCenter.Models.HybridComputeSettingsProperties HybridComputeSettingsProperties(Azure.ResourceManager.SecurityCenter.Models.HybridComputeProvisioningState? hybridComputeProvisioningState = default(Azure.ResourceManager.SecurityCenter.Models.HybridComputeProvisioningState?), Azure.ResourceManager.SecurityCenter.Models.AutoProvisionState autoProvision = default(Azure.ResourceManager.SecurityCenter.Models.AutoProvisionState), string resourceGroupName = null, string region = null, Azure.ResourceManager.SecurityCenter.Models.ProxyServerProperties proxyServer = null, Azure.ResourceManager.SecurityCenter.Models.ServicePrincipalProperties servicePrincipal = null) { throw null; } public static Azure.ResourceManager.SecurityCenter.Models.InformationProtectionAwsOffering InformationProtectionAwsOffering(string description = null, string informationProtectionCloudRoleArn = null) { throw null; } public static Azure.ResourceManager.SecurityCenter.Models.InformationProtectionPolicy InformationProtectionPolicy(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.DateTimeOffset? lastModifiedUtc = default(System.DateTimeOffset?), string version = null, System.Collections.Generic.IDictionary labels = null, System.Collections.Generic.IDictionary informationTypes = null) { throw null; } - public static Azure.ResourceManager.SecurityCenter.Models.IngestionConnectionString IngestionConnectionString(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string value = null) { throw null; } - public static Azure.ResourceManager.SecurityCenter.IngestionSettingData IngestionSettingData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.BinaryData properties = null) { throw null; } - public static Azure.ResourceManager.SecurityCenter.Models.IngestionSettingToken IngestionSettingToken(string token = null) { throw null; } public static Azure.ResourceManager.SecurityCenter.IotSecurityAggregatedAlertData IotSecurityAggregatedAlertData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string alertType = null, string alertDisplayName = null, System.DateTimeOffset? aggregatedOn = default(System.DateTimeOffset?), string vendorName = null, Azure.ResourceManager.SecurityCenter.Models.ReportedSeverity? reportedSeverity = default(Azure.ResourceManager.SecurityCenter.Models.ReportedSeverity?), string remediationSteps = null, string description = null, long? count = default(long?), string effectedResourceType = null, string systemSource = null, string actionTaken = null, string logAnalyticsQuery = null, System.Collections.Generic.IEnumerable topDevicesList = null, System.Collections.Generic.IDictionary tags = null) { throw null; } public static Azure.ResourceManager.SecurityCenter.Models.IotSecurityAggregatedAlertTopDevice IotSecurityAggregatedAlertTopDevice(string deviceId = null, long? alertsCount = default(long?), string lastOccurrence = null) { throw null; } public static Azure.ResourceManager.SecurityCenter.IotSecurityAggregatedRecommendationData IotSecurityAggregatedRecommendationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string recommendationName = null, string recommendationDisplayName = null, string description = null, string recommendationTypeId = null, string detectedBy = null, string remediationSteps = null, Azure.ResourceManager.SecurityCenter.Models.ReportedSeverity? reportedSeverity = default(Azure.ResourceManager.SecurityCenter.Models.ReportedSeverity?), long? healthyDevices = default(long?), long? unhealthyDeviceCount = default(long?), string logAnalyticsQuery = null, System.Collections.Generic.IDictionary tags = null) { throw null; } @@ -3192,17 +3145,6 @@ public InformationProtectionPolicy() { } public static bool operator !=(Azure.ResourceManager.SecurityCenter.Models.InformationProtectionPolicyName left, Azure.ResourceManager.SecurityCenter.Models.InformationProtectionPolicyName right) { throw null; } public override string ToString() { throw null; } } - public partial class IngestionConnectionString - { - internal IngestionConnectionString() { } - public Azure.Core.AzureLocation? Location { get { throw null; } } - public string Value { get { throw null; } } - } - public partial class IngestionSettingToken - { - internal IngestionSettingToken() { } - public string Token { get { throw null; } } - } public partial class IotSecurityAggregatedAlertTopDevice { internal IotSecurityAggregatedAlertTopDevice() { } diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingCollection.cs deleted file mode 100644 index fd6036f586a0..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingCollection.cs +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager; -using Azure.ResourceManager.Resources; -using Azure.ResourceManager.SecurityCenter; - -namespace Azure.ResourceManager.SecurityCenter.Samples -{ - public partial class Sample_IngestionSettingCollection - { - // Get ingestion settings on subscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_GetIngestionSettingsOnSubscription() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/GetIngestionSettings_example.json - // this example is just showing the usage of "IngestionSettings_List" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // get the collection of this IngestionSettingResource - IngestionSettingCollection collection = subscriptionResource.GetIngestionSettings(); - - // invoke the operation and iterate over the result - await foreach (IngestionSettingResource item in collection.GetAllAsync()) - { - // the variable item is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - IngestionSettingData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // Get a ingestion setting on subscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GetAIngestionSettingOnSubscription() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/GetIngestionSetting_example.json - // this example is just showing the usage of "IngestionSettings_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // get the collection of this IngestionSettingResource - IngestionSettingCollection collection = subscriptionResource.GetIngestionSettings(); - - // invoke the operation - string ingestionSettingName = "default"; - IngestionSettingResource result = await collection.GetAsync(ingestionSettingName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - IngestionSettingData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // Get a ingestion setting on subscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_GetAIngestionSettingOnSubscription() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/GetIngestionSetting_example.json - // this example is just showing the usage of "IngestionSettings_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // get the collection of this IngestionSettingResource - IngestionSettingCollection collection = subscriptionResource.GetIngestionSettings(); - - // invoke the operation - string ingestionSettingName = "default"; - bool result = await collection.ExistsAsync(ingestionSettingName); - - Console.WriteLine($"Succeeded: {result}"); - } - - // Get a ingestion setting on subscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetIfExists_GetAIngestionSettingOnSubscription() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/GetIngestionSetting_example.json - // this example is just showing the usage of "IngestionSettings_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // get the collection of this IngestionSettingResource - IngestionSettingCollection collection = subscriptionResource.GetIngestionSettings(); - - // invoke the operation - string ingestionSettingName = "default"; - NullableResponse response = await collection.GetIfExistsAsync(ingestionSettingName); - IngestionSettingResource result = response.HasValue ? response.Value : null; - - if (result == null) - { - Console.WriteLine($"Succeeded with null as result"); - } - else - { - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - IngestionSettingData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } - - // Create an ingestion setting for subscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_CreateAnIngestionSettingForSubscription() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/CreateIngestionSetting_example.json - // this example is just showing the usage of "IngestionSettings_Create" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // get the collection of this IngestionSettingResource - IngestionSettingCollection collection = subscriptionResource.GetIngestionSettings(); - - // invoke the operation - string ingestionSettingName = "default"; - IngestionSettingData data = new IngestionSettingData(); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, ingestionSettingName, data); - IngestionSettingResource result = lro.Value; - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - IngestionSettingData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingResource.cs deleted file mode 100644 index 7aa1bad09df7..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/samples/Generated/Samples/Sample_IngestionSettingResource.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager; -using Azure.ResourceManager.SecurityCenter; -using Azure.ResourceManager.SecurityCenter.Models; - -namespace Azure.ResourceManager.SecurityCenter.Samples -{ - public partial class Sample_IngestionSettingResource - { - // Get a ingestion setting on subscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GetAIngestionSettingOnSubscription() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/GetIngestionSetting_example.json - // this example is just showing the usage of "IngestionSettings_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this IngestionSettingResource created on azure - // for more information of creating IngestionSettingResource, please refer to the document of IngestionSettingResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - string ingestionSettingName = "default"; - ResourceIdentifier ingestionSettingResourceId = IngestionSettingResource.CreateResourceIdentifier(subscriptionId, ingestionSettingName); - IngestionSettingResource ingestionSetting = client.GetIngestionSettingResource(ingestionSettingResourceId); - - // invoke the operation - IngestionSettingResource result = await ingestionSetting.GetAsync(); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - IngestionSettingData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // Create an ingestion setting for subscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_CreateAnIngestionSettingForSubscription() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/CreateIngestionSetting_example.json - // this example is just showing the usage of "IngestionSettings_Create" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this IngestionSettingResource created on azure - // for more information of creating IngestionSettingResource, please refer to the document of IngestionSettingResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - string ingestionSettingName = "default"; - ResourceIdentifier ingestionSettingResourceId = IngestionSettingResource.CreateResourceIdentifier(subscriptionId, ingestionSettingName); - IngestionSettingResource ingestionSetting = client.GetIngestionSettingResource(ingestionSettingResourceId); - - // invoke the operation - IngestionSettingData data = new IngestionSettingData(); - ArmOperation lro = await ingestionSetting.UpdateAsync(WaitUntil.Completed, data); - IngestionSettingResource result = lro.Value; - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - IngestionSettingData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // Delete an ingestion setting for the subscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_DeleteAnIngestionSettingForTheSubscription() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/DeleteIngestionSetting_example.json - // this example is just showing the usage of "IngestionSettings_Delete" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this IngestionSettingResource created on azure - // for more information of creating IngestionSettingResource, please refer to the document of IngestionSettingResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - string ingestionSettingName = "default"; - ResourceIdentifier ingestionSettingResourceId = IngestionSettingResource.CreateResourceIdentifier(subscriptionId, ingestionSettingName); - IngestionSettingResource ingestionSetting = client.GetIngestionSettingResource(ingestionSettingResourceId); - - // invoke the operation - await ingestionSetting.DeleteAsync(WaitUntil.Completed); - - Console.WriteLine($"Succeeded"); - } - - // List ingestion setting tokens - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetTokens_ListIngestionSettingTokens() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/ListTokensIngestionSetting_example.json - // this example is just showing the usage of "IngestionSettings_ListTokens" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this IngestionSettingResource created on azure - // for more information of creating IngestionSettingResource, please refer to the document of IngestionSettingResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - string ingestionSettingName = "default"; - ResourceIdentifier ingestionSettingResourceId = IngestionSettingResource.CreateResourceIdentifier(subscriptionId, ingestionSettingName); - IngestionSettingResource ingestionSetting = client.GetIngestionSettingResource(ingestionSettingResourceId); - - // invoke the operation - IngestionSettingToken result = await ingestionSetting.GetTokensAsync(); - - Console.WriteLine($"Succeeded: {result}"); - } - - // List connection strings for ingesting security data and logs - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetConnectionStrings_ListConnectionStringsForIngestingSecurityDataAndLogs() - { - // Generated from example definition: specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/ListConnectionStrings_example.json - // this example is just showing the usage of "IngestionSettings_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this IngestionSettingResource created on azure - // for more information of creating IngestionSettingResource, please refer to the document of IngestionSettingResource - string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23"; - string ingestionSettingName = "default"; - ResourceIdentifier ingestionSettingResourceId = IngestionSettingResource.CreateResourceIdentifier(subscriptionId, ingestionSettingName); - IngestionSettingResource ingestionSetting = client.GetIngestionSettingResource(ingestionSettingResourceId); - - // invoke the operation and iterate over the result - await foreach (IngestionConnectionString item in ingestionSetting.GetConnectionStringsAsync()) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine($"Succeeded"); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ArmSecurityCenterModelFactory.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ArmSecurityCenterModelFactory.cs index 9a55c05135bb..da40f17b46a1 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ArmSecurityCenterModelFactory.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/ArmSecurityCenterModelFactory.cs @@ -1233,35 +1233,6 @@ public static SecuritySettingData SecuritySettingData(ResourceIdentifier id = nu return new SecuritySettingData(id, name, resourceType, systemData, kind); } - /// Initializes a new instance of IngestionSettingData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Ingestion setting data. - /// A new instance for mocking. - public static IngestionSettingData IngestionSettingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, BinaryData properties = null) - { - return new IngestionSettingData(id, name, resourceType, systemData, properties); - } - - /// Initializes a new instance of IngestionSettingToken. - /// The token is used for correlating security data and logs with the resources in the subscription. - /// A new instance for mocking. - public static IngestionSettingToken IngestionSettingToken(string token = null) - { - return new IngestionSettingToken(token); - } - - /// Initializes a new instance of IngestionConnectionString. - /// The region where ingested logs and data resides. - /// Connection string value. - /// A new instance for mocking. - public static IngestionConnectionString IngestionConnectionString(AzureLocation? location = null, string value = null) - { - return new IngestionConnectionString(location, value); - } - /// Initializes a new instance of SoftwareInventoryData. /// The id. /// The name. diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SecurityCenterExtensions.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SecurityCenterExtensions.cs index 5b462fa6c1ba..532a3a3aaefb 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SecurityCenterExtensions.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SecurityCenterExtensions.cs @@ -747,25 +747,6 @@ public static SecuritySettingResource GetSecuritySettingResource(this ArmClient } #endregion - #region IngestionSettingResource - /// - /// Gets an object representing an along with the instance operations that can be performed on it but with no data. - /// You can use to create an from its components. - /// - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static IngestionSettingResource GetIngestionSettingResource(this ArmClient client, ResourceIdentifier id) - { - return client.GetResourceClient(() => - { - IngestionSettingResource.ValidateResourceId(id); - return new IngestionSettingResource(client, id); - } - ); - } - #endregion - #region SoftwareInventoryResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -3136,62 +3117,6 @@ public static Response GetSecuritySetting(this Subscrip return subscriptionResource.GetSecuritySettings().Get(settingName, cancellationToken); } - /// Gets a collection of IngestionSettingResources in the SubscriptionResource. - /// The instance the method will execute against. - /// An object representing collection of IngestionSettingResources and their operations over a IngestionSettingResource. - public static IngestionSettingCollection GetIngestionSettings(this SubscriptionResource subscriptionResource) - { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetIngestionSettings(); - } - - /// - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// The instance the method will execute against. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static async Task> GetIngestionSettingAsync(this SubscriptionResource subscriptionResource, string ingestionSettingName, CancellationToken cancellationToken = default) - { - return await subscriptionResource.GetIngestionSettings().GetAsync(ingestionSettingName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// The instance the method will execute against. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public static Response GetIngestionSetting(this SubscriptionResource subscriptionResource, string ingestionSettingName, CancellationToken cancellationToken = default) - { - return subscriptionResource.GetIngestionSettings().Get(ingestionSettingName, cancellationToken); - } - /// Gets a collection of SubscriptionSecurityApplicationResources in the SubscriptionResource. /// The instance the method will execute against. /// An object representing collection of SubscriptionSecurityApplicationResources and their operations over a SubscriptionSecurityApplicationResource. diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index bde99e4dee66..579ddc4f7d9c 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -193,13 +193,6 @@ public virtual SecuritySettingCollection GetSecuritySettings() return GetCachedClient(Client => new SecuritySettingCollection(Client, Id)); } - /// Gets a collection of IngestionSettingResources in the SubscriptionResource. - /// An object representing collection of IngestionSettingResources and their operations over a IngestionSettingResource. - public virtual IngestionSettingCollection GetIngestionSettings() - { - return GetCachedClient(Client => new IngestionSettingCollection(Client, Id)); - } - /// Gets a collection of SubscriptionSecurityApplicationResources in the SubscriptionResource. /// An object representing collection of SubscriptionSecurityApplicationResources and their operations over a SubscriptionSecurityApplicationResource. public virtual SubscriptionSecurityApplicationCollection GetSubscriptionSecurityApplications() diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingCollection.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingCollection.cs deleted file mode 100644 index cdcd772fcf2c..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingCollection.cs +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager.SecurityCenter -{ - /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get an instance call the GetIngestionSettings method from an instance of . - /// - public partial class IngestionSettingCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _ingestionSettingClientDiagnostics; - private readonly IngestionSettingsRestOperations _ingestionSettingRestClient; - - /// Initializes a new instance of the class for mocking. - protected IngestionSettingCollection() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the parent resource that is the target of operations. - internal IngestionSettingCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _ingestionSettingClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", IngestionSettingResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(IngestionSettingResource.ResourceType, out string ingestionSettingApiVersion); - _ingestionSettingRestClient = new IngestionSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, ingestionSettingApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != SubscriptionResource.ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); - } - - /// - /// Create setting for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Create - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Name of the ingestion setting. - /// Ingestion setting object. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string ingestionSettingName, IngestionSettingData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _ingestionSettingRestClient.CreateAsync(Id.SubscriptionId, ingestionSettingName, data, cancellationToken).ConfigureAwait(false); - var operation = new SecurityCenterArmOperation(Response.FromValue(new IngestionSettingResource(Client, response), response.GetRawResponse())); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create setting for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Create - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Name of the ingestion setting. - /// Ingestion setting object. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string ingestionSettingName, IngestionSettingData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _ingestionSettingRestClient.Create(Id.SubscriptionId, ingestionSettingName, data, cancellationToken); - var operation = new SecurityCenterArmOperation(Response.FromValue(new IngestionSettingResource(Client, response), response.GetRawResponse())); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// Name of the ingestion setting. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.Get"); - scope.Start(); - try - { - var response = await _ingestionSettingRestClient.GetAsync(Id.SubscriptionId, ingestionSettingName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new IngestionSettingResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// Name of the ingestion setting. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.Get"); - scope.Start(); - try - { - var response = _ingestionSettingRestClient.Get(Id.SubscriptionId, ingestionSettingName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new IngestionSettingResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings - /// - /// - /// Operation Id - /// IngestionSettings_List - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _ingestionSettingRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _ingestionSettingRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new IngestionSettingResource(Client, IngestionSettingData.DeserializeIngestionSettingData(e)), _ingestionSettingClientDiagnostics, Pipeline, "IngestionSettingCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings - /// - /// - /// Operation Id - /// IngestionSettings_List - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _ingestionSettingRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _ingestionSettingRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new IngestionSettingResource(Client, IngestionSettingData.DeserializeIngestionSettingData(e)), _ingestionSettingClientDiagnostics, Pipeline, "IngestionSettingCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// Name of the ingestion setting. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.Exists"); - scope.Start(); - try - { - var response = await _ingestionSettingRestClient.GetAsync(Id.SubscriptionId, ingestionSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// Name of the ingestion setting. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.Exists"); - scope.Start(); - try - { - var response = _ingestionSettingRestClient.Get(Id.SubscriptionId, ingestionSettingName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// Name of the ingestion setting. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _ingestionSettingRestClient.GetAsync(Id.SubscriptionId, ingestionSettingName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new IngestionSettingResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Tries to get details for this resource from the service. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// Name of the ingestion setting. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingCollection.GetIfExists"); - scope.Start(); - try - { - var response = _ingestionSettingRestClient.Get(Id.SubscriptionId, ingestionSettingName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new IngestionSettingResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingData.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingData.cs deleted file mode 100644 index 42cc54c38ecd..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingData.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - /// - /// A class representing the IngestionSetting data model. - /// Configures how to correlate scan data and logs with resources associated with the subscription. - /// - public partial class IngestionSettingData : ResourceData - { - /// Initializes a new instance of IngestionSettingData. - public IngestionSettingData() - { - } - - /// Initializes a new instance of IngestionSettingData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Ingestion setting data. - internal IngestionSettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, BinaryData properties) : base(id, name, resourceType, systemData) - { - Properties = properties; - } - - /// - /// Ingestion setting data - /// - /// To assign an object to this property use . - /// - /// - /// To assign an already formated json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - public BinaryData Properties { get; set; } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingResource.cs deleted file mode 100644 index 15d5654eeb8d..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IngestionSettingResource.cs +++ /dev/null @@ -1,402 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Resources; -using Azure.ResourceManager.SecurityCenter.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - /// - /// A Class representing an IngestionSetting along with the instance operations that can be performed on it. - /// If you have a you can construct an - /// from an instance of using the GetIngestionSettingResource method. - /// Otherwise you can get one from its parent resource using the GetIngestionSetting method. - /// - public partial class IngestionSettingResource : ArmResource - { - /// Generate the resource identifier of a instance. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string ingestionSettingName) - { - var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _ingestionSettingClientDiagnostics; - private readonly IngestionSettingsRestOperations _ingestionSettingRestClient; - private readonly IngestionSettingData _data; - - /// Initializes a new instance of the class for mocking. - protected IngestionSettingResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal IngestionSettingResource(ArmClient client, IngestionSettingData data) : this(client, data.Id) - { - HasData = true; - _data = data; - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal IngestionSettingResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _ingestionSettingClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecurityCenter", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string ingestionSettingApiVersion); - _ingestionSettingRestClient = new IngestionSettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, ingestionSettingApiVersion); -#if DEBUG - ValidateResourceId(Id); -#endif - } - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.Security/ingestionSettings"; - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual IngestionSettingData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - internal static void ValidateResourceId(ResourceIdentifier id) - { - if (id.ResourceType != ResourceType) - throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); - } - - /// - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingResource.Get"); - scope.Start(); - try - { - var response = await _ingestionSettingRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new IngestionSettingResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Get - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingResource.Get"); - scope.Start(); - try - { - var response = _ingestionSettingRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new IngestionSettingResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes the ingestion settings for this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Delete - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingResource.Delete"); - scope.Start(); - try - { - var response = await _ingestionSettingRestClient.DeleteAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new SecurityCenterArmOperation(response); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes the ingestion settings for this subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Delete - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingResource.Delete"); - scope.Start(); - try - { - var response = _ingestionSettingRestClient.Delete(Id.SubscriptionId, Id.Name, cancellationToken); - var operation = new SecurityCenterArmOperation(response); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create setting for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Create - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Ingestion setting object. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, IngestionSettingData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingResource.Update"); - scope.Start(); - try - { - var response = await _ingestionSettingRestClient.CreateAsync(Id.SubscriptionId, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new SecurityCenterArmOperation(Response.FromValue(new IngestionSettingResource(Client, response), response.GetRawResponse())); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create setting for ingesting security data and logs to correlate with resources associated with the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName} - /// - /// - /// Operation Id - /// IngestionSettings_Create - /// - /// - /// - /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Ingestion setting object. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, IngestionSettingData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingResource.Update"); - scope.Start(); - try - { - var response = _ingestionSettingRestClient.Create(Id.SubscriptionId, Id.Name, data, cancellationToken); - var operation = new SecurityCenterArmOperation(Response.FromValue(new IngestionSettingResource(Client, response), response.GetRawResponse())); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns the token that is used for correlating ingested telemetry with the resources in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens - /// - /// - /// Operation Id - /// IngestionSettings_ListTokens - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetTokensAsync(CancellationToken cancellationToken = default) - { - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingResource.GetTokens"); - scope.Start(); - try - { - var response = await _ingestionSettingRestClient.ListTokensAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Returns the token that is used for correlating ingested telemetry with the resources in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens - /// - /// - /// Operation Id - /// IngestionSettings_ListTokens - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetTokens(CancellationToken cancellationToken = default) - { - using var scope = _ingestionSettingClientDiagnostics.CreateScope("IngestionSettingResource.GetTokens"); - scope.Start(); - try - { - var response = _ingestionSettingRestClient.ListTokens(Id.SubscriptionId, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Connection strings for ingesting security scan logs and data. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings - /// - /// - /// Operation Id - /// IngestionSettings_ListConnectionStrings - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConnectionStringsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _ingestionSettingRestClient.CreateListConnectionStringsRequest(Id.SubscriptionId, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, IngestionConnectionString.DeserializeIngestionConnectionString, _ingestionSettingClientDiagnostics, Pipeline, "IngestionSettingResource.GetConnectionStrings", "value", null, cancellationToken); - } - - /// - /// Connection strings for ingesting security scan logs and data. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings - /// - /// - /// Operation Id - /// IngestionSettings_ListConnectionStrings - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConnectionStrings(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _ingestionSettingRestClient.CreateListConnectionStringsRequest(Id.SubscriptionId, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, IngestionConnectionString.DeserializeIngestionConnectionString, _ingestionSettingClientDiagnostics, Pipeline, "IngestionSettingResource.GetConnectionStrings", "value", null, cancellationToken); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/ConnectionStrings.Serialization.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/ConnectionStrings.Serialization.cs deleted file mode 100644 index 33a3bb46fc95..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/ConnectionStrings.Serialization.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; - -namespace Azure.ResourceManager.SecurityCenter.Models -{ - internal partial class ConnectionStrings - { - internal static ConnectionStrings DeserializeConnectionStrings(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(IngestionConnectionString.DeserializeIngestionConnectionString(item)); - } - value = array; - continue; - } - } - return new ConnectionStrings(value); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/ConnectionStrings.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/ConnectionStrings.cs deleted file mode 100644 index 2f358e6fe9af..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/ConnectionStrings.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.ResourceManager.SecurityCenter.Models -{ - /// Connection string for ingesting security data and logs. - internal partial class ConnectionStrings - { - /// Initializes a new instance of ConnectionStrings. - /// Connection strings. - /// is null. - internal ConnectionStrings(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of ConnectionStrings. - /// Connection strings. - internal ConnectionStrings(IReadOnlyList value) - { - Value = value; - } - - /// Connection strings. - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionConnectionString.Serialization.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionConnectionString.Serialization.cs deleted file mode 100644 index a44a8f33e063..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionConnectionString.Serialization.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.SecurityCenter.Models -{ - public partial class IngestionConnectionString - { - internal static IngestionConnectionString DeserializeIngestionConnectionString(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional location = default; - Optional value = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("location"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("value"u8)) - { - value = property.Value.GetString(); - continue; - } - } - return new IngestionConnectionString(Optional.ToNullable(location), value.Value); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionConnectionString.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionConnectionString.cs deleted file mode 100644 index 0d22777349d8..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionConnectionString.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; - -namespace Azure.ResourceManager.SecurityCenter.Models -{ - /// Connection string for ingesting security data and logs. - public partial class IngestionConnectionString - { - /// Initializes a new instance of IngestionConnectionString. - internal IngestionConnectionString() - { - } - - /// Initializes a new instance of IngestionConnectionString. - /// The region where ingested logs and data resides. - /// Connection string value. - internal IngestionConnectionString(AzureLocation? location, string value) - { - Location = location; - Value = value; - } - - /// The region where ingested logs and data resides. - public AzureLocation? Location { get; } - /// Connection string value. - public string Value { get; } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingData.Serialization.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingData.Serialization.cs deleted file mode 100644 index 8084b2373c52..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingData.Serialization.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - public partial class IngestionSettingData : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Properties)) - { - writer.WritePropertyName("properties"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(Properties); -#else - JsonSerializer.Serialize(writer, JsonDocument.Parse(Properties.ToString()).RootElement); -#endif - } - writer.WriteEndObject(); - } - - internal static IngestionSettingData DeserializeIngestionSettingData(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional properties = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - Optional systemData = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - properties = BinaryData.FromString(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - } - return new IngestionSettingData(id, name, type, systemData.Value, properties.Value); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingList.Serialization.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingList.Serialization.cs deleted file mode 100644 index bb1a42e14f19..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingList.Serialization.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.SecurityCenter; - -namespace Azure.ResourceManager.SecurityCenter.Models -{ - internal partial class IngestionSettingList - { - internal static IngestionSettingList DeserializeIngestionSettingList(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional> value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(IngestionSettingData.DeserializeIngestionSettingData(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new IngestionSettingList(Optional.ToList(value), nextLink.Value); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingList.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingList.cs deleted file mode 100644 index 82922e251afb..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingList.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.SecurityCenter; - -namespace Azure.ResourceManager.SecurityCenter.Models -{ - /// List of ingestion settings. - internal partial class IngestionSettingList - { - /// Initializes a new instance of IngestionSettingList. - internal IngestionSettingList() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of IngestionSettingList. - /// List of ingestion settings. - /// The URI to fetch the next page. - internal IngestionSettingList(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// List of ingestion settings. - public IReadOnlyList Value { get; } - /// The URI to fetch the next page. - public string NextLink { get; } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingToken.Serialization.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingToken.Serialization.cs deleted file mode 100644 index fe17d5d2f593..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingToken.Serialization.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.SecurityCenter.Models -{ - public partial class IngestionSettingToken - { - internal static IngestionSettingToken DeserializeIngestionSettingToken(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional token = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("token"u8)) - { - token = property.Value.GetString(); - continue; - } - } - return new IngestionSettingToken(token.Value); - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingToken.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingToken.cs deleted file mode 100644 index 0111bba362d0..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/Models/IngestionSettingToken.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.SecurityCenter.Models -{ - /// Configures how to correlate scan data and logs with resources associated with the subscription. - public partial class IngestionSettingToken - { - /// Initializes a new instance of IngestionSettingToken. - internal IngestionSettingToken() - { - } - - /// Initializes a new instance of IngestionSettingToken. - /// The token is used for correlating security data and logs with the resources in the subscription. - internal IngestionSettingToken(string token) - { - Token = token; - } - - /// The token is used for correlating security data and logs with the resources in the subscription. - public string Token { get; } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RestOperations/IngestionSettingsRestOperations.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RestOperations/IngestionSettingsRestOperations.cs deleted file mode 100644 index c2e355b2f175..000000000000 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RestOperations/IngestionSettingsRestOperations.cs +++ /dev/null @@ -1,541 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.SecurityCenter.Models; - -namespace Azure.ResourceManager.SecurityCenter -{ - internal partial class IngestionSettingsRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of IngestionSettingsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public IngestionSettingsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-01-15-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal HttpMessage CreateListRequest(string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Security/ingestionSettings", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// Azure subscription ID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = IngestionSettingList.DeserializeIngestionSettingList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// Azure subscription ID. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response List(string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = IngestionSettingList.DeserializeIngestionSettingList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string ingestionSettingName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Security/ingestionSettings/", false); - uri.AppendPath(ingestionSettingName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var message = CreateGetRequest(subscriptionId, ingestionSettingName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = IngestionSettingData.DeserializeIngestionSettingData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((IngestionSettingData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var message = CreateGetRequest(subscriptionId, ingestionSettingName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = IngestionSettingData.DeserializeIngestionSettingData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((IngestionSettingData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCreateRequest(string subscriptionId, string ingestionSettingName, IngestionSettingData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Security/ingestionSettings/", false); - uri.AppendPath(ingestionSettingName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create setting for ingesting security data and logs to correlate with resources associated with the subscription. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// Ingestion setting object. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> CreateAsync(string subscriptionId, string ingestionSettingName, IngestionSettingData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, ingestionSettingName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = IngestionSettingData.DeserializeIngestionSettingData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create setting for ingesting security data and logs to correlate with resources associated with the subscription. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// Ingestion setting object. - /// The cancellation token to use. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string ingestionSettingName, IngestionSettingData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateRequest(subscriptionId, ingestionSettingName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = IngestionSettingData.DeserializeIngestionSettingData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string ingestionSettingName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Security/ingestionSettings/", false); - uri.AppendPath(ingestionSettingName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes the ingestion settings for this subscription. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var message = CreateDeleteRequest(subscriptionId, ingestionSettingName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes the ingestion settings for this subscription. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var message = CreateDeleteRequest(subscriptionId, ingestionSettingName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListTokensRequest(string subscriptionId, string ingestionSettingName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Security/ingestionSettings/", false); - uri.AppendPath(ingestionSettingName, true); - uri.AppendPath("/listTokens", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Returns the token that is used for correlating ingested telemetry with the resources in the subscription. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListTokensAsync(string subscriptionId, string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var message = CreateListTokensRequest(subscriptionId, ingestionSettingName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingToken value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = IngestionSettingToken.DeserializeIngestionSettingToken(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns the token that is used for correlating ingested telemetry with the resources in the subscription. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListTokens(string subscriptionId, string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var message = CreateListTokensRequest(subscriptionId, ingestionSettingName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingToken value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = IngestionSettingToken.DeserializeIngestionSettingToken(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListConnectionStringsRequest(string subscriptionId, string ingestionSettingName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Security/ingestionSettings/", false); - uri.AppendPath(ingestionSettingName, true); - uri.AppendPath("/listConnectionStrings", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Connection strings for ingesting security scan logs and data. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListConnectionStringsAsync(string subscriptionId, string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var message = CreateListConnectionStringsRequest(subscriptionId, ingestionSettingName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ConnectionStrings value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ConnectionStrings.DeserializeConnectionStrings(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Connection strings for ingesting security scan logs and data. - /// Azure subscription ID. - /// Name of the ingestion setting. - /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListConnectionStrings(string subscriptionId, string ingestionSettingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(ingestionSettingName, nameof(ingestionSettingName)); - - using var message = CreateListConnectionStringsRequest(subscriptionId, ingestionSettingName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ConnectionStrings value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ConnectionStrings.DeserializeConnectionStrings(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// The URL to the next page of results. - /// Azure subscription ID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingList value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = IngestionSettingList.DeserializeIngestionSettingList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Settings for ingesting security data and logs to correlate with resources associated with the subscription. - /// The URL to the next page of results. - /// Azure subscription ID. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - IngestionSettingList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = IngestionSettingList.DeserializeIngestionSettingList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/autorest.md b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/autorest.md index 5dca27fe03ea..0c0994e020f3 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/autorest.md +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: SecurityCenter namespace: Azure.ResourceManager.SecurityCenter -require: https://github.com/Azure/azure-rest-api-specs/blob/def187e2e78d7173d8fdd7f77740dd9719e1dfbf/specification/security/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/security/resource-manager/readme.md #tag: package-composite-v3 output-folder: $(this-folder)/Generated clear-output-folder: true