From 08c5b2ac2ee6b0feb899b68a337b72de7ab4c247 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 20 Sep 2024 15:32:48 -0700 Subject: [PATCH 01/17] Add generation of 2023-07-01-preview and new tests for dns resolver domain list and policy --- ...ourceManager.DnsResolver.netstandard2.0.cs | 370 +++++++ .../Generated/ArmDnsResolverModelFactory.cs | 122 +++ .../Generated/DnsForwardingRuleCollection.cs | 20 +- .../Generated/DnsForwardingRuleResource.cs | 12 +- .../DnsForwardingRulesetCollection.cs | 20 +- .../Generated/DnsForwardingRulesetResource.cs | 32 +- ...dingRulesetVirtualNetworkLinkCollection.cs | 20 +- ...ardingRulesetVirtualNetworkLinkResource.cs | 12 +- .../src/Generated/DnsResolverCollection.cs | 20 +- .../DnsResolverDomainListCollection.cs | 500 +++++++++ ...DnsResolverDomainListData.Serialization.cs | 284 ++++++ .../Generated/DnsResolverDomainListData.cs | 101 ++ ...esolverDomainListResource.Serialization.cs | 26 + .../DnsResolverDomainListResource.cs | 711 +++++++++++++ .../DnsResolverInboundEndpointCollection.cs | 20 +- .../DnsResolverInboundEndpointResource.cs | 24 +- .../DnsResolverOutboundEndpointCollection.cs | 20 +- .../DnsResolverOutboundEndpointResource.cs | 24 +- .../Generated/DnsResolverPolicyCollection.cs | 500 +++++++++ .../DnsResolverPolicyData.Serialization.cs | 265 +++++ .../src/Generated/DnsResolverPolicyData.cs | 91 ++ ...DnsResolverPolicyResource.Serialization.cs | 26 + .../Generated/DnsResolverPolicyResource.cs | 849 ++++++++++++++++ ...olverPolicyVirtualNetworkLinkCollection.cs | 499 +++++++++ ...icyVirtualNetworkLinkData.Serialization.cs | 259 +++++ ...DnsResolverPolicyVirtualNetworkLinkData.cs | 109 ++ ...irtualNetworkLinkResource.Serialization.cs | 26 + ...esolverPolicyVirtualNetworkLinkResource.cs | 711 +++++++++++++ .../src/Generated/DnsResolverResource.cs | 32 +- .../Generated/DnsSecurityRuleCollection.cs | 499 +++++++++ .../DnsSecurityRuleData.Serialization.cs | 303 ++++++ .../src/Generated/DnsSecurityRuleData.cs | 115 +++ .../DnsSecurityRuleResource.Serialization.cs | 26 + .../src/Generated/DnsSecurityRuleResource.cs | 711 +++++++++++++ .../Extensions/DnsResolverExtensions.cs | 426 +++++++- .../MockableDnsResolverArmClient.cs | 48 + ...ockableDnsResolverResourceGroupResource.cs | 146 ++- ...MockableDnsResolverSubscriptionResource.cs | 140 ++- .../DnsResolverDomainListOperationSource.cs | 38 + .../DnsResolverPolicyOperationSource.cs | 38 + ...PolicyVirtualNetworkLinkOperationSource.cs | 38 + .../DnsSecurityRuleOperationSource.cs | 38 + .../src/Generated/Models/ActionType.cs | 54 + .../src/Generated/Models/BlockResponseCode.cs | 48 + ...nsResolverDomainListPatch.Serialization.cs | 177 ++++ .../Models/DnsResolverDomainListPatch.cs | 71 ++ ...sResolverDomainListResult.Serialization.cs | 147 +++ .../Models/DnsResolverDomainListResult.cs | 70 ++ ...sResolverPolicyListResult.Serialization.cs | 147 +++ .../Models/DnsResolverPolicyListResult.cs | 70 ++ .../DnsResolverPolicyPatch.Serialization.cs | 137 +++ .../Models/DnsResolverPolicyPatch.cs | 66 ++ ...tualNetworkLinkListResult.Serialization.cs | 147 +++ ...olverPolicyVirtualNetworkLinkListResult.cs | 70 ++ ...cyVirtualNetworkLinkPatch.Serialization.cs | 137 +++ ...nsResolverPolicyVirtualNetworkLinkPatch.cs | 66 ++ .../DnsSecurityRuleAction.Serialization.cs | 141 +++ .../Generated/Models/DnsSecurityRuleAction.cs | 69 ++ ...DnsSecurityRuleListResult.Serialization.cs | 147 +++ .../Models/DnsSecurityRuleListResult.cs | 70 ++ .../DnsSecurityRulePatch.Serialization.cs | 229 +++++ .../Generated/Models/DnsSecurityRulePatch.cs | 84 ++ .../Generated/Models/DnsSecurityRuleState.cs | 51 + .../DnsForwardingRulesetsRestOperations.cs | 42 +- .../DnsResolverDomainListsRestOperations.cs | 771 ++++++++++++++ .../DnsResolverPoliciesRestOperations.cs | 949 ++++++++++++++++++ ...PolicyVirtualNetworkLinksRestOperations.cs | 649 ++++++++++++ .../DnsResolversRestOperations.cs | 42 +- .../DnsSecurityRulesRestOperations.cs | 649 ++++++++++++ .../ForwardingRulesRestOperations.cs | 26 +- .../InboundEndpointsRestOperations.cs | 26 +- .../OutboundEndpointsRestOperations.cs | 26 +- .../VirtualNetworkLinksRestOperations.cs | 26 +- .../VirtualNetworkDnsResolverResource.cs | 73 +- .../src/autorest.md | 2 +- .../tests/Tests/DnsResolverDomainListTests.cs | 103 ++ .../tests/Tests/DnsResolverPolicyTests.cs | 104 ++ .../tests/Tests/DnsResolverTests.cs | 1 - 78 files changed, 13714 insertions(+), 244 deletions(-) create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListCollection.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListResource.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListResource.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyCollection.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyResource.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyResource.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkCollection.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkResource.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkResource.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleCollection.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleResource.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleResource.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverDomainListOperationSource.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverPolicyOperationSource.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverPolicyVirtualNetworkLinkOperationSource.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsSecurityRuleOperationSource.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/BlockResponseCode.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.Serialization.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleState.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverDomainListsRestOperations.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverPoliciesRestOperations.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverPolicyVirtualNetworkLinksRestOperations.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsSecurityRulesRestOperations.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverDomainListTests.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverPolicyTests.cs diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs index 3243fd8ad87f3..db9b41b2b6b08 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs @@ -192,6 +192,61 @@ public DnsResolverData(Azure.Core.AzureLocation location, Azure.ResourceManager. string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class DnsResolverDomainListCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DnsResolverDomainListCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string dnsResolverDomainListName, Azure.ResourceManager.DnsResolver.DnsResolverDomainListData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string dnsResolverDomainListName, Azure.ResourceManager.DnsResolver.DnsResolverDomainListData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string dnsResolverDomainListName, 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 DnsResolverDomainListData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsResolverDomainListData(Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable domains) { } + public System.Collections.Generic.IList Domains { get { throw null; } } + public Azure.ETag? ETag { get { throw null; } } + public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } + public System.Guid? ResourceGuid { get { throw null; } } + Azure.ResourceManager.DnsResolver.DnsResolverDomainListData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.DnsResolverDomainListData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DnsResolverDomainListResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DnsResolverDomainListResource() { } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverDomainListData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, string ifMatch = null, 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.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DnsResolver.DnsResolverDomainListData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.DnsResolverDomainListData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverDomainListPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverDomainListPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public static partial class DnsResolverExtensions { public static Azure.ResourceManager.DnsResolver.DnsForwardingRuleResource GetDnsForwardingRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -204,12 +259,26 @@ public static partial class DnsResolverExtensions public static Azure.ResourceManager.DnsResolver.DnsForwardingRulesetVirtualNetworkLinkResource GetDnsForwardingRulesetVirtualNetworkLinkResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Response GetDnsResolver(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string dnsResolverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetDnsResolverAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string dnsResolverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDnsResolverDomainList(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDnsResolverDomainListAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsResolverDomainListResource GetDnsResolverDomainListResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsResolverDomainListCollection GetDnsResolverDomainLists(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDnsResolverDomainLists(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDnsResolverDomainListsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsResolverInboundEndpointResource GetDnsResolverInboundEndpointResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsResolverOutboundEndpointResource GetDnsResolverOutboundEndpointResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsResolverPolicyCollection GetDnsResolverPolicies(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDnsResolverPolicies(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDnsResolverPoliciesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetDnsResolverPolicy(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDnsResolverPolicyAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsResolverPolicyResource GetDnsResolverPolicyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkResource GetDnsResolverPolicyVirtualNetworkLinkResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsResolverResource GetDnsResolverResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsResolverCollection GetDnsResolvers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetDnsResolvers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetDnsResolversAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsSecurityRuleResource GetDnsSecurityRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.DnsResolver.VirtualNetworkDnsResolverResource GetVirtualNetworkDnsResolverResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } } public partial class DnsResolverInboundEndpointCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable @@ -322,6 +391,120 @@ protected DnsResolverOutboundEndpointResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverOutboundEndpointPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverOutboundEndpointPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class DnsResolverPolicyCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DnsResolverPolicyCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string dnsResolverPolicyName, Azure.ResourceManager.DnsResolver.DnsResolverPolicyData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string dnsResolverPolicyName, Azure.ResourceManager.DnsResolver.DnsResolverPolicyData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string dnsResolverPolicyName, 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 DnsResolverPolicyData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsResolverPolicyData(Azure.Core.AzureLocation location) { } + public Azure.ETag? ETag { get { throw null; } } + public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } + public System.Guid? ResourceGuid { get { throw null; } } + Azure.ResourceManager.DnsResolver.DnsResolverPolicyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.DnsResolverPolicyData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DnsResolverPolicyResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DnsResolverPolicyResource() { } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverPolicyData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, string ifMatch = null, 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.Response GetDnsResolverPolicyVirtualNetworkLink(string dnsResolverPolicyVirtualNetworkLinkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDnsResolverPolicyVirtualNetworkLinkAsync(string dnsResolverPolicyVirtualNetworkLinkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkCollection GetDnsResolverPolicyVirtualNetworkLinks() { throw null; } + public virtual Azure.Response GetDnsSecurityRule(string dnsSecurityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDnsSecurityRuleAsync(string dnsSecurityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsSecurityRuleCollection GetDnsSecurityRules() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DnsResolver.DnsResolverPolicyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.DnsResolverPolicyData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DnsResolverPolicyVirtualNetworkLinkCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DnsResolverPolicyVirtualNetworkLinkCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string dnsResolverPolicyVirtualNetworkLinkName, Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string dnsResolverPolicyVirtualNetworkLinkName, Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string dnsResolverPolicyVirtualNetworkLinkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string dnsResolverPolicyVirtualNetworkLinkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string dnsResolverPolicyVirtualNetworkLinkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string dnsResolverPolicyVirtualNetworkLinkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string dnsResolverPolicyVirtualNetworkLinkName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string dnsResolverPolicyVirtualNetworkLinkName, 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 DnsResolverPolicyVirtualNetworkLinkData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsResolverPolicyVirtualNetworkLinkData(Azure.Core.AzureLocation location, Azure.ResourceManager.Resources.Models.WritableSubResource virtualNetwork) { } + public Azure.ETag? ETag { get { throw null; } } + public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } + public Azure.Core.ResourceIdentifier VirtualNetworkId { get { throw null; } set { } } + Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DnsResolverPolicyVirtualNetworkLinkResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DnsResolverPolicyVirtualNetworkLinkResource() { } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, string ifMatch = null, 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.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyVirtualNetworkLinkPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyVirtualNetworkLinkPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class DnsResolverResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public static readonly Azure.Core.ResourceType ResourceType; @@ -353,12 +536,71 @@ protected DnsResolverResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsResolverPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class DnsSecurityRuleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DnsSecurityRuleCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string dnsSecurityRuleName, Azure.ResourceManager.DnsResolver.DnsSecurityRuleData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string dnsSecurityRuleName, Azure.ResourceManager.DnsResolver.DnsSecurityRuleData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string dnsSecurityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string dnsSecurityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string dnsSecurityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string dnsSecurityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string dnsSecurityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string dnsSecurityRuleName, 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 DnsSecurityRuleData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsSecurityRuleData(Azure.Core.AzureLocation location, int priority, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction action, System.Collections.Generic.IEnumerable dnsResolverDomainLists) { } + public Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction Action { get { throw null; } set { } } + public System.Collections.Generic.IList DnsResolverDomainLists { get { throw null; } } + public Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState? DnsSecurityRuleState { get { throw null; } set { } } + public Azure.ETag? ETag { get { throw null; } } + public int Priority { get { throw null; } set { } } + public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } + Azure.ResourceManager.DnsResolver.DnsSecurityRuleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.DnsSecurityRuleData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DnsSecurityRuleResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DnsSecurityRuleResource() { } + public virtual Azure.ResourceManager.DnsResolver.DnsSecurityRuleData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, string ifMatch = null, 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.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DnsResolver.DnsSecurityRuleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.DnsSecurityRuleData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRulePatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRulePatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class VirtualNetworkDnsResolverResource : Azure.ResourceManager.ArmResource { public static readonly Azure.Core.ResourceType ResourceType; protected VirtualNetworkDnsResolverResource() { } public virtual Azure.Pageable GetDnsForwardingRulesets(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDnsForwardingRulesetsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDnsResolverPoliciesByVirtualNetwork(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDnsResolverPoliciesByVirtualNetworkAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDnsResolvers(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDnsResolversAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } @@ -371,9 +613,13 @@ protected MockableDnsResolverArmClient() { } public virtual Azure.ResourceManager.DnsResolver.DnsForwardingRuleResource GetDnsForwardingRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.DnsResolver.DnsForwardingRulesetResource GetDnsForwardingRulesetResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.DnsResolver.DnsForwardingRulesetVirtualNetworkLinkResource GetDnsForwardingRulesetVirtualNetworkLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverDomainListResource GetDnsResolverDomainListResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.DnsResolver.DnsResolverInboundEndpointResource GetDnsResolverInboundEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.DnsResolver.DnsResolverOutboundEndpointResource GetDnsResolverOutboundEndpointResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverPolicyResource GetDnsResolverPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkResource GetDnsResolverPolicyVirtualNetworkLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.DnsResolver.DnsResolverResource GetDnsResolverResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsSecurityRuleResource GetDnsSecurityRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.DnsResolver.VirtualNetworkDnsResolverResource GetVirtualNetworkDnsResolverResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockableDnsResolverResourceGroupResource : Azure.ResourceManager.ArmResource @@ -384,6 +630,12 @@ protected MockableDnsResolverResourceGroupResource() { } public virtual Azure.ResourceManager.DnsResolver.DnsForwardingRulesetCollection GetDnsForwardingRulesets() { throw null; } public virtual Azure.Response GetDnsResolver(string dnsResolverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetDnsResolverAsync(string dnsResolverName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDnsResolverDomainList(string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDnsResolverDomainListAsync(string dnsResolverDomainListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverDomainListCollection GetDnsResolverDomainLists() { throw null; } + public virtual Azure.ResourceManager.DnsResolver.DnsResolverPolicyCollection GetDnsResolverPolicies() { throw null; } + public virtual Azure.Response GetDnsResolverPolicy(string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDnsResolverPolicyAsync(string dnsResolverPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.DnsResolver.DnsResolverCollection GetDnsResolvers() { throw null; } } public partial class MockableDnsResolverSubscriptionResource : Azure.ResourceManager.ArmResource @@ -391,22 +643,66 @@ public partial class MockableDnsResolverSubscriptionResource : Azure.ResourceMan protected MockableDnsResolverSubscriptionResource() { } public virtual Azure.Pageable GetDnsForwardingRulesets(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDnsForwardingRulesetsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDnsResolverDomainLists(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDnsResolverDomainListsAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDnsResolverPolicies(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDnsResolverPoliciesAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDnsResolvers(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDnsResolversAsync(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.DnsResolver.Models { + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ActionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ActionType(string value) { throw null; } + public static Azure.ResourceManager.DnsResolver.Models.ActionType Alert { get { throw null; } } + public static Azure.ResourceManager.DnsResolver.Models.ActionType Allow { get { throw null; } } + public static Azure.ResourceManager.DnsResolver.Models.ActionType Block { get { throw null; } } + public bool Equals(Azure.ResourceManager.DnsResolver.Models.ActionType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DnsResolver.Models.ActionType left, Azure.ResourceManager.DnsResolver.Models.ActionType right) { throw null; } + public static implicit operator Azure.ResourceManager.DnsResolver.Models.ActionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DnsResolver.Models.ActionType left, Azure.ResourceManager.DnsResolver.Models.ActionType right) { throw null; } + public override string ToString() { throw null; } + } public static partial class ArmDnsResolverModelFactory { public static Azure.ResourceManager.DnsResolver.DnsForwardingRuleData DnsForwardingRuleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), string domainName = null, System.Collections.Generic.IEnumerable targetDnsServers = null, System.Collections.Generic.IDictionary metadata = null, Azure.ResourceManager.DnsResolver.Models.DnsForwardingRuleState? dnsForwardingRuleState = default(Azure.ResourceManager.DnsResolver.Models.DnsForwardingRuleState?), Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?)) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsForwardingRulesetData DnsForwardingRulesetData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IEnumerable dnsResolverOutboundEndpoints = null, Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?), System.Guid? resourceGuid = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsForwardingRulesetVirtualNetworkLinkData DnsForwardingRulesetVirtualNetworkLinkData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), Azure.Core.ResourceIdentifier virtualNetworkId = null, System.Collections.Generic.IDictionary metadata = null, Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?)) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsResolverData DnsResolverData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ETag? etag = default(Azure.ETag?), Azure.Core.ResourceIdentifier virtualNetworkId = null, Azure.ResourceManager.DnsResolver.Models.DnsResolverState? dnsResolverState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverState?), Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?), System.Guid? resourceGuid = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsResolverDomainListData DnsResolverDomainListData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IEnumerable domains = null, Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?), System.Guid? resourceGuid = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsResolverInboundEndpointData DnsResolverInboundEndpointData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IEnumerable ipConfigurations = null, Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?), System.Guid? resourceGuid = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.DnsResolver.DnsResolverOutboundEndpointData DnsResolverOutboundEndpointData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ETag? etag = default(Azure.ETag?), Azure.Core.ResourceIdentifier subnetId = null, Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?), System.Guid? resourceGuid = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsResolverPolicyData DnsResolverPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ETag? etag = default(Azure.ETag?), Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?), System.Guid? resourceGuid = default(System.Guid?)) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData DnsResolverPolicyVirtualNetworkLinkData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ETag? etag = default(Azure.ETag?), Azure.Core.ResourceIdentifier virtualNetworkId = null, Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DnsResolver.DnsSecurityRuleData DnsSecurityRuleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ETag? etag = default(Azure.ETag?), int priority = 0, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction action = null, System.Collections.Generic.IEnumerable dnsResolverDomainLists = null, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState? dnsSecurityRuleState = default(Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState?), Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?)) { throw null; } public static Azure.ResourceManager.DnsResolver.Models.VirtualNetworkDnsForwardingRuleset VirtualNetworkDnsForwardingRuleset(Azure.Core.ResourceIdentifier id = null, Azure.Core.ResourceIdentifier virtualNetworkLinkId = null) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct BlockResponseCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public BlockResponseCode(string value) { throw null; } + public static Azure.ResourceManager.DnsResolver.Models.BlockResponseCode Servfail { get { throw null; } } + public bool Equals(Azure.ResourceManager.DnsResolver.Models.BlockResponseCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DnsResolver.Models.BlockResponseCode left, Azure.ResourceManager.DnsResolver.Models.BlockResponseCode right) { throw null; } + public static implicit operator Azure.ResourceManager.DnsResolver.Models.BlockResponseCode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DnsResolver.Models.BlockResponseCode left, Azure.ResourceManager.DnsResolver.Models.BlockResponseCode right) { throw null; } + public override string ToString() { throw null; } + } public partial class DnsForwardingRulePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DnsForwardingRulePatch() { } @@ -458,6 +754,17 @@ public DnsForwardingRulesetVirtualNetworkLinkPatch() { } public static bool operator !=(Azure.ResourceManager.DnsResolver.Models.DnsForwardingRuleState left, Azure.ResourceManager.DnsResolver.Models.DnsForwardingRuleState right) { throw null; } public override string ToString() { throw null; } } + public partial class DnsResolverDomainListPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsResolverDomainListPatch() { } + public System.Collections.Generic.IList Domains { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + Azure.ResourceManager.DnsResolver.Models.DnsResolverDomainListPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.Models.DnsResolverDomainListPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class DnsResolverInboundEndpointPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DnsResolverInboundEndpointPatch() { } @@ -488,6 +795,26 @@ public DnsResolverPatch() { } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class DnsResolverPolicyPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsResolverPolicyPatch() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DnsResolverPolicyVirtualNetworkLinkPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsResolverPolicyVirtualNetworkLinkPatch() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyVirtualNetworkLinkPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyVirtualNetworkLinkPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DnsResolverProvisioningState : System.IEquatable { @@ -528,6 +855,49 @@ public DnsResolverPatch() { } public static bool operator !=(Azure.ResourceManager.DnsResolver.Models.DnsResolverState left, Azure.ResourceManager.DnsResolver.Models.DnsResolverState right) { throw null; } public override string ToString() { throw null; } } + public partial class DnsSecurityRuleAction : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsSecurityRuleAction() { } + public Azure.ResourceManager.DnsResolver.Models.ActionType? ActionType { get { throw null; } set { } } + public Azure.ResourceManager.DnsResolver.Models.BlockResponseCode? BlockResponseCode { get { throw null; } set { } } + Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DnsSecurityRulePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DnsSecurityRulePatch() { } + public Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction Action { get { throw null; } set { } } + public System.Collections.Generic.IList DnsResolverDomainLists { get { throw null; } } + public Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState? DnsSecurityRuleState { get { throw null; } set { } } + public int? Priority { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + Azure.ResourceManager.DnsResolver.Models.DnsSecurityRulePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DnsResolver.Models.DnsSecurityRulePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DnsSecurityRuleState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DnsSecurityRuleState(string value) { throw null; } + public static Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState Disabled { get { throw null; } } + public static Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState left, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState right) { throw null; } + public static implicit operator Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState left, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct InboundEndpointIPAllocationMethod : System.IEquatable { diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/ArmDnsResolverModelFactory.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/ArmDnsResolverModelFactory.cs index 20baf4eaf4770..36d2fc4a724d6 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/ArmDnsResolverModelFactory.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/ArmDnsResolverModelFactory.cs @@ -206,5 +206,127 @@ public static VirtualNetworkDnsForwardingRuleset VirtualNetworkDnsForwardingRule { return new VirtualNetworkDnsForwardingRuleset(id, virtualNetworkLinkId != null ? ResourceManagerModelFactory.WritableSubResource(virtualNetworkLinkId) : null, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ETag of the DNS resolver policy. + /// The current provisioning state of the DNS resolver policy. This is a read-only property and any attempt to set this value will be ignored. + /// The resourceGuid property of the DNS resolver policy resource. + /// A new instance for mocking. + public static DnsResolverPolicyData DnsResolverPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, DnsResolverProvisioningState? provisioningState = null, Guid? resourceGuid = null) + { + tags ??= new Dictionary(); + + return new DnsResolverPolicyData( + id, + name, + resourceType, + systemData, + tags, + location, + etag, + provisioningState, + resourceGuid, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ETag of the DNS security rule. + /// The priority of the DNS security rule. + /// The action to take on DNS requests that match the DNS security rule. + /// DNS resolver policy domains lists that the DNS security rule applies to. + /// The state of DNS security rule. + /// The current provisioning state of the DNS security rule. This is a read-only property and any attempt to set this value will be ignored. + /// A new instance for mocking. + public static DnsSecurityRuleData DnsSecurityRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, int priority = default, DnsSecurityRuleAction action = null, IEnumerable dnsResolverDomainLists = null, DnsSecurityRuleState? dnsSecurityRuleState = null, DnsResolverProvisioningState? provisioningState = null) + { + tags ??= new Dictionary(); + dnsResolverDomainLists ??= new List(); + + return new DnsSecurityRuleData( + id, + name, + resourceType, + systemData, + tags, + location, + etag, + priority, + action, + dnsResolverDomainLists?.ToList(), + dnsSecurityRuleState, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ETag of the DNS resolver policy virtual network link. + /// The reference to the virtual network. This cannot be changed after creation. + /// The current provisioning state of the DNS resolver policy virtual network link. This is a read-only property and any attempt to set this value will be ignored. + /// A new instance for mocking. + public static DnsResolverPolicyVirtualNetworkLinkData DnsResolverPolicyVirtualNetworkLinkData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ResourceIdentifier virtualNetworkId = null, DnsResolverProvisioningState? provisioningState = null) + { + tags ??= new Dictionary(); + + return new DnsResolverPolicyVirtualNetworkLinkData( + id, + name, + resourceType, + systemData, + tags, + location, + etag, + virtualNetworkId != null ? ResourceManagerModelFactory.WritableSubResource(virtualNetworkId) : null, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ETag of the DNS resolver domain list. + /// The domains in the domain list. + /// The current provisioning state of the DNS resolver domain list. This is a read-only property and any attempt to set this value will be ignored. + /// The resourceGuid property of the DNS resolver domain list resource. + /// A new instance for mocking. + public static DnsResolverDomainListData DnsResolverDomainListData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, IEnumerable domains = null, DnsResolverProvisioningState? provisioningState = null, Guid? resourceGuid = null) + { + tags ??= new Dictionary(); + domains ??= new List(); + + return new DnsResolverDomainListData( + id, + name, + resourceType, + systemData, + tags, + location, + etag, + domains?.ToList(), + provisioningState, + resourceGuid, + serializedAdditionalRawData: null); + } } } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleCollection.cs index 38cf093d20dcc..266f588287075 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -117,7 +117,7 @@ public virtual async Task> CreateOrUpdat /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -170,7 +170,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -215,7 +215,7 @@ public virtual async Task> GetAsync(string f /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -260,7 +260,7 @@ public virtual Response Get(string forwardingRuleName /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -291,7 +291,7 @@ public virtual AsyncPageable GetAllAsync(int? top = n /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -322,7 +322,7 @@ public virtual Pageable GetAll(int? top = null, Cance /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string forwardingRuleName, /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -408,7 +408,7 @@ public virtual Response Exists(string forwardingRuleName, CancellationToke /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -453,7 +453,7 @@ public virtual async Task> GetIfExis /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleResource.cs index 255d66a374968..ffb498cb8c032 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRuleResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancella /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancell /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -227,7 +227,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, string /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -272,7 +272,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, C /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -315,7 +315,7 @@ public virtual async Task> UpdateAsync(DnsFo /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetCollection.cs index 35d55eb3b0a16..3d9789adba844 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUp /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(strin /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string rulesetName, Ca /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -288,7 +288,7 @@ public virtual AsyncPageable GetAllAsync(int? top /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -319,7 +319,7 @@ public virtual Pageable GetAll(int? top = null, Ca /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -362,7 +362,7 @@ public virtual async Task> ExistsAsync(string rulesetName, Cancel /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -405,7 +405,7 @@ public virtual Response Exists(string rulesetName, CancellationToken cance /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -450,7 +450,7 @@ public virtual async Task> GetIfE /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs index 8cf88a71468ba..d0dbc6c3e84de 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs @@ -110,7 +110,7 @@ public virtual DnsForwardingRuleCollection GetDnsForwardingRules() /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetDnsForwardingR /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -179,7 +179,7 @@ public virtual DnsForwardingRulesetVirtualNetworkLinkCollection GetDnsForwarding /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -210,7 +210,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -241,7 +241,7 @@ public virtual Response GetDnsFo /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -281,7 +281,7 @@ public virtual async Task> GetAsync(Cance /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -321,7 +321,7 @@ public virtual Response Get(CancellationToken canc /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -364,7 +364,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, string /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -407,7 +407,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, C /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task> UpdateAsyn /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -501,7 +501,7 @@ public virtual ArmOperation Update(WaitUntil waitU /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -563,7 +563,7 @@ public virtual async Task> AddTagAsync(st /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -625,7 +625,7 @@ public virtual Response AddTag(string key, string /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -682,7 +682,7 @@ public virtual async Task> SetTagsAsync(I /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -739,7 +739,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -799,7 +799,7 @@ public virtual async Task> RemoveTagAsync /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkCollection.cs index cfa0284731721..0c410059b1e15 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation Crea /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(stri /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -287,7 +287,7 @@ public virtual AsyncPageable Get /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -318,7 +318,7 @@ public virtual Pageable GetAll(i /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -361,7 +361,7 @@ public virtual async Task> ExistsAsync(string virtualNetworkLinkN /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -404,7 +404,7 @@ public virtual Response Exists(string virtualNetworkLinkName, Cancellation /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -449,7 +449,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkResource.cs index b9f576b570e7a..8fb7d95eea616 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetVirtualNetworkLinkResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(Canc /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, string /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -268,7 +268,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, C /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -315,7 +315,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverCollection.cs index 3ed1b2761c731..9e47260b6d33b 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdateAsync /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUn /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string dnsReso /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string dnsResolverName, Cancell /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -288,7 +288,7 @@ public virtual AsyncPageable GetAllAsync(int? top = null, C /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -319,7 +319,7 @@ public virtual Pageable GetAll(int? top = null, Cancellatio /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -362,7 +362,7 @@ public virtual async Task> ExistsAsync(string dnsResolverName, Ca /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -405,7 +405,7 @@ public virtual Response Exists(string dnsResolverName, CancellationToken c /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -450,7 +450,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListCollection.cs new file mode 100644 index 0000000000000..6bd5bc5f2eea4 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListCollection.cs @@ -0,0 +1,500 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDnsResolverDomainLists method from an instance of . + /// + public partial class DnsResolverDomainListCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dnsResolverDomainListClientDiagnostics; + private readonly DnsResolverDomainListsRestOperations _dnsResolverDomainListRestClient; + + /// Initializes a new instance of the class for mocking. + protected DnsResolverDomainListCollection() + { + } + + /// 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 DnsResolverDomainListCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsResolverDomainListClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsResolverDomainListResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DnsResolverDomainListResource.ResourceType, out string dnsResolverDomainListApiVersion); + _dnsResolverDomainListRestClient = new DnsResolverDomainListsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsResolverDomainListApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 name of the DNS resolver domain list. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// 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 dnsResolverDomainListName, DnsResolverDomainListData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dnsResolverDomainListRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(new DnsResolverDomainListOperationSource(Client), _dnsResolverDomainListClientDiagnostics, Pipeline, _dnsResolverDomainListRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 name of the DNS resolver domain list. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// 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 dnsResolverDomainListName, DnsResolverDomainListData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dnsResolverDomainListRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DnsResolverArmOperation(new DnsResolverDomainListOperationSource(Client), _dnsResolverDomainListClientDiagnostics, Pipeline, _dnsResolverDomainListRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListCollection.Get"); + scope.Start(); + try + { + var response = await _dnsResolverDomainListRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverDomainListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListCollection.Get"); + scope.Start(); + try + { + var response = _dnsResolverDomainListRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverDomainListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists DNS resolver domain lists within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists + /// + /// + /// Operation Id + /// DnsResolverDomainLists_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsResolverDomainListRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsResolverDomainListRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsResolverDomainListResource(Client, DnsResolverDomainListData.DeserializeDnsResolverDomainListData(e)), _dnsResolverDomainListClientDiagnostics, Pipeline, "DnsResolverDomainListCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS resolver domain lists within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists + /// + /// + /// Operation Id + /// DnsResolverDomainLists_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsResolverDomainListRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsResolverDomainListRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsResolverDomainListResource(Client, DnsResolverDomainListData.DeserializeDnsResolverDomainListData(e)), _dnsResolverDomainListClientDiagnostics, Pipeline, "DnsResolverDomainListCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListCollection.Exists"); + scope.Start(); + try + { + var response = await _dnsResolverDomainListRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListCollection.Exists"); + scope.Start(); + try + { + var response = _dnsResolverDomainListRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsResolverDomainListRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverDomainListResource(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsResolverDomainListRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverDomainListName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverDomainListResource(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/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.Serialization.cs new file mode 100644 index 0000000000000..a0ef0029de7b9 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.Serialization.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + public partial class DnsResolverDomainListData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverDomainListData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("domains"u8); + writer.WriteStartArray(); + foreach (var item in Domains) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ResourceGuid)) + { + writer.WritePropertyName("resourceGuid"u8); + writer.WriteStringValue(ResourceGuid.Value); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverDomainListData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverDomainListData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverDomainListData(document.RootElement, options); + } + + internal static DnsResolverDomainListData DeserializeDnsResolverDomainListData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IList domains = default; + DnsResolverProvisioningState? provisioningState = default; + Guid? resourceGuid = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + 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; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("domains"u8)) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + domains = array; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DnsResolverProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("resourceGuid"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceGuid = property0.Value.GetGuid(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverDomainListData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + etag, + domains, + provisioningState, + resourceGuid, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverDomainListData)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverDomainListData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverDomainListData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverDomainListData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.cs new file mode 100644 index 0000000000000..b911f6de43a26 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.cs @@ -0,0 +1,101 @@ +// 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; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A class representing the DnsResolverDomainList data model. + /// Describes a DNS resolver domain list. + /// + public partial class DnsResolverDomainListData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + /// The domains in the domain list. + /// is null. + public DnsResolverDomainListData(AzureLocation location, IEnumerable domains) : base(location) + { + Argument.AssertNotNull(domains, nameof(domains)); + + Domains = domains.ToList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ETag of the DNS resolver domain list. + /// The domains in the domain list. + /// The current provisioning state of the DNS resolver domain list. This is a read-only property and any attempt to set this value will be ignored. + /// The resourceGuid property of the DNS resolver domain list resource. + /// Keeps track of any properties unknown to the library. + internal DnsResolverDomainListData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, IList domains, DnsResolverProvisioningState? provisioningState, Guid? resourceGuid, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + ETag = etag; + Domains = domains; + ProvisioningState = provisioningState; + ResourceGuid = resourceGuid; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DnsResolverDomainListData() + { + } + + /// ETag of the DNS resolver domain list. + public ETag? ETag { get; } + /// The domains in the domain list. + public IList Domains { get; } + /// The current provisioning state of the DNS resolver domain list. This is a read-only property and any attempt to set this value will be ignored. + public DnsResolverProvisioningState? ProvisioningState { get; } + /// The resourceGuid property of the DNS resolver domain list resource. + public Guid? ResourceGuid { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListResource.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListResource.Serialization.cs new file mode 100644 index 0000000000000..8e232c955a9c1 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DnsResolver +{ + public partial class DnsResolverDomainListResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DnsResolverDomainListData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DnsResolverDomainListData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListResource.cs new file mode 100644 index 0000000000000..6861574160d1e --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListResource.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A Class representing a DnsResolverDomainList along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDnsResolverDomainListResource method. + /// Otherwise you can get one from its parent resource using the GetDnsResolverDomainList method. + /// + public partial class DnsResolverDomainListResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dnsResolverDomainListName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dnsResolverDomainListClientDiagnostics; + private readonly DnsResolverDomainListsRestOperations _dnsResolverDomainListRestClient; + private readonly DnsResolverDomainListData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Network/dnsResolverDomainLists"; + + /// Initializes a new instance of the class for mocking. + protected DnsResolverDomainListResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DnsResolverDomainListResource(ArmClient client, DnsResolverDomainListData 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 DnsResolverDomainListResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsResolverDomainListClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dnsResolverDomainListApiVersion); + _dnsResolverDomainListRestClient = new DnsResolverDomainListsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsResolverDomainListApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 DnsResolverDomainListData 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)); + } + + /// + /// Gets properties of a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.Get"); + scope.Start(); + try + { + var response = await _dnsResolverDomainListRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverDomainListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.Get"); + scope.Start(); + try + { + var response = _dnsResolverDomainListRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverDomainListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a DNS resolver domain list. WARNING: This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Delete + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.Delete"); + scope.Start(); + try + { + var response = await _dnsResolverDomainListRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(_dnsResolverDomainListClientDiagnostics, Pipeline, _dnsResolverDomainListRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a DNS resolver domain list. WARNING: This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Delete + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.Delete"); + scope.Start(); + try + { + var response = _dnsResolverDomainListRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken); + var operation = new DnsResolverArmOperation(_dnsResolverDomainListClientDiagnostics, Pipeline, _dnsResolverDomainListRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Update + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DnsResolverDomainListPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.Update"); + scope.Start(); + try + { + var response = await _dnsResolverDomainListRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(new DnsResolverDomainListOperationSource(Client), _dnsResolverDomainListClientDiagnostics, Pipeline, _dnsResolverDomainListRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Update + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DnsResolverDomainListPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.Update"); + scope.Start(); + try + { + var response = _dnsResolverDomainListRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken); + var operation = new DnsResolverArmOperation(new DnsResolverDomainListOperationSource(Client), _dnsResolverDomainListClientDiagnostics, Pipeline, _dnsResolverDomainListRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverDomainListRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverDomainListResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverDomainListPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverDomainListRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverDomainListResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverDomainListPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverDomainListRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverDomainListResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverDomainListPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverDomainListRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverDomainListResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverDomainListPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverDomainListRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverDomainListResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverDomainListPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dnsResolverDomainListClientDiagnostics.CreateScope("DnsResolverDomainListResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverDomainListRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverDomainListResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverDomainListPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointCollection.cs index a40a0fafd2edc..f8c3a4eb5aab6 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> Crea /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(W /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string inboundEn /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -287,7 +287,7 @@ public virtual AsyncPageable GetAllAsync(int /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -318,7 +318,7 @@ public virtual Pageable GetAll(int? top = nu /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -361,7 +361,7 @@ public virtual async Task> ExistsAsync(string inboundEndpointName /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -404,7 +404,7 @@ public virtual Response Exists(string inboundEndpointName, CancellationTok /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -449,7 +449,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointResource.cs index d6e926b3280da..c5756885bdb67 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverInboundEndpointResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsync /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationToke /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, string /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -269,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, C /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -316,7 +316,7 @@ public virtual async Task> Upda /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -363,7 +363,7 @@ public virtual ArmOperation Update(WaitUntil /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -425,7 +425,7 @@ public virtual async Task> AddTagAs /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -487,7 +487,7 @@ public virtual Response AddTag(string key, s /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -544,7 +544,7 @@ public virtual async Task> SetTagsA /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -601,7 +601,7 @@ public virtual Response SetTags(IDictionary< /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -661,7 +661,7 @@ public virtual async Task> RemoveTa /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointCollection.cs index a88d29679a784..035d84c40b95e 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointCollection.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> Cre /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate( /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsyn /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string outbound /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -287,7 +287,7 @@ public virtual AsyncPageable GetAllAsync(in /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -318,7 +318,7 @@ public virtual Pageable GetAll(int? top = n /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -361,7 +361,7 @@ public virtual async Task> ExistsAsync(string outboundEndpointNam /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -404,7 +404,7 @@ public virtual Response Exists(string outboundEndpointName, CancellationTo /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -449,7 +449,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointResource.cs index 1727135387985..fc91a12b44a2a 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverOutboundEndpointResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsyn /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationTok /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, string /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -269,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, C /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -316,7 +316,7 @@ public virtual async Task> Upd /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -363,7 +363,7 @@ public virtual ArmOperation Update(WaitUnti /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -425,7 +425,7 @@ public virtual async Task> AddTagA /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -487,7 +487,7 @@ public virtual Response AddTag(string key, /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -544,7 +544,7 @@ public virtual async Task> SetTags /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -601,7 +601,7 @@ public virtual Response SetTags(IDictionary /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -661,7 +661,7 @@ public virtual async Task> RemoveT /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyCollection.cs new file mode 100644 index 0000000000000..42bf813d68c1f --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyCollection.cs @@ -0,0 +1,500 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDnsResolverPolicies method from an instance of . + /// + public partial class DnsResolverPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dnsResolverPolicyClientDiagnostics; + private readonly DnsResolverPoliciesRestOperations _dnsResolverPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected DnsResolverPolicyCollection() + { + } + + /// 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 DnsResolverPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsResolverPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsResolverPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DnsResolverPolicyResource.ResourceType, out string dnsResolverPolicyApiVersion); + _dnsResolverPolicyRestClient = new DnsResolverPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsResolverPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 name of the DNS resolver policy. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// 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 dnsResolverPolicyName, DnsResolverPolicyData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(new DnsResolverPolicyOperationSource(Client), _dnsResolverPolicyClientDiagnostics, Pipeline, _dnsResolverPolicyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 name of the DNS resolver policy. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// 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 dnsResolverPolicyName, DnsResolverPolicyData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dnsResolverPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DnsResolverArmOperation(new DnsResolverPolicyOperationSource(Client), _dnsResolverPolicyClientDiagnostics, Pipeline, _dnsResolverPolicyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyCollection.Get"); + scope.Start(); + try + { + var response = _dnsResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists DNS resolver policies within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies + /// + /// + /// Operation Id + /// DnsResolverPolicies_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsResolverPolicyRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsResolverPolicyRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsResolverPolicyResource(Client, DnsResolverPolicyData.DeserializeDnsResolverPolicyData(e)), _dnsResolverPolicyClientDiagnostics, Pipeline, "DnsResolverPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS resolver policies within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies + /// + /// + /// Operation Id + /// DnsResolverPolicies_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsResolverPolicyRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsResolverPolicyRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsResolverPolicyResource(Client, DnsResolverPolicyData.DeserializeDnsResolverPolicyData(e)), _dnsResolverPolicyClientDiagnostics, Pipeline, "DnsResolverPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _dnsResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyResource(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, dnsResolverPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyResource(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/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.Serialization.cs new file mode 100644 index 0000000000000..64ba64c1345a9 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.Serialization.cs @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + public partial class DnsResolverPolicyData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ResourceGuid)) + { + writer.WritePropertyName("resourceGuid"u8); + writer.WriteStringValue(ResourceGuid.Value); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverPolicyData(document.RootElement, options); + } + + internal static DnsResolverPolicyData DeserializeDnsResolverPolicyData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + DnsResolverProvisioningState? provisioningState = default; + Guid? resourceGuid = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + 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; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DnsResolverProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("resourceGuid"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceGuid = property0.Value.GetGuid(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverPolicyData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + etag, + provisioningState, + resourceGuid, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyData)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverPolicyData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.cs new file mode 100644 index 0000000000000..c8c4f9e9923fb --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A class representing the DnsResolverPolicy data model. + /// Describes a DNS resolver policy. + /// + public partial class DnsResolverPolicyData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public DnsResolverPolicyData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ETag of the DNS resolver policy. + /// The current provisioning state of the DNS resolver policy. This is a read-only property and any attempt to set this value will be ignored. + /// The resourceGuid property of the DNS resolver policy resource. + /// Keeps track of any properties unknown to the library. + internal DnsResolverPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, DnsResolverProvisioningState? provisioningState, Guid? resourceGuid, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + ETag = etag; + ProvisioningState = provisioningState; + ResourceGuid = resourceGuid; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DnsResolverPolicyData() + { + } + + /// ETag of the DNS resolver policy. + public ETag? ETag { get; } + /// The current provisioning state of the DNS resolver policy. This is a read-only property and any attempt to set this value will be ignored. + public DnsResolverProvisioningState? ProvisioningState { get; } + /// The resourceGuid property of the DNS resolver policy resource. + public Guid? ResourceGuid { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyResource.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyResource.Serialization.cs new file mode 100644 index 0000000000000..63a7d0797309d --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DnsResolver +{ + public partial class DnsResolverPolicyResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DnsResolverPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DnsResolverPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyResource.cs new file mode 100644 index 0000000000000..143ac6b4ff7a5 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyResource.cs @@ -0,0 +1,849 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A Class representing a DnsResolverPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDnsResolverPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetDnsResolverPolicy method. + /// + public partial class DnsResolverPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dnsResolverPolicyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dnsResolverPolicyClientDiagnostics; + private readonly DnsResolverPoliciesRestOperations _dnsResolverPolicyRestClient; + private readonly DnsResolverPolicyData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Network/dnsResolverPolicies"; + + /// Initializes a new instance of the class for mocking. + protected DnsResolverPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DnsResolverPolicyResource(ArmClient client, DnsResolverPolicyData 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 DnsResolverPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsResolverPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dnsResolverPolicyApiVersion); + _dnsResolverPolicyRestClient = new DnsResolverPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsResolverPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 DnsResolverPolicyData 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)); + } + + /// Gets a collection of DnsSecurityRuleResources in the DnsResolverPolicy. + /// An object representing collection of DnsSecurityRuleResources and their operations over a DnsSecurityRuleResource. + public virtual DnsSecurityRuleCollection GetDnsSecurityRules() + { + return GetCachedClient(client => new DnsSecurityRuleCollection(client, Id)); + } + + /// + /// Gets properties of a DNS security rule for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS security rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDnsSecurityRuleAsync(string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + return await GetDnsSecurityRules().GetAsync(dnsSecurityRuleName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a DNS security rule for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS security rule. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDnsSecurityRule(string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + return GetDnsSecurityRules().Get(dnsSecurityRuleName, cancellationToken); + } + + /// Gets a collection of DnsResolverPolicyVirtualNetworkLinkResources in the DnsResolverPolicy. + /// An object representing collection of DnsResolverPolicyVirtualNetworkLinkResources and their operations over a DnsResolverPolicyVirtualNetworkLinkResource. + public virtual DnsResolverPolicyVirtualNetworkLinkCollection GetDnsResolverPolicyVirtualNetworkLinks() + { + return GetCachedClient(client => new DnsResolverPolicyVirtualNetworkLinkCollection(client, Id)); + } + + /// + /// Gets properties of a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDnsResolverPolicyVirtualNetworkLinkAsync(string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + return await GetDnsResolverPolicyVirtualNetworkLinks().GetAsync(dnsResolverPolicyVirtualNetworkLinkName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDnsResolverPolicyVirtualNetworkLink(string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + return GetDnsResolverPolicyVirtualNetworkLinks().Get(dnsResolverPolicyVirtualNetworkLinkName, cancellationToken); + } + + /// + /// Gets properties of a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.Get"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.Get"); + scope.Start(); + try + { + var response = _dnsResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a DNS resolver policy. WARNING: This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Delete + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(_dnsResolverPolicyClientDiagnostics, Pipeline, _dnsResolverPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a DNS resolver policy. WARNING: This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Delete + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.Delete"); + scope.Start(); + try + { + var response = _dnsResolverPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken); + var operation = new DnsResolverArmOperation(_dnsResolverPolicyClientDiagnostics, Pipeline, _dnsResolverPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Update + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DnsResolverPolicyPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.Update"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(new DnsResolverPolicyOperationSource(Client), _dnsResolverPolicyClientDiagnostics, Pipeline, _dnsResolverPolicyRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Update + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DnsResolverPolicyPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.Update"); + scope.Start(); + try + { + var response = _dnsResolverPolicyRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken); + var operation = new DnsResolverArmOperation(new DnsResolverPolicyOperationSource(Client), _dnsResolverPolicyClientDiagnostics, Pipeline, _dnsResolverPolicyRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverPolicyPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverPolicyPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverPolicyPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverPolicyPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverPolicyPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dnsResolverPolicyClientDiagnostics.CreateScope("DnsResolverPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverPolicyPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkCollection.cs new file mode 100644 index 0000000000000..02f37e6b36141 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkCollection.cs @@ -0,0 +1,499 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDnsResolverPolicyVirtualNetworkLinks method from an instance of . + /// + public partial class DnsResolverPolicyVirtualNetworkLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics; + private readonly DnsResolverPolicyVirtualNetworkLinksRestOperations _dnsResolverPolicyVirtualNetworkLinkRestClient; + + /// Initializes a new instance of the class for mocking. + protected DnsResolverPolicyVirtualNetworkLinkCollection() + { + } + + /// 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 DnsResolverPolicyVirtualNetworkLinkCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsResolverPolicyVirtualNetworkLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DnsResolverPolicyVirtualNetworkLinkResource.ResourceType, out string dnsResolverPolicyVirtualNetworkLinkApiVersion); + _dnsResolverPolicyVirtualNetworkLinkRestClient = new DnsResolverPolicyVirtualNetworkLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsResolverPolicyVirtualNetworkLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DnsResolverPolicyResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DnsResolverPolicyResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// 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 dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(new DnsResolverPolicyVirtualNetworkLinkOperationSource(Client), _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics, Pipeline, _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// 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 dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DnsResolverArmOperation(new DnsResolverPolicyVirtualNetworkLinkOperationSource(Client), _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics, Pipeline, _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkCollection.Get"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyVirtualNetworkLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkCollection.Get"); + scope.Start(); + try + { + var response = _dnsResolverPolicyVirtualNetworkLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists DNS resolver policy virtual network links. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsResolverPolicyVirtualNetworkLinkResource(Client, DnsResolverPolicyVirtualNetworkLinkData.DeserializeDnsResolverPolicyVirtualNetworkLinkData(e)), _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics, Pipeline, "DnsResolverPolicyVirtualNetworkLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS resolver policy virtual network links. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsResolverPolicyVirtualNetworkLinkResource(Client, DnsResolverPolicyVirtualNetworkLinkData.DeserializeDnsResolverPolicyVirtualNetworkLinkData(e)), _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics, Pipeline, "DnsResolverPolicyVirtualNetworkLinkCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkCollection.Exists"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyVirtualNetworkLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkCollection.Exists"); + scope.Start(); + try + { + var response = _dnsResolverPolicyVirtualNetworkLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyVirtualNetworkLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsResolverPolicyVirtualNetworkLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsResolverPolicyVirtualNetworkLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(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/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.Serialization.cs new file mode 100644 index 0000000000000..8d8cddb23c610 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.Serialization.cs @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + public partial class DnsResolverPolicyVirtualNetworkLinkData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("virtualNetwork"u8); + JsonSerializer.Serialize(writer, VirtualNetwork); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverPolicyVirtualNetworkLinkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverPolicyVirtualNetworkLinkData(document.RootElement, options); + } + + internal static DnsResolverPolicyVirtualNetworkLinkData DeserializeDnsResolverPolicyVirtualNetworkLinkData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + WritableSubResource virtualNetwork = default; + DnsResolverProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + 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; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("virtualNetwork"u8)) + { + virtualNetwork = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DnsResolverProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverPolicyVirtualNetworkLinkData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + etag, + virtualNetwork, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkData)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverPolicyVirtualNetworkLinkData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverPolicyVirtualNetworkLinkData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.cs new file mode 100644 index 0000000000000..be6cc28f570c7 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A class representing the DnsResolverPolicyVirtualNetworkLink data model. + /// Describes a DNS resolver policy virtual network link. + /// + public partial class DnsResolverPolicyVirtualNetworkLinkData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + /// The reference to the virtual network. This cannot be changed after creation. + /// is null. + public DnsResolverPolicyVirtualNetworkLinkData(AzureLocation location, WritableSubResource virtualNetwork) : base(location) + { + Argument.AssertNotNull(virtualNetwork, nameof(virtualNetwork)); + + VirtualNetwork = virtualNetwork; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ETag of the DNS resolver policy virtual network link. + /// The reference to the virtual network. This cannot be changed after creation. + /// The current provisioning state of the DNS resolver policy virtual network link. This is a read-only property and any attempt to set this value will be ignored. + /// Keeps track of any properties unknown to the library. + internal DnsResolverPolicyVirtualNetworkLinkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, WritableSubResource virtualNetwork, DnsResolverProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + ETag = etag; + VirtualNetwork = virtualNetwork; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DnsResolverPolicyVirtualNetworkLinkData() + { + } + + /// ETag of the DNS resolver policy virtual network link. + public ETag? ETag { get; } + /// The reference to the virtual network. This cannot be changed after creation. + internal WritableSubResource VirtualNetwork { get; set; } + /// Gets or sets Id. + public ResourceIdentifier VirtualNetworkId + { + get => VirtualNetwork is null ? default : VirtualNetwork.Id; + set + { + if (VirtualNetwork is null) + VirtualNetwork = new WritableSubResource(); + VirtualNetwork.Id = value; + } + } + + /// The current provisioning state of the DNS resolver policy virtual network link. This is a read-only property and any attempt to set this value will be ignored. + public DnsResolverProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkResource.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkResource.Serialization.cs new file mode 100644 index 0000000000000..e1505de102481 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DnsResolver +{ + public partial class DnsResolverPolicyVirtualNetworkLinkResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DnsResolverPolicyVirtualNetworkLinkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DnsResolverPolicyVirtualNetworkLinkData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkResource.cs new file mode 100644 index 0000000000000..6c297f0cd695c --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkResource.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DnsResolver.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A Class representing a DnsResolverPolicyVirtualNetworkLink along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDnsResolverPolicyVirtualNetworkLinkResource method. + /// Otherwise you can get one from its parent resource using the GetDnsResolverPolicyVirtualNetworkLink method. + /// + public partial class DnsResolverPolicyVirtualNetworkLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dnsResolverPolicyName. + /// The dnsResolverPolicyVirtualNetworkLinkName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics; + private readonly DnsResolverPolicyVirtualNetworkLinksRestOperations _dnsResolverPolicyVirtualNetworkLinkRestClient; + private readonly DnsResolverPolicyVirtualNetworkLinkData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Network/dnsResolverPolicies/virtualNetworkLinks"; + + /// Initializes a new instance of the class for mocking. + protected DnsResolverPolicyVirtualNetworkLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DnsResolverPolicyVirtualNetworkLinkResource(ArmClient client, DnsResolverPolicyVirtualNetworkLinkData 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 DnsResolverPolicyVirtualNetworkLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dnsResolverPolicyVirtualNetworkLinkApiVersion); + _dnsResolverPolicyVirtualNetworkLinkRestClient = new DnsResolverPolicyVirtualNetworkLinksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsResolverPolicyVirtualNetworkLinkApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 DnsResolverPolicyVirtualNetworkLinkData 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)); + } + + /// + /// Gets properties of a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.Get"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyVirtualNetworkLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.Get"); + scope.Start(); + try + { + var response = _dnsResolverPolicyVirtualNetworkLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a DNS resolver policy virtual network link. WARNING: This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Delete + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.Delete"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyVirtualNetworkLinkRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(_dnsResolverPolicyVirtualNetworkLinkClientDiagnostics, Pipeline, _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a DNS resolver policy virtual network link. WARNING: This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Delete + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.Delete"); + scope.Start(); + try + { + var response = _dnsResolverPolicyVirtualNetworkLinkRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new DnsResolverArmOperation(_dnsResolverPolicyVirtualNetworkLinkClientDiagnostics, Pipeline, _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Update + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DnsResolverPolicyVirtualNetworkLinkPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.Update"); + scope.Start(); + try + { + var response = await _dnsResolverPolicyVirtualNetworkLinkRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(new DnsResolverPolicyVirtualNetworkLinkOperationSource(Client), _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics, Pipeline, _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a DNS resolver policy virtual network link. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Update + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DnsResolverPolicyVirtualNetworkLinkPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.Update"); + scope.Start(); + try + { + var response = _dnsResolverPolicyVirtualNetworkLinkRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken); + var operation = new DnsResolverArmOperation(new DnsResolverPolicyVirtualNetworkLinkOperationSource(Client), _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics, Pipeline, _dnsResolverPolicyVirtualNetworkLinkRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverPolicyVirtualNetworkLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverPolicyVirtualNetworkLinkPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverPolicyVirtualNetworkLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverPolicyVirtualNetworkLinkPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverPolicyVirtualNetworkLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverPolicyVirtualNetworkLinkPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverPolicyVirtualNetworkLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverPolicyVirtualNetworkLinkPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsResolverPolicyVirtualNetworkLinkRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsResolverPolicyVirtualNetworkLinkPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/virtualNetworkLinks/{dnsResolverPolicyVirtualNetworkLinkName} + /// + /// + /// Operation Id + /// DnsResolverPolicyVirtualNetworkLinks_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dnsResolverPolicyVirtualNetworkLinkClientDiagnostics.CreateScope("DnsResolverPolicyVirtualNetworkLinkResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsResolverPolicyVirtualNetworkLinkRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DnsResolverPolicyVirtualNetworkLinkResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsResolverPolicyVirtualNetworkLinkPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs index ea72be9cf5079..2cc180b5eb02f 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs @@ -110,7 +110,7 @@ public virtual DnsResolverInboundEndpointCollection GetDnsResolverInboundEndpoin /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetDnsRe /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -179,7 +179,7 @@ public virtual DnsResolverOutboundEndpointCollection GetDnsResolverOutboundEndpo /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -210,7 +210,7 @@ public virtual async Task> GetDnsR /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -241,7 +241,7 @@ public virtual Response GetDnsResolverOutbo /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -281,7 +281,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -321,7 +321,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -364,7 +364,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, string /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -407,7 +407,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, C /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual async Task> UpdateAsync(WaitUnt /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -501,7 +501,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Dns /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -563,7 +563,7 @@ public virtual async Task> AddTagAsync(string key, /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -625,7 +625,7 @@ public virtual Response AddTag(string key, string value, Ca /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -682,7 +682,7 @@ public virtual async Task> SetTagsAsync(IDictionar /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -739,7 +739,7 @@ public virtual Response SetTags(IDictionary /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -799,7 +799,7 @@ public virtual async Task> RemoveTagAsync(string k /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleCollection.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleCollection.cs new file mode 100644 index 0000000000000..3af6c0c5919dd --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleCollection.cs @@ -0,0 +1,499 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDnsSecurityRules method from an instance of . + /// + public partial class DnsSecurityRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dnsSecurityRuleClientDiagnostics; + private readonly DnsSecurityRulesRestOperations _dnsSecurityRuleRestClient; + + /// Initializes a new instance of the class for mocking. + protected DnsSecurityRuleCollection() + { + } + + /// 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 DnsSecurityRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsSecurityRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsSecurityRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DnsSecurityRuleResource.ResourceType, out string dnsSecurityRuleApiVersion); + _dnsSecurityRuleRestClient = new DnsSecurityRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsSecurityRuleApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DnsResolverPolicyResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DnsResolverPolicyResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a DNS security rule for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 name of the DNS security rule. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// 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 dnsSecurityRuleName, DnsSecurityRuleData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dnsSecurityRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(new DnsSecurityRuleOperationSource(Client), _dnsSecurityRuleClientDiagnostics, Pipeline, _dnsSecurityRuleRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a DNS security rule for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 name of the DNS security rule. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// 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 dnsSecurityRuleName, DnsSecurityRuleData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dnsSecurityRuleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DnsResolverArmOperation(new DnsSecurityRuleOperationSource(Client), _dnsSecurityRuleClientDiagnostics, Pipeline, _dnsSecurityRuleRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS security rule for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleCollection.Get"); + scope.Start(); + try + { + var response = await _dnsSecurityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsSecurityRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS security rule for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleCollection.Get"); + scope.Start(); + try + { + var response = _dnsSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsSecurityRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists DNS security rules for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules + /// + /// + /// Operation Id + /// DnsSecurityRules_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsSecurityRuleRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsSecurityRuleRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsSecurityRuleResource(Client, DnsSecurityRuleData.DeserializeDnsSecurityRuleData(e)), _dnsSecurityRuleClientDiagnostics, Pipeline, "DnsSecurityRuleCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS security rules for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules + /// + /// + /// Operation Id + /// DnsSecurityRules_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsSecurityRuleRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsSecurityRuleRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsSecurityRuleResource(Client, DnsSecurityRuleData.DeserializeDnsSecurityRuleData(e)), _dnsSecurityRuleClientDiagnostics, Pipeline, "DnsSecurityRuleCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleCollection.Exists"); + scope.Start(); + try + { + var response = await _dnsSecurityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleCollection.Exists"); + scope.Start(); + try + { + var response = _dnsSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dnsSecurityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsSecurityRuleResource(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS security rule. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dnsSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsSecurityRuleName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DnsSecurityRuleResource(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/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.Serialization.cs new file mode 100644 index 0000000000000..22cb108cdd79f --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.Serialization.cs @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + public partial class DnsSecurityRuleData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsSecurityRuleData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("priority"u8); + writer.WriteNumberValue(Priority); + writer.WritePropertyName("action"u8); + writer.WriteObjectValue(Action, options); + writer.WritePropertyName("dnsResolverDomainLists"u8); + writer.WriteStartArray(); + foreach (var item in DnsResolverDomainLists) + { + JsonSerializer.Serialize(writer, item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DnsSecurityRuleState)) + { + writer.WritePropertyName("dnsSecurityRuleState"u8); + writer.WriteStringValue(DnsSecurityRuleState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsSecurityRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsSecurityRuleData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsSecurityRuleData(document.RootElement, options); + } + + internal static DnsSecurityRuleData DeserializeDnsSecurityRuleData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + int priority = default; + DnsSecurityRuleAction action = default; + IList dnsResolverDomainLists = default; + DnsSecurityRuleState? dnsSecurityRuleState = default; + DnsResolverProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + 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; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("priority"u8)) + { + priority = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("action"u8)) + { + action = DnsSecurityRuleAction.DeserializeDnsSecurityRuleAction(property0.Value, options); + continue; + } + if (property0.NameEquals("dnsResolverDomainLists"u8)) + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + dnsResolverDomainLists = array; + continue; + } + if (property0.NameEquals("dnsSecurityRuleState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsSecurityRuleState = new DnsSecurityRuleState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DnsResolverProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsSecurityRuleData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + etag, + priority, + action, + dnsResolverDomainLists, + dnsSecurityRuleState, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsSecurityRuleData)} does not support writing '{options.Format}' format."); + } + } + + DnsSecurityRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsSecurityRuleData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsSecurityRuleData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.cs new file mode 100644 index 0000000000000..12f1d9cbd105c --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.cs @@ -0,0 +1,115 @@ +// 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; +using Azure.ResourceManager.DnsResolver.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A class representing the DnsSecurityRule data model. + /// Describes a DNS security rule. + /// + public partial class DnsSecurityRuleData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + /// The priority of the DNS security rule. + /// The action to take on DNS requests that match the DNS security rule. + /// DNS resolver policy domains lists that the DNS security rule applies to. + /// or is null. + public DnsSecurityRuleData(AzureLocation location, int priority, DnsSecurityRuleAction action, IEnumerable dnsResolverDomainLists) : base(location) + { + Argument.AssertNotNull(action, nameof(action)); + Argument.AssertNotNull(dnsResolverDomainLists, nameof(dnsResolverDomainLists)); + + Priority = priority; + Action = action; + DnsResolverDomainLists = dnsResolverDomainLists.ToList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// ETag of the DNS security rule. + /// The priority of the DNS security rule. + /// The action to take on DNS requests that match the DNS security rule. + /// DNS resolver policy domains lists that the DNS security rule applies to. + /// The state of DNS security rule. + /// The current provisioning state of the DNS security rule. This is a read-only property and any attempt to set this value will be ignored. + /// Keeps track of any properties unknown to the library. + internal DnsSecurityRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, int priority, DnsSecurityRuleAction action, IList dnsResolverDomainLists, DnsSecurityRuleState? dnsSecurityRuleState, DnsResolverProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + ETag = etag; + Priority = priority; + Action = action; + DnsResolverDomainLists = dnsResolverDomainLists; + DnsSecurityRuleState = dnsSecurityRuleState; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DnsSecurityRuleData() + { + } + + /// ETag of the DNS security rule. + public ETag? ETag { get; } + /// The priority of the DNS security rule. + public int Priority { get; set; } + /// The action to take on DNS requests that match the DNS security rule. + public DnsSecurityRuleAction Action { get; set; } + /// DNS resolver policy domains lists that the DNS security rule applies to. + public IList DnsResolverDomainLists { get; } + /// The state of DNS security rule. + public DnsSecurityRuleState? DnsSecurityRuleState { get; set; } + /// The current provisioning state of the DNS security rule. This is a read-only property and any attempt to set this value will be ignored. + public DnsResolverProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleResource.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleResource.Serialization.cs new file mode 100644 index 0000000000000..b5f26a710cc70 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.DnsResolver +{ + public partial class DnsSecurityRuleResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DnsSecurityRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DnsSecurityRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleResource.cs new file mode 100644 index 0000000000000..39a55cc73c5af --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleResource.cs @@ -0,0 +1,711 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DnsResolver.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + /// + /// A Class representing a DnsSecurityRule along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDnsSecurityRuleResource method. + /// Otherwise you can get one from its parent resource using the GetDnsSecurityRule method. + /// + public partial class DnsSecurityRuleResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The dnsResolverPolicyName. + /// The dnsSecurityRuleName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dnsSecurityRuleClientDiagnostics; + private readonly DnsSecurityRulesRestOperations _dnsSecurityRuleRestClient; + private readonly DnsSecurityRuleData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Network/dnsResolverPolicies/dnsSecurityRules"; + + /// Initializes a new instance of the class for mocking. + protected DnsSecurityRuleResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DnsSecurityRuleResource(ArmClient client, DnsSecurityRuleData 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 DnsSecurityRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsSecurityRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dnsSecurityRuleApiVersion); + _dnsSecurityRuleRestClient = new DnsSecurityRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsSecurityRuleApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 DnsSecurityRuleData 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)); + } + + /// + /// Gets properties of a DNS security rule for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.Get"); + scope.Start(); + try + { + var response = await _dnsSecurityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsSecurityRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets properties of a DNS security rule for a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.Get"); + scope.Start(); + try + { + var response = _dnsSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsSecurityRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a DNS security rule for a DNS resolver policy. WARNING: This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Delete + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.Delete"); + scope.Start(); + try + { + var response = await _dnsSecurityRuleRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(_dnsSecurityRuleClientDiagnostics, Pipeline, _dnsSecurityRuleRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a DNS security rule for a DNS resolver policy. WARNING: This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Delete + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.Delete"); + scope.Start(); + try + { + var response = _dnsSecurityRuleRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new DnsResolverArmOperation(_dnsSecurityRuleClientDiagnostics, Pipeline, _dnsSecurityRuleRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a DNS security rule. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Update + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DnsSecurityRulePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.Update"); + scope.Start(); + try + { + var response = await _dnsSecurityRuleRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsResolverArmOperation(new DnsSecurityRuleOperationSource(Client), _dnsSecurityRuleClientDiagnostics, Pipeline, _dnsSecurityRuleRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a DNS security rule. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Update + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// 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. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DnsSecurityRulePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.Update"); + scope.Start(); + try + { + var response = _dnsSecurityRuleRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken); + var operation = new DnsResolverArmOperation(new DnsSecurityRuleOperationSource(Client), _dnsSecurityRuleClientDiagnostics, Pipeline, _dnsSecurityRuleRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsSecurityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsSecurityRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsSecurityRulePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DnsSecurityRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsSecurityRulePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsSecurityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsSecurityRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsSecurityRulePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DnsSecurityRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsSecurityRulePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _dnsSecurityRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsSecurityRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DnsSecurityRulePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName}/dnsSecurityRules/{dnsSecurityRuleName} + /// + /// + /// Operation Id + /// DnsSecurityRules_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _dnsSecurityRuleClientDiagnostics.CreateScope("DnsSecurityRuleResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _dnsSecurityRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DnsSecurityRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DnsSecurityRulePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/DnsResolverExtensions.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/DnsResolverExtensions.cs index d19928a393123..0a8644e11603d 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/DnsResolverExtensions.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/DnsResolverExtensions.cs @@ -146,6 +146,82 @@ public static DnsForwardingRulesetVirtualNetworkLinkResource GetDnsForwardingRul return GetMockableDnsResolverArmClient(client).GetDnsForwardingRulesetVirtualNetworkLinkResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DnsResolverPolicyResource GetDnsResolverPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDnsResolverArmClient(client).GetDnsResolverPolicyResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DnsSecurityRuleResource GetDnsSecurityRuleResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDnsResolverArmClient(client).GetDnsSecurityRuleResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DnsResolverPolicyVirtualNetworkLinkResource GetDnsResolverPolicyVirtualNetworkLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDnsResolverArmClient(client).GetDnsResolverPolicyVirtualNetworkLinkResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DnsResolverDomainListResource GetDnsResolverDomainListResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDnsResolverArmClient(client).GetDnsResolverDomainListResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -195,7 +271,7 @@ public static DnsResolverCollection GetDnsResolvers(this ResourceGroupResource r /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -233,7 +309,7 @@ public static async Task> GetDnsResolverAsync(this /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -288,7 +364,7 @@ public static DnsForwardingRulesetCollection GetDnsForwardingRulesets(this Resou /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -326,7 +402,7 @@ public static async Task> GetDnsForwardin /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -351,6 +427,192 @@ public static Response GetDnsForwardingRuleset(thi return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsForwardingRuleset(rulesetName, cancellationToken); } + /// + /// Gets a collection of DnsResolverPolicyResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of DnsResolverPolicyResources and their operations over a DnsResolverPolicyResource. + public static DnsResolverPolicyCollection GetDnsResolverPolicies(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolverPolicies(); + } + + /// + /// Gets properties of a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDnsResolverPolicyAsync(this ResourceGroupResource resourceGroupResource, string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolverPolicyAsync(dnsResolverPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDnsResolverPolicy(this ResourceGroupResource resourceGroupResource, string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolverPolicy(dnsResolverPolicyName, cancellationToken); + } + + /// + /// Gets a collection of DnsResolverDomainListResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of DnsResolverDomainListResources and their operations over a DnsResolverDomainListResource. + public static DnsResolverDomainListCollection GetDnsResolverDomainLists(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolverDomainLists(); + } + + /// + /// Gets properties of a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDnsResolverDomainListAsync(this ResourceGroupResource resourceGroupResource, string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolverDomainListAsync(dnsResolverDomainListName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDnsResolverDomainList(this ResourceGroupResource resourceGroupResource, string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDnsResolverResourceGroupResource(resourceGroupResource).GetDnsResolverDomainList(dnsResolverDomainListName, cancellationToken); + } + /// /// Lists DNS resolvers in all resource groups of a subscription. /// @@ -364,7 +626,7 @@ public static Response GetDnsForwardingRuleset(thi /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -401,7 +663,7 @@ public static AsyncPageable GetDnsResolversAsync(this Subsc /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -438,7 +700,7 @@ public static Pageable GetDnsResolvers(this SubscriptionRes /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -475,7 +737,7 @@ public static AsyncPageable GetDnsForwardingRulese /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -498,5 +760,153 @@ public static Pageable GetDnsForwardingRulesets(th return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsForwardingRulesets(top, cancellationToken); } + + /// + /// Lists DNS resolver policies in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolverPolicies + /// + /// + /// Operation Id + /// DnsResolverPolicies_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDnsResolverPoliciesAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsResolverPoliciesAsync(top, cancellationToken); + } + + /// + /// Lists DNS resolver policies in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolverPolicies + /// + /// + /// Operation Id + /// DnsResolverPolicies_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDnsResolverPolicies(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsResolverPolicies(top, cancellationToken); + } + + /// + /// Lists DNS resolver domain lists in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolverDomainLists + /// + /// + /// Operation Id + /// DnsResolverDomainLists_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDnsResolverDomainListsAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsResolverDomainListsAsync(top, cancellationToken); + } + + /// + /// Lists DNS resolver domain lists in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolverDomainLists + /// + /// + /// Operation Id + /// DnsResolverDomainLists_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDnsResolverDomainLists(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDnsResolverSubscriptionResource(subscriptionResource).GetDnsResolverDomainLists(top, cancellationToken); + } } } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverArmClient.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverArmClient.cs index bee86dcf9d883..fe7c724bb0fd3 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverArmClient.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverArmClient.cs @@ -106,6 +106,54 @@ public virtual DnsForwardingRulesetVirtualNetworkLinkResource GetDnsForwardingRu return new DnsForwardingRulesetVirtualNetworkLinkResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsResolverPolicyResource GetDnsResolverPolicyResource(ResourceIdentifier id) + { + DnsResolverPolicyResource.ValidateResourceId(id); + return new DnsResolverPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsSecurityRuleResource GetDnsSecurityRuleResource(ResourceIdentifier id) + { + DnsSecurityRuleResource.ValidateResourceId(id); + return new DnsSecurityRuleResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsResolverPolicyVirtualNetworkLinkResource GetDnsResolverPolicyVirtualNetworkLinkResource(ResourceIdentifier id) + { + DnsResolverPolicyVirtualNetworkLinkResource.ValidateResourceId(id); + return new DnsResolverPolicyVirtualNetworkLinkResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DnsResolverDomainListResource GetDnsResolverDomainListResource(ResourceIdentifier id) + { + DnsResolverDomainListResource.ValidateResourceId(id); + return new DnsResolverDomainListResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverResourceGroupResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverResourceGroupResource.cs index dcbcca0308030..5bd8723fdc941 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverResourceGroupResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual DnsResolverCollection GetDnsResolvers() /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetDnsResolverAsync(str /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -122,7 +122,7 @@ public virtual DnsForwardingRulesetCollection GetDnsForwardingRulesets() /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -153,7 +153,7 @@ public virtual async Task> GetDnsForwardi /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -170,5 +170,143 @@ public virtual Response GetDnsForwardingRuleset(st { return GetDnsForwardingRulesets().Get(rulesetName, cancellationToken); } + + /// Gets a collection of DnsResolverPolicyResources in the ResourceGroupResource. + /// An object representing collection of DnsResolverPolicyResources and their operations over a DnsResolverPolicyResource. + public virtual DnsResolverPolicyCollection GetDnsResolverPolicies() + { + return GetCachedClient(client => new DnsResolverPolicyCollection(client, Id)); + } + + /// + /// Gets properties of a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDnsResolverPolicyAsync(string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + return await GetDnsResolverPolicies().GetAsync(dnsResolverPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a DNS resolver policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverPolicies/{dnsResolverPolicyName} + /// + /// + /// Operation Id + /// DnsResolverPolicies_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDnsResolverPolicy(string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + return GetDnsResolverPolicies().Get(dnsResolverPolicyName, cancellationToken); + } + + /// Gets a collection of DnsResolverDomainListResources in the ResourceGroupResource. + /// An object representing collection of DnsResolverDomainListResources and their operations over a DnsResolverDomainListResource. + public virtual DnsResolverDomainListCollection GetDnsResolverDomainLists() + { + return GetCachedClient(client => new DnsResolverDomainListCollection(client, Id)); + } + + /// + /// Gets properties of a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDnsResolverDomainListAsync(string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + return await GetDnsResolverDomainLists().GetAsync(dnsResolverDomainListName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets properties of a DNS resolver domain list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolverDomainLists/{dnsResolverDomainListName} + /// + /// + /// Operation Id + /// DnsResolverDomainLists_Get + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the DNS resolver domain list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDnsResolverDomainList(string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + return GetDnsResolverDomainLists().Get(dnsResolverDomainListName, cancellationToken); + } } } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverSubscriptionResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverSubscriptionResource.cs index c49b9047248e3..3d6400b092968 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverSubscriptionResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Extensions/MockableDnsResolverSubscriptionResource.cs @@ -19,6 +19,10 @@ public partial class MockableDnsResolverSubscriptionResource : ArmResource private DnsResolversRestOperations _dnsResolverRestClient; private ClientDiagnostics _dnsForwardingRulesetClientDiagnostics; private DnsForwardingRulesetsRestOperations _dnsForwardingRulesetRestClient; + private ClientDiagnostics _dnsResolverPolicyClientDiagnostics; + private DnsResolverPoliciesRestOperations _dnsResolverPolicyRestClient; + private ClientDiagnostics _dnsResolverDomainListClientDiagnostics; + private DnsResolverDomainListsRestOperations _dnsResolverDomainListRestClient; /// Initializes a new instance of the class for mocking. protected MockableDnsResolverSubscriptionResource() @@ -36,6 +40,10 @@ internal MockableDnsResolverSubscriptionResource(ArmClient client, ResourceIdent private DnsResolversRestOperations DnsResolverRestClient => _dnsResolverRestClient ??= new DnsResolversRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsResolverResource.ResourceType)); private ClientDiagnostics DnsForwardingRulesetClientDiagnostics => _dnsForwardingRulesetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsForwardingRulesetResource.ResourceType.Namespace, Diagnostics); private DnsForwardingRulesetsRestOperations DnsForwardingRulesetRestClient => _dnsForwardingRulesetRestClient ??= new DnsForwardingRulesetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsForwardingRulesetResource.ResourceType)); + private ClientDiagnostics DnsResolverPolicyClientDiagnostics => _dnsResolverPolicyClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsResolverPolicyResource.ResourceType.Namespace, Diagnostics); + private DnsResolverPoliciesRestOperations DnsResolverPolicyRestClient => _dnsResolverPolicyRestClient ??= new DnsResolverPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsResolverPolicyResource.ResourceType)); + private ClientDiagnostics DnsResolverDomainListClientDiagnostics => _dnsResolverDomainListClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsResolverDomainListResource.ResourceType.Namespace, Diagnostics); + private DnsResolverDomainListsRestOperations DnsResolverDomainListRestClient => _dnsResolverDomainListRestClient ??= new DnsResolverDomainListsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DnsResolverDomainListResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -56,7 +64,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -87,7 +95,7 @@ public virtual AsyncPageable GetDnsResolversAsync(int? top /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -118,7 +126,7 @@ public virtual Pageable GetDnsResolvers(int? top = null, Ca /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -149,7 +157,7 @@ public virtual AsyncPageable GetDnsForwardingRules /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -166,5 +174,129 @@ public virtual Pageable GetDnsForwardingRulesets(i HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsForwardingRulesetRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsForwardingRulesetResource(Client, DnsForwardingRulesetData.DeserializeDnsForwardingRulesetData(e)), DnsForwardingRulesetClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsForwardingRulesets", "value", "nextLink", cancellationToken); } + + /// + /// Lists DNS resolver policies in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolverPolicies + /// + /// + /// Operation Id + /// DnsResolverPolicies_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDnsResolverPoliciesAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsResolverPolicyRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsResolverPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsResolverPolicyResource(Client, DnsResolverPolicyData.DeserializeDnsResolverPolicyData(e)), DnsResolverPolicyClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsResolverPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS resolver policies in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolverPolicies + /// + /// + /// Operation Id + /// DnsResolverPolicies_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDnsResolverPolicies(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsResolverPolicyRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsResolverPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsResolverPolicyResource(Client, DnsResolverPolicyData.DeserializeDnsResolverPolicyData(e)), DnsResolverPolicyClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsResolverPolicies", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS resolver domain lists in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolverDomainLists + /// + /// + /// Operation Id + /// DnsResolverDomainLists_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDnsResolverDomainListsAsync(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsResolverDomainListRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsResolverDomainListRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsResolverDomainListResource(Client, DnsResolverDomainListData.DeserializeDnsResolverDomainListData(e)), DnsResolverDomainListClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsResolverDomainLists", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS resolver domain lists in all resource groups of a subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolverDomainLists + /// + /// + /// Operation Id + /// DnsResolverDomainLists_List + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDnsResolverDomainLists(int? top = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DnsResolverDomainListRestClient.CreateListRequest(Id.SubscriptionId, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DnsResolverDomainListRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsResolverDomainListResource(Client, DnsResolverDomainListData.DeserializeDnsResolverDomainListData(e)), DnsResolverDomainListClientDiagnostics, Pipeline, "MockableDnsResolverSubscriptionResource.GetDnsResolverDomainLists", "value", "nextLink", cancellationToken); + } } } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverDomainListOperationSource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverDomainListOperationSource.cs new file mode 100644 index 0000000000000..455f629a00511 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverDomainListOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver +{ + internal class DnsResolverDomainListOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DnsResolverDomainListOperationSource(ArmClient client) + { + _client = client; + } + + DnsResolverDomainListResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DnsResolverDomainListData.DeserializeDnsResolverDomainListData(document.RootElement); + return new DnsResolverDomainListResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DnsResolverDomainListData.DeserializeDnsResolverDomainListData(document.RootElement); + return new DnsResolverDomainListResource(_client, data); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverPolicyOperationSource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverPolicyOperationSource.cs new file mode 100644 index 0000000000000..aef111b75e662 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverPolicyOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver +{ + internal class DnsResolverPolicyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DnsResolverPolicyOperationSource(ArmClient client) + { + _client = client; + } + + DnsResolverPolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DnsResolverPolicyData.DeserializeDnsResolverPolicyData(document.RootElement); + return new DnsResolverPolicyResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DnsResolverPolicyData.DeserializeDnsResolverPolicyData(document.RootElement); + return new DnsResolverPolicyResource(_client, data); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverPolicyVirtualNetworkLinkOperationSource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverPolicyVirtualNetworkLinkOperationSource.cs new file mode 100644 index 0000000000000..c5f64a4b4da4b --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsResolverPolicyVirtualNetworkLinkOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver +{ + internal class DnsResolverPolicyVirtualNetworkLinkOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DnsResolverPolicyVirtualNetworkLinkOperationSource(ArmClient client) + { + _client = client; + } + + DnsResolverPolicyVirtualNetworkLinkResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DnsResolverPolicyVirtualNetworkLinkData.DeserializeDnsResolverPolicyVirtualNetworkLinkData(document.RootElement); + return new DnsResolverPolicyVirtualNetworkLinkResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DnsResolverPolicyVirtualNetworkLinkData.DeserializeDnsResolverPolicyVirtualNetworkLinkData(document.RootElement); + return new DnsResolverPolicyVirtualNetworkLinkResource(_client, data); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsSecurityRuleOperationSource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsSecurityRuleOperationSource.cs new file mode 100644 index 0000000000000..b7a37d677d98e --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/LongRunningOperation/DnsSecurityRuleOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver +{ + internal class DnsSecurityRuleOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DnsSecurityRuleOperationSource(ArmClient client) + { + _client = client; + } + + DnsSecurityRuleResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DnsSecurityRuleData.DeserializeDnsSecurityRuleData(document.RootElement); + return new DnsSecurityRuleResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DnsSecurityRuleData.DeserializeDnsSecurityRuleData(document.RootElement); + return new DnsSecurityRuleResource(_client, data); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs new file mode 100644 index 0000000000000..39ea855c89c55 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The type of action to take. + public readonly partial struct ActionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ActionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AllowValue = "Allow"; + private const string AlertValue = "Alert"; + private const string BlockValue = "Block"; + + /// Allow. + public static ActionType Allow { get; } = new ActionType(AllowValue); + /// Alert. + public static ActionType Alert { get; } = new ActionType(AlertValue); + /// Block. + public static ActionType Block { get; } = new ActionType(BlockValue); + /// Determines if two values are the same. + public static bool operator ==(ActionType left, ActionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ActionType left, ActionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ActionType(string value) => new ActionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ActionType other && Equals(other); + /// + public bool Equals(ActionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/BlockResponseCode.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/BlockResponseCode.cs new file mode 100644 index 0000000000000..4f6955a8023fd --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/BlockResponseCode.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The response code for block actions. + public readonly partial struct BlockResponseCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BlockResponseCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ServfailValue = "SERVFAIL"; + + /// SERVFAIL. + public static BlockResponseCode Servfail { get; } = new BlockResponseCode(ServfailValue); + /// Determines if two values are the same. + public static bool operator ==(BlockResponseCode left, BlockResponseCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BlockResponseCode left, BlockResponseCode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator BlockResponseCode(string value) => new BlockResponseCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BlockResponseCode other && Equals(other); + /// + public bool Equals(BlockResponseCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.Serialization.cs new file mode 100644 index 0000000000000..6bf5c78004fc4 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + public partial class DnsResolverDomainListPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverDomainListPatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Domains)) + { + writer.WritePropertyName("domains"u8); + writer.WriteStartArray(); + foreach (var item in Domains) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverDomainListPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverDomainListPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverDomainListPatch(document.RootElement, options); + } + + internal static DnsResolverDomainListPatch DeserializeDnsResolverDomainListPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + IList domains = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("domains"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + domains = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverDomainListPatch(tags ?? new ChangeTrackingDictionary(), domains ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverDomainListPatch)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverDomainListPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverDomainListPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverDomainListPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.cs new file mode 100644 index 0000000000000..85f570486d940 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// Describes a DNS resolver domain list for PATCH operation. + public partial class DnsResolverDomainListPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DnsResolverDomainListPatch() + { + Tags = new ChangeTrackingDictionary(); + Domains = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Tags for DNS resolver domain list. + /// The domains in the domain list. + /// Keeps track of any properties unknown to the library. + internal DnsResolverDomainListPatch(IDictionary tags, IList domains, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Domains = domains; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Tags for DNS resolver domain list. + public IDictionary Tags { get; } + /// The domains in the domain list. + public IList Domains { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.Serialization.cs new file mode 100644 index 0000000000000..05c394959299d --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + internal partial class DnsResolverDomainListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverDomainListResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverDomainListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverDomainListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverDomainListResult(document.RootElement, options); + } + + internal static DnsResolverDomainListResult DeserializeDnsResolverDomainListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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(DnsResolverDomainListData.DeserializeDnsResolverDomainListData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverDomainListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverDomainListResult)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverDomainListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverDomainListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverDomainListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.cs new file mode 100644 index 0000000000000..154da1abd511b --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The response to an enumeration operation on DNS resolver domain lists. + internal partial class DnsResolverDomainListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DnsResolverDomainListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Enumeration of the DNS resolver domain lists. + /// The continuation token for the next page of results. + /// Keeps track of any properties unknown to the library. + internal DnsResolverDomainListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Enumeration of the DNS resolver domain lists. + public IReadOnlyList Value { get; } + /// The continuation token for the next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.Serialization.cs new file mode 100644 index 0000000000000..8c4be07f5b59e --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + internal partial class DnsResolverPolicyListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyListResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverPolicyListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverPolicyListResult(document.RootElement, options); + } + + internal static DnsResolverPolicyListResult DeserializeDnsResolverPolicyListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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(DnsResolverPolicyData.DeserializeDnsResolverPolicyData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverPolicyListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyListResult)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverPolicyListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverPolicyListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.cs new file mode 100644 index 0000000000000..8ff57fca8d6eb --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The response to an enumeration operation on DNS resolver policies. + internal partial class DnsResolverPolicyListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DnsResolverPolicyListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Enumeration of the DNS resolver policies. + /// The continuation token for the next page of results. + /// Keeps track of any properties unknown to the library. + internal DnsResolverPolicyListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Enumeration of the DNS resolver policies. + public IReadOnlyList Value { get; } + /// The continuation token for the next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.Serialization.cs new file mode 100644 index 0000000000000..693145e8cdad8 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + public partial class DnsResolverPolicyPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyPatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverPolicyPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverPolicyPatch(document.RootElement, options); + } + + internal static DnsResolverPolicyPatch DeserializeDnsResolverPolicyPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverPolicyPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyPatch)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverPolicyPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverPolicyPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.cs new file mode 100644 index 0000000000000..69a87aaa5be68 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// Describes a DNS resolver policy for PATCH operation. + public partial class DnsResolverPolicyPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DnsResolverPolicyPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Tags for DNS resolver policy. + /// Keeps track of any properties unknown to the library. + internal DnsResolverPolicyPatch(IDictionary tags, IDictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Tags for DNS resolver policy. + public IDictionary Tags { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.Serialization.cs new file mode 100644 index 0000000000000..412263837ce3f --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + internal partial class DnsResolverPolicyVirtualNetworkLinkListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkListResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverPolicyVirtualNetworkLinkListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverPolicyVirtualNetworkLinkListResult(document.RootElement, options); + } + + internal static DnsResolverPolicyVirtualNetworkLinkListResult DeserializeDnsResolverPolicyVirtualNetworkLinkListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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(DnsResolverPolicyVirtualNetworkLinkData.DeserializeDnsResolverPolicyVirtualNetworkLinkData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverPolicyVirtualNetworkLinkListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkListResult)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverPolicyVirtualNetworkLinkListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverPolicyVirtualNetworkLinkListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.cs new file mode 100644 index 0000000000000..c97e63e8e665d --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The response to an enumeration operation on DNS resolver policy virtual network links. + internal partial class DnsResolverPolicyVirtualNetworkLinkListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DnsResolverPolicyVirtualNetworkLinkListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Enumeration of the DNS resolver policy virtual network links. + /// The continuation token for the next page of results. + /// Keeps track of any properties unknown to the library. + internal DnsResolverPolicyVirtualNetworkLinkListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Enumeration of the DNS resolver policy virtual network links. + public IReadOnlyList Value { get; } + /// The continuation token for the next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.Serialization.cs new file mode 100644 index 0000000000000..302c6b56a68f6 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + public partial class DnsResolverPolicyVirtualNetworkLinkPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkPatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsResolverPolicyVirtualNetworkLinkPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsResolverPolicyVirtualNetworkLinkPatch(document.RootElement, options); + } + + internal static DnsResolverPolicyVirtualNetworkLinkPatch DeserializeDnsResolverPolicyVirtualNetworkLinkPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsResolverPolicyVirtualNetworkLinkPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkPatch)} does not support writing '{options.Format}' format."); + } + } + + DnsResolverPolicyVirtualNetworkLinkPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsResolverPolicyVirtualNetworkLinkPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.cs new file mode 100644 index 0000000000000..8d84dc39849b2 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// Describes a DNS resolver policy virtual network link for PATCH operation. + public partial class DnsResolverPolicyVirtualNetworkLinkPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DnsResolverPolicyVirtualNetworkLinkPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Tags for the DNS resolver policy virtual network link. + /// Keeps track of any properties unknown to the library. + internal DnsResolverPolicyVirtualNetworkLinkPatch(IDictionary tags, IDictionary serializedAdditionalRawData) + { + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Tags for the DNS resolver policy virtual network link. + public IDictionary Tags { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs new file mode 100644 index 0000000000000..d4d5d458be6b3 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + public partial class DnsSecurityRuleAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsSecurityRuleAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionType)) + { + writer.WritePropertyName("actionType"u8); + writer.WriteStringValue(ActionType.Value.ToString()); + } + if (Optional.IsDefined(BlockResponseCode)) + { + writer.WritePropertyName("blockResponseCode"u8); + writer.WriteStringValue(BlockResponseCode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsSecurityRuleAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsSecurityRuleAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsSecurityRuleAction(document.RootElement, options); + } + + internal static DnsSecurityRuleAction DeserializeDnsSecurityRuleAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ActionType? actionType = default; + BlockResponseCode? blockResponseCode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("actionType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actionType = new ActionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("blockResponseCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blockResponseCode = new BlockResponseCode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsSecurityRuleAction(actionType, blockResponseCode, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsSecurityRuleAction)} does not support writing '{options.Format}' format."); + } + } + + DnsSecurityRuleAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsSecurityRuleAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsSecurityRuleAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.cs new file mode 100644 index 0000000000000..ea0ef9ffea350 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The action to take on DNS requests that match the DNS security rule. + public partial class DnsSecurityRuleAction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DnsSecurityRuleAction() + { + } + + /// Initializes a new instance of . + /// The type of action to take. + /// The response code for block actions. + /// Keeps track of any properties unknown to the library. + internal DnsSecurityRuleAction(ActionType? actionType, BlockResponseCode? blockResponseCode, IDictionary serializedAdditionalRawData) + { + ActionType = actionType; + BlockResponseCode = blockResponseCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of action to take. + public ActionType? ActionType { get; set; } + /// The response code for block actions. + public BlockResponseCode? BlockResponseCode { get; set; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.Serialization.cs new file mode 100644 index 0000000000000..1a41c77bc2334 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + internal partial class DnsSecurityRuleListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsSecurityRuleListResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsSecurityRuleListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsSecurityRuleListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsSecurityRuleListResult(document.RootElement, options); + } + + internal static DnsSecurityRuleListResult DeserializeDnsSecurityRuleListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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(DnsSecurityRuleData.DeserializeDnsSecurityRuleData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsSecurityRuleListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsSecurityRuleListResult)} does not support writing '{options.Format}' format."); + } + } + + DnsSecurityRuleListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsSecurityRuleListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsSecurityRuleListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.cs new file mode 100644 index 0000000000000..2caf0fa7bd274 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The response to an enumeration operation on DNS security rules within a DNS resolver policy. + internal partial class DnsSecurityRuleListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DnsSecurityRuleListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Enumeration of the DNS security rules. + /// The continuation token for the next page of results. + /// Keeps track of any properties unknown to the library. + internal DnsSecurityRuleListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Enumeration of the DNS security rules. + public IReadOnlyList Value { get; } + /// The continuation token for the next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.Serialization.cs new file mode 100644 index 0000000000000..4c59e4288ae80 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.Serialization.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + public partial class DnsSecurityRulePatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsSecurityRulePatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteObjectValue(Action, options); + } + if (Optional.IsCollectionDefined(DnsResolverDomainLists)) + { + writer.WritePropertyName("dnsResolverDomainLists"u8); + writer.WriteStartArray(); + foreach (var item in DnsResolverDomainLists) + { + JsonSerializer.Serialize(writer, item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DnsSecurityRuleState)) + { + writer.WritePropertyName("dnsSecurityRuleState"u8); + writer.WriteStringValue(DnsSecurityRuleState.Value.ToString()); + } + if (Optional.IsDefined(Priority)) + { + writer.WritePropertyName("priority"u8); + writer.WriteNumberValue(Priority.Value); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DnsSecurityRulePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DnsSecurityRulePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDnsSecurityRulePatch(document.RootElement, options); + } + + internal static DnsSecurityRulePatch DeserializeDnsSecurityRulePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + DnsSecurityRuleAction action = default; + IList dnsResolverDomainLists = default; + DnsSecurityRuleState? dnsSecurityRuleState = default; + int? priority = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("action"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + action = DnsSecurityRuleAction.DeserializeDnsSecurityRuleAction(property0.Value, options); + continue; + } + if (property0.NameEquals("dnsResolverDomainLists"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + dnsResolverDomainLists = array; + continue; + } + if (property0.NameEquals("dnsSecurityRuleState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsSecurityRuleState = new DnsSecurityRuleState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("priority"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + priority = property0.Value.GetInt32(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DnsSecurityRulePatch( + tags ?? new ChangeTrackingDictionary(), + action, + dnsResolverDomainLists ?? new ChangeTrackingList(), + dnsSecurityRuleState, + priority, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DnsSecurityRulePatch)} does not support writing '{options.Format}' format."); + } + } + + DnsSecurityRulePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDnsSecurityRulePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DnsSecurityRulePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.cs new file mode 100644 index 0000000000000..14ff316770859 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// Describes a DNS security rule for PATCH operation. + public partial class DnsSecurityRulePatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted 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" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DnsSecurityRulePatch() + { + Tags = new ChangeTrackingDictionary(); + DnsResolverDomainLists = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Tags for DNS security rule. + /// The action to take on DNS requests that match the DNS security rule. + /// DNS resolver policy domains lists that the DNS security rule applies to. + /// The state of DNS security rule. + /// The priority of the DNS security rule. + /// Keeps track of any properties unknown to the library. + internal DnsSecurityRulePatch(IDictionary tags, DnsSecurityRuleAction action, IList dnsResolverDomainLists, DnsSecurityRuleState? dnsSecurityRuleState, int? priority, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Action = action; + DnsResolverDomainLists = dnsResolverDomainLists; + DnsSecurityRuleState = dnsSecurityRuleState; + Priority = priority; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Tags for DNS security rule. + public IDictionary Tags { get; } + /// The action to take on DNS requests that match the DNS security rule. + public DnsSecurityRuleAction Action { get; set; } + /// DNS resolver policy domains lists that the DNS security rule applies to. + public IList DnsResolverDomainLists { get; } + /// The state of DNS security rule. + public DnsSecurityRuleState? DnsSecurityRuleState { get; set; } + /// The priority of the DNS security rule. + public int? Priority { get; set; } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleState.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleState.cs new file mode 100644 index 0000000000000..fa93f10235ec5 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The state of DNS security rule. + public readonly partial struct DnsSecurityRuleState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DnsSecurityRuleState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static DnsSecurityRuleState Enabled { get; } = new DnsSecurityRuleState(EnabledValue); + /// Disabled. + public static DnsSecurityRuleState Disabled { get; } = new DnsSecurityRuleState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(DnsSecurityRuleState left, DnsSecurityRuleState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsSecurityRuleState left, DnsSecurityRuleState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DnsSecurityRuleState(string value) => new DnsSecurityRuleState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DnsSecurityRuleState other && Equals(other); + /// + public bool Equals(DnsSecurityRuleState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsForwardingRulesetsRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsForwardingRulesetsRestOperations.cs index 972aac31d4e4c..fc46fecf38681 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsForwardingRulesetsRestOperations.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsForwardingRulesetsRestOperations.cs @@ -32,7 +32,7 @@ public DnsForwardingRulesetsRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-07-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -83,7 +83,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// Parameters supplied to the CreateOrUpdate operation. @@ -113,7 +113,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// Parameters supplied to the CreateOrUpdate operation. @@ -185,7 +185,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// Parameters supplied to the Update operation. @@ -213,7 +213,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// Parameters supplied to the Update operation. @@ -279,7 +279,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the ruleset will be deleted. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. @@ -306,7 +306,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the ruleset will be deleted. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. @@ -367,7 +367,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets a DNS forwarding ruleset properties. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The cancellation token to use. @@ -398,7 +398,7 @@ public async Task> GetAsync(string subscripti } /// Gets a DNS forwarding ruleset properties. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The cancellation token to use. @@ -469,7 +469,7 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str } /// Lists DNS forwarding rulesets within a resource group. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. @@ -497,7 +497,7 @@ public async Task> ListByResourceGroupA } /// Lists DNS forwarding rulesets within a resource group. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. @@ -561,7 +561,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, int? top) } /// Lists DNS forwarding rulesets in all resource groups of a subscription. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. /// is null. @@ -587,7 +587,7 @@ public async Task> ListAsync(string sub } /// Lists DNS forwarding rulesets in all resource groups of a subscription. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. /// is null. @@ -657,7 +657,7 @@ internal HttpMessage CreateListByVirtualNetworkRequest(string subscriptionId, st } /// Lists DNS forwarding ruleset resource IDs attached to a virtual network. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the virtual network. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -687,7 +687,7 @@ public async Task> ListBy } /// Lists DNS forwarding ruleset resource IDs attached to a virtual network. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the virtual network. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -740,7 +740,7 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// Lists DNS forwarding rulesets within a resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. @@ -770,7 +770,7 @@ public async Task> ListByResourceGroupN /// Lists DNS forwarding rulesets within a resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. @@ -822,7 +822,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists DNS forwarding rulesets in all resource groups of a subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. /// or is null. @@ -850,7 +850,7 @@ public async Task> ListNextPageAsync(st /// Lists DNS forwarding rulesets in all resource groups of a subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. /// or is null. @@ -900,7 +900,7 @@ internal HttpMessage CreateListByVirtualNetworkNextPageRequest(string nextLink, /// Lists DNS forwarding ruleset resource IDs attached to a virtual network. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the virtual network. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -932,7 +932,7 @@ public async Task> ListBy /// Lists DNS forwarding ruleset resource IDs attached to a virtual network. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the virtual network. /// The maximum number of results to return. If not specified, returns up to 100 results. diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverDomainListsRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverDomainListsRestOperations.cs new file mode 100644 index 0000000000000..a8b4109551883 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverDomainListsRestOperations.cs @@ -0,0 +1,771 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DnsResolver.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + internal partial class DnsResolverDomainListsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DnsResolverDomainListsRestOperations. + /// 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 DnsResolverDomainListsRestOperations(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 ?? "2023-07-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, DnsResolverDomainListData data, string ifMatch, string ifNoneMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists/", false); + uri.AppendPath(dnsResolverDomainListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, DnsResolverDomainListData data, string ifMatch, string ifNoneMatch) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists/", false); + uri.AppendPath(dnsResolverDomainListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a DNS resolver domain list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver domain list. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, DnsResolverDomainListData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, dnsResolverDomainListName, data, ifMatch, ifNoneMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a DNS resolver domain list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver domain list. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, DnsResolverDomainListData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, dnsResolverDomainListName, data, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, DnsResolverDomainListPatch patch, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists/", false); + uri.AppendPath(dnsResolverDomainListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, DnsResolverDomainListPatch patch, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists/", false); + uri.AppendPath(dnsResolverDomainListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a DNS resolver domain list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver domain list. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, DnsResolverDomainListPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverDomainListName, patch, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a DNS resolver domain list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver domain list. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, DnsResolverDomainListPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverDomainListName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists/", false); + uri.AppendPath(dnsResolverDomainListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName, string ifMatch) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists/", false); + uri.AppendPath(dnsResolverDomainListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a DNS resolver domain list. WARNING: This operation cannot be undone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver domain list. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// 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 resourceGroupName, string dnsResolverDomainListName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsResolverDomainListName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a DNS resolver domain list. WARNING: This operation cannot be undone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver domain list. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// 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 resourceGroupName, string dnsResolverDomainListName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsResolverDomainListName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists/", false); + uri.AppendPath(dnsResolverDomainListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string dnsResolverDomainListName) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists/", false); + uri.AppendPath(dnsResolverDomainListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets properties of a DNS resolver domain list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver domain list. + /// 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 resourceGroupName, string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dnsResolverDomainListName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverDomainListData.DeserializeDnsResolverDomainListData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnsResolverDomainListData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets properties of a DNS resolver domain list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver domain list. + /// 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 resourceGroupName, string dnsResolverDomainListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverDomainListName, nameof(dnsResolverDomainListName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dnsResolverDomainListName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverDomainListData.DeserializeDnsResolverDomainListData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnsResolverDomainListData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? top) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists DNS resolver domain lists within a resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverDomainListResult.DeserializeDnsResolverDomainListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver domain lists within a resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverDomainListResult.DeserializeDnsResolverDomainListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverDomainLists", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, int? top) + { + 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.Network/dnsResolverDomainLists", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists DNS resolver domain lists in all resource groups of a subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverDomainListResult.DeserializeDnsResolverDomainListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver domain lists in all resource groups of a subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverDomainListResult.DeserializeDnsResolverDomainListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? top) + { + 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; + } + + /// Lists DNS resolver domain lists within a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverDomainListResult.DeserializeDnsResolverDomainListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver domain lists within a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverDomainListResult.DeserializeDnsResolverDomainListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, int? top) + { + 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; + } + + /// Lists DNS resolver domain lists in all resource groups of a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// 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, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverDomainListResult.DeserializeDnsResolverDomainListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver domain lists in all resource groups of a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// 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, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverDomainListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverDomainListResult.DeserializeDnsResolverDomainListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverPoliciesRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverPoliciesRestOperations.cs new file mode 100644 index 0000000000000..341bd4a07a10b --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverPoliciesRestOperations.cs @@ -0,0 +1,949 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DnsResolver.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + internal partial class DnsResolverPoliciesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DnsResolverPoliciesRestOperations. + /// 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 DnsResolverPoliciesRestOperations(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 ?? "2023-07-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, DnsResolverPolicyData data, string ifMatch, string ifNoneMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, DnsResolverPolicyData data, string ifMatch, string ifNoneMatch) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, DnsResolverPolicyData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, data, ifMatch, ifNoneMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, DnsResolverPolicyData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, data, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, DnsResolverPolicyPatch patch, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, DnsResolverPolicyPatch patch, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, DnsResolverPolicyPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, patch, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, DnsResolverPolicyPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string ifMatch) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a DNS resolver policy. WARNING: This operation cannot be undone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// 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 resourceGroupName, string dnsResolverPolicyName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a DNS resolver policy. WARNING: This operation cannot be undone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// 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 resourceGroupName, string dnsResolverPolicyName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets properties of a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// 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 resourceGroupName, string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverPolicyData.DeserializeDnsResolverPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnsResolverPolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets properties of a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// 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 resourceGroupName, string dnsResolverPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverPolicyData.DeserializeDnsResolverPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnsResolverPolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, int? top) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists DNS resolver policies within a resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverPolicyListResult.DeserializeDnsResolverPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver policies within a resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverPolicyListResult.DeserializeDnsResolverPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, int? top) + { + 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.Network/dnsResolverPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists DNS resolver policies in all resource groups of a subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverPolicyListResult.DeserializeDnsResolverPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver policies in all resource groups of a subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverPolicyListResult.DeserializeDnsResolverPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByVirtualNetworkRequestUri(string subscriptionId, string resourceGroupName, string virtualNetworkName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/virtualNetworks/", false); + uri.AppendPath(virtualNetworkName, true); + uri.AppendPath("/listDnsResolverPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByVirtualNetworkRequest(string subscriptionId, string resourceGroupName, string virtualNetworkName) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/virtualNetworks/", false); + uri.AppendPath(virtualNetworkName, true); + uri.AppendPath("/listDnsResolverPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists DNS resolver policy resource IDs linked to a virtual network. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the virtual network. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByVirtualNetworkAsync(string subscriptionId, string resourceGroupName, string virtualNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var message = CreateListByVirtualNetworkRequest(subscriptionId, resourceGroupName, virtualNetworkName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubResourceListResult.DeserializeSubResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver policy resource IDs linked to a virtual network. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the virtual network. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByVirtualNetwork(string subscriptionId, string resourceGroupName, string virtualNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var message = CreateListByVirtualNetworkRequest(subscriptionId, resourceGroupName, virtualNetworkName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubResourceListResult.DeserializeSubResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, int? top) + { + 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; + } + + /// Lists DNS resolver policies within a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverPolicyListResult.DeserializeDnsResolverPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver policies within a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverPolicyListResult.DeserializeDnsResolverPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, int? top) + { + 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; + } + + /// Lists DNS resolver policies in all resource groups of a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// 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, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverPolicyListResult.DeserializeDnsResolverPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver policies in all resource groups of a subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// 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, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverPolicyListResult.DeserializeDnsResolverPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByVirtualNetworkNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string virtualNetworkName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByVirtualNetworkNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string virtualNetworkName) + { + 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; + } + + /// Lists DNS resolver policy resource IDs linked to a virtual network. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the virtual network. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByVirtualNetworkNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string virtualNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var message = CreateListByVirtualNetworkNextPageRequest(nextLink, subscriptionId, resourceGroupName, virtualNetworkName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SubResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SubResourceListResult.DeserializeSubResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver policy resource IDs linked to a virtual network. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the virtual network. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByVirtualNetworkNextPage(string nextLink, string subscriptionId, string resourceGroupName, string virtualNetworkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(virtualNetworkName, nameof(virtualNetworkName)); + + using var message = CreateListByVirtualNetworkNextPageRequest(nextLink, subscriptionId, resourceGroupName, virtualNetworkName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SubResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SubResourceListResult.DeserializeSubResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverPolicyVirtualNetworkLinksRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverPolicyVirtualNetworkLinksRestOperations.cs new file mode 100644 index 0000000000000..fd68efd24af96 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolverPolicyVirtualNetworkLinksRestOperations.cs @@ -0,0 +1,649 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DnsResolver.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + internal partial class DnsResolverPolicyVirtualNetworkLinksRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DnsResolverPolicyVirtualNetworkLinksRestOperations. + /// 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 DnsResolverPolicyVirtualNetworkLinksRestOperations(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 ?? "2023-07-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkData data, string ifMatch, string ifNoneMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks/", false); + uri.AppendPath(dnsResolverPolicyVirtualNetworkLinkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkData data, string ifMatch, string ifNoneMatch) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks/", false); + uri.AppendPath(dnsResolverPolicyVirtualNetworkLinkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a DNS resolver policy virtual network link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsResolverPolicyVirtualNetworkLinkName, data, ifMatch, ifNoneMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a DNS resolver policy virtual network link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsResolverPolicyVirtualNetworkLinkName, data, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkPatch patch, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks/", false); + uri.AppendPath(dnsResolverPolicyVirtualNetworkLinkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkPatch patch, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks/", false); + uri.AppendPath(dnsResolverPolicyVirtualNetworkLinkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a DNS resolver policy virtual network link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsResolverPolicyVirtualNetworkLinkName, patch, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a DNS resolver policy virtual network link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, DnsResolverPolicyVirtualNetworkLinkPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsResolverPolicyVirtualNetworkLinkName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks/", false); + uri.AppendPath(dnsResolverPolicyVirtualNetworkLinkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, string ifMatch) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks/", false); + uri.AppendPath(dnsResolverPolicyVirtualNetworkLinkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a DNS resolver policy virtual network link. WARNING: This operation cannot be undone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// 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 resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsResolverPolicyVirtualNetworkLinkName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a DNS resolver policy virtual network link. WARNING: This operation cannot be undone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// 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 resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsResolverPolicyVirtualNetworkLinkName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks/", false); + uri.AppendPath(dnsResolverPolicyVirtualNetworkLinkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks/", false); + uri.AppendPath(dnsResolverPolicyVirtualNetworkLinkName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets properties of a DNS resolver policy virtual network link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// 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 resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsResolverPolicyVirtualNetworkLinkName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyVirtualNetworkLinkData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverPolicyVirtualNetworkLinkData.DeserializeDnsResolverPolicyVirtualNetworkLinkData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnsResolverPolicyVirtualNetworkLinkData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets properties of a DNS resolver policy virtual network link. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS resolver policy virtual network link for the DNS resolver policy. + /// 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 resourceGroupName, string dnsResolverPolicyName, string dnsResolverPolicyVirtualNetworkLinkName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyVirtualNetworkLinkName, nameof(dnsResolverPolicyVirtualNetworkLinkName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsResolverPolicyVirtualNetworkLinkName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyVirtualNetworkLinkData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverPolicyVirtualNetworkLinkData.DeserializeDnsResolverPolicyVirtualNetworkLinkData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnsResolverPolicyVirtualNetworkLinkData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/virtualNetworkLinks", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists DNS resolver policy virtual network links. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyVirtualNetworkLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverPolicyVirtualNetworkLinkListResult.DeserializeDnsResolverPolicyVirtualNetworkLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver policy virtual network links. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyVirtualNetworkLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverPolicyVirtualNetworkLinkListResult.DeserializeDnsResolverPolicyVirtualNetworkLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top) + { + 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; + } + + /// Lists DNS resolver policy virtual network links. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, dnsResolverPolicyName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyVirtualNetworkLinkListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsResolverPolicyVirtualNetworkLinkListResult.DeserializeDnsResolverPolicyVirtualNetworkLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS resolver policy virtual network links. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, dnsResolverPolicyName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsResolverPolicyVirtualNetworkLinkListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsResolverPolicyVirtualNetworkLinkListResult.DeserializeDnsResolverPolicyVirtualNetworkLinkListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolversRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolversRestOperations.cs index 0090db7fa7d25..80959dac5538f 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolversRestOperations.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsResolversRestOperations.cs @@ -32,7 +32,7 @@ public DnsResolversRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-07-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -83,7 +83,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// Parameters supplied to the CreateOrUpdate operation. @@ -113,7 +113,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// Parameters supplied to the CreateOrUpdate operation. @@ -185,7 +185,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// Parameters supplied to the Update operation. @@ -213,7 +213,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// Parameters supplied to the Update operation. @@ -279,7 +279,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a DNS resolver. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. @@ -306,7 +306,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a DNS resolver. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. @@ -367,7 +367,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets properties of a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The cancellation token to use. @@ -398,7 +398,7 @@ public async Task> GetAsync(string subscriptionId, str } /// Gets properties of a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The cancellation token to use. @@ -469,7 +469,7 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str } /// Lists DNS resolvers within a resource group. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. @@ -497,7 +497,7 @@ public async Task> ListByResourceGroupAsync(stri } /// Lists DNS resolvers within a resource group. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. @@ -561,7 +561,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, int? top) } /// Lists DNS resolvers in all resource groups of a subscription. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. /// is null. @@ -587,7 +587,7 @@ public async Task> ListAsync(string subscription } /// Lists DNS resolvers in all resource groups of a subscription. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. /// is null. @@ -657,7 +657,7 @@ internal HttpMessage CreateListByVirtualNetworkRequest(string subscriptionId, st } /// Lists DNS resolver resource IDs linked to a virtual network. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the virtual network. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -687,7 +687,7 @@ public async Task> ListByVirtualNetworkAsync(str } /// Lists DNS resolver resource IDs linked to a virtual network. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the virtual network. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -740,7 +740,7 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// Lists DNS resolvers within a resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. @@ -770,7 +770,7 @@ public async Task> ListByResourceGroupNextPageAs /// Lists DNS resolvers within a resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. @@ -822,7 +822,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists DNS resolvers in all resource groups of a subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. /// or is null. @@ -850,7 +850,7 @@ public async Task> ListNextPageAsync(string next /// Lists DNS resolvers in all resource groups of a subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The maximum number of results to return. If not specified, returns up to 100 results. /// The cancellation token to use. /// or is null. @@ -900,7 +900,7 @@ internal HttpMessage CreateListByVirtualNetworkNextPageRequest(string nextLink, /// Lists DNS resolver resource IDs linked to a virtual network. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the virtual network. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -932,7 +932,7 @@ public async Task> ListByVirtualNetworkNextPageA /// Lists DNS resolver resource IDs linked to a virtual network. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the virtual network. /// The maximum number of results to return. If not specified, returns up to 100 results. diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsSecurityRulesRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsSecurityRulesRestOperations.cs new file mode 100644 index 0000000000000..777bda40209a5 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/DnsSecurityRulesRestOperations.cs @@ -0,0 +1,649 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DnsResolver.Models; + +namespace Azure.ResourceManager.DnsResolver +{ + internal partial class DnsSecurityRulesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DnsSecurityRulesRestOperations. + /// 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 DnsSecurityRulesRestOperations(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 ?? "2023-07-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, DnsSecurityRuleData data, string ifMatch, string ifNoneMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules/", false); + uri.AppendPath(dnsSecurityRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, DnsSecurityRuleData data, string ifMatch, string ifNoneMatch) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules/", false); + uri.AppendPath(dnsSecurityRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a DNS security rule for a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS security rule. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, DnsSecurityRuleData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsSecurityRuleName, data, ifMatch, ifNoneMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a DNS security rule for a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS security rule. + /// Parameters supplied to the CreateOrUpdate operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new resource to be created, but to prevent updating an existing resource. Other values will be ignored. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, DnsSecurityRuleData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsSecurityRuleName, data, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, DnsSecurityRulePatch patch, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules/", false); + uri.AppendPath(dnsSecurityRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, DnsSecurityRulePatch patch, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules/", false); + uri.AppendPath(dnsSecurityRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a DNS security rule. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS security rule. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, DnsSecurityRulePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsSecurityRuleName, patch, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a DNS security rule. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS security rule. + /// Parameters supplied to the Update operation. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, DnsSecurityRulePatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsSecurityRuleName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, string ifMatch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules/", false); + uri.AppendPath(dnsSecurityRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, string ifMatch) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules/", false); + uri.AppendPath(dnsSecurityRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a DNS security rule for a DNS resolver policy. WARNING: This operation cannot be undone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS security rule. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// 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 resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsSecurityRuleName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a DNS security rule for a DNS resolver policy. WARNING: This operation cannot be undone. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS security rule. + /// ETag of the resource. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. + /// 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 resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsSecurityRuleName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules/", false); + uri.AppendPath(dnsSecurityRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules/", false); + uri.AppendPath(dnsSecurityRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets properties of a DNS security rule for a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS security rule. + /// 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 resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsSecurityRuleName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsSecurityRuleData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsSecurityRuleData.DeserializeDnsSecurityRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnsSecurityRuleData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets properties of a DNS security rule for a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The name of the DNS security rule. + /// 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 resourceGroupName, string dnsResolverPolicyName, string dnsSecurityRuleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + Argument.AssertNotNullOrEmpty(dnsSecurityRuleName, nameof(dnsSecurityRuleName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, dnsSecurityRuleName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsSecurityRuleData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsSecurityRuleData.DeserializeDnsSecurityRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnsSecurityRuleData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top) + { + 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("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Network/dnsResolverPolicies/", false); + uri.AppendPath(dnsResolverPolicyName, true); + uri.AppendPath("/dnsSecurityRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists DNS security rules for a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsSecurityRuleListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsSecurityRuleListResult.DeserializeDnsSecurityRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS security rules for a DNS resolver policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, dnsResolverPolicyName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsSecurityRuleListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsSecurityRuleListResult.DeserializeDnsSecurityRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top) + { + 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; + } + + /// Lists DNS security rules for a DNS resolver policy. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, dnsResolverPolicyName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnsSecurityRuleListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnsSecurityRuleListResult.DeserializeDnsSecurityRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists DNS security rules for a DNS resolver policy. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS resolver policy. + /// The maximum number of results to return. If not specified, returns up to 100 results. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string dnsResolverPolicyName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dnsResolverPolicyName, nameof(dnsResolverPolicyName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, dnsResolverPolicyName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnsSecurityRuleListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnsSecurityRuleListResult.DeserializeDnsSecurityRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/ForwardingRulesRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/ForwardingRulesRestOperations.cs index 15a969e1a0534..5259d0fb36a7b 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/ForwardingRulesRestOperations.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/ForwardingRulesRestOperations.cs @@ -32,7 +32,7 @@ public ForwardingRulesRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-07-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -87,7 +87,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates a forwarding rule in a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the forwarding rule. @@ -123,7 +123,7 @@ public async Task> CreateOrUpdateAsync(string su } /// Creates or updates a forwarding rule in a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the forwarding rule. @@ -205,7 +205,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates a forwarding rule in a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the forwarding rule. @@ -239,7 +239,7 @@ public async Task> UpdateAsync(string subscripti } /// Updates a forwarding rule in a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the forwarding rule. @@ -315,7 +315,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a forwarding rule in a DNS forwarding ruleset. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the forwarding rule. @@ -343,7 +343,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a forwarding rule in a DNS forwarding ruleset. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the forwarding rule. @@ -409,7 +409,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets properties of a forwarding rule in a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the forwarding rule. @@ -442,7 +442,7 @@ public async Task> GetAsync(string subscriptionI } /// Gets properties of a forwarding rule in a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the forwarding rule. @@ -519,7 +519,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists forwarding rules in a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -549,7 +549,7 @@ public async Task> ListAsync(string subscript } /// Lists forwarding rules in a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -602,7 +602,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists forwarding rules in a DNS forwarding ruleset. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -634,7 +634,7 @@ public async Task> ListNextPageAsync(string n /// Lists forwarding rules in a DNS forwarding ruleset. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The maximum number of results to return. If not specified, returns up to 100 results. diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/InboundEndpointsRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/InboundEndpointsRestOperations.cs index a2e7f9d3a2b10..e4ff89cdb3836 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/InboundEndpointsRestOperations.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/InboundEndpointsRestOperations.cs @@ -32,7 +32,7 @@ public InboundEndpointsRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-07-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -87,7 +87,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates an inbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the inbound endpoint for the DNS resolver. @@ -119,7 +119,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates an inbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the inbound endpoint for the DNS resolver. @@ -197,7 +197,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an inbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the inbound endpoint for the DNS resolver. @@ -227,7 +227,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates an inbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the inbound endpoint for the DNS resolver. @@ -299,7 +299,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes an inbound endpoint for a DNS resolver. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the inbound endpoint for the DNS resolver. @@ -328,7 +328,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes an inbound endpoint for a DNS resolver. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the inbound endpoint for the DNS resolver. @@ -395,7 +395,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets properties of an inbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the inbound endpoint for the DNS resolver. @@ -428,7 +428,7 @@ public async Task> GetAsync(string subs } /// Gets properties of an inbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the inbound endpoint for the DNS resolver. @@ -505,7 +505,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists inbound endpoints for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -535,7 +535,7 @@ public async Task> ListAsync(string subscrip } /// Lists inbound endpoints for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -588,7 +588,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists inbound endpoints for a DNS resolver. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -620,7 +620,7 @@ public async Task> ListNextPageAsync(string /// Lists inbound endpoints for a DNS resolver. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The maximum number of results to return. If not specified, returns up to 100 results. diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/OutboundEndpointsRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/OutboundEndpointsRestOperations.cs index 737e0ddb1a4a3..c11e7cfa7ef57 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/OutboundEndpointsRestOperations.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/OutboundEndpointsRestOperations.cs @@ -32,7 +32,7 @@ public OutboundEndpointsRestOperations(HttpPipeline pipeline, string application { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-07-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -87,7 +87,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates an outbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the outbound endpoint for the DNS resolver. @@ -119,7 +119,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates an outbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the outbound endpoint for the DNS resolver. @@ -197,7 +197,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates an outbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the outbound endpoint for the DNS resolver. @@ -227,7 +227,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates an outbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the outbound endpoint for the DNS resolver. @@ -299,7 +299,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes an outbound endpoint for a DNS resolver. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the outbound endpoint for the DNS resolver. @@ -328,7 +328,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes an outbound endpoint for a DNS resolver. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the outbound endpoint for the DNS resolver. @@ -395,7 +395,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets properties of an outbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the outbound endpoint for the DNS resolver. @@ -428,7 +428,7 @@ public async Task> GetAsync(string sub } /// Gets properties of an outbound endpoint for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The name of the outbound endpoint for the DNS resolver. @@ -505,7 +505,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists outbound endpoints for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -535,7 +535,7 @@ public async Task> ListAsync(string subscri } /// Lists outbound endpoints for a DNS resolver. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -588,7 +588,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists outbound endpoints for a DNS resolver. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -620,7 +620,7 @@ public async Task> ListNextPageAsync(string /// Lists outbound endpoints for a DNS resolver. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS resolver. /// The maximum number of results to return. If not specified, returns up to 100 results. diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/VirtualNetworkLinksRestOperations.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/VirtualNetworkLinksRestOperations.cs index c7cf10b302b1c..323e6c80eb0d0 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/VirtualNetworkLinksRestOperations.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/RestOperations/VirtualNetworkLinksRestOperations.cs @@ -32,7 +32,7 @@ public VirtualNetworkLinksRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-07-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -87,7 +87,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates a virtual network link to a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the virtual network link. @@ -119,7 +119,7 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } /// Creates or updates a virtual network link to a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the virtual network link. @@ -197,7 +197,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates a virtual network link to a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the virtual network link. @@ -227,7 +227,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Updates a virtual network link to a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the virtual network link. @@ -299,7 +299,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a virtual network link to a DNS forwarding ruleset. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the virtual network link. @@ -328,7 +328,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a virtual network link to a DNS forwarding ruleset. WARNING: This operation cannot be undone. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the virtual network link. @@ -395,7 +395,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets properties of a virtual network link to a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the virtual network link. @@ -428,7 +428,7 @@ public async Task> GetAsync } /// Gets properties of a virtual network link to a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The name of the virtual network link. @@ -505,7 +505,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Lists virtual network links to a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -535,7 +535,7 @@ public async Task> ListAsync(string subsc } /// Lists virtual network links to a DNS forwarding ruleset. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -588,7 +588,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists virtual network links to a DNS forwarding ruleset. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The maximum number of results to return. If not specified, returns up to 100 results. @@ -620,7 +620,7 @@ public async Task> ListNextPageAsync(stri /// Lists virtual network links to a DNS forwarding ruleset. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the DNS forwarding ruleset. /// The maximum number of results to return. If not specified, returns up to 100 results. diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/VirtualNetworkDnsResolverResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/VirtualNetworkDnsResolverResource.cs index 19e93e1018bbb..22ac369eb7f42 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/VirtualNetworkDnsResolverResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/VirtualNetworkDnsResolverResource.cs @@ -37,6 +37,8 @@ internal static ResourceIdentifier CreateResourceIdentifier(string subscriptionI private readonly DnsResolversRestOperations _dnsResolverRestClient; private readonly ClientDiagnostics _dnsForwardingRulesetClientDiagnostics; private readonly DnsForwardingRulesetsRestOperations _dnsForwardingRulesetRestClient; + private readonly ClientDiagnostics _dnsResolverPolicyClientDiagnostics; + private readonly DnsResolverPoliciesRestOperations _dnsResolverPolicyRestClient; /// Initializes a new instance of the class for mocking. protected VirtualNetworkDnsResolverResource() @@ -54,6 +56,9 @@ internal VirtualNetworkDnsResolverResource(ArmClient client, ResourceIdentifier _dnsForwardingRulesetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsForwardingRulesetResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(DnsForwardingRulesetResource.ResourceType, out string dnsForwardingRulesetApiVersion); _dnsForwardingRulesetRestClient = new DnsForwardingRulesetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsForwardingRulesetApiVersion); + _dnsResolverPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DnsResolver", DnsResolverPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DnsResolverPolicyResource.ResourceType, out string dnsResolverPolicyApiVersion); + _dnsResolverPolicyRestClient = new DnsResolverPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsResolverPolicyApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -81,7 +86,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -112,7 +117,7 @@ public virtual AsyncPageable GetDnsResolversAsync(int? top /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -143,7 +148,7 @@ public virtual Pageable GetDnsResolvers(int? top = null, Ca /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -174,7 +179,7 @@ public virtual AsyncPageable GetDnsForwardin /// /// /// Default Api Version - /// 2022-07-01 + /// 2023-07-01-preview /// /// /// Resource @@ -191,5 +196,65 @@ public virtual Pageable GetDnsForwardingRule HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsForwardingRulesetRestClient.CreateListByVirtualNetworkNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, top); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => VirtualNetworkDnsForwardingRuleset.DeserializeVirtualNetworkDnsForwardingRuleset(e), _dnsForwardingRulesetClientDiagnostics, Pipeline, "VirtualNetworkDnsResolverResource.GetDnsForwardingRulesets", "value", "nextLink", cancellationToken); } + + /// + /// Lists DNS resolver policy resource IDs linked to a virtual network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolverPolicies + /// + /// + /// Operation Id + /// DnsResolverPolicies_ListByVirtualNetwork + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDnsResolverPoliciesByVirtualNetworkAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsResolverPolicyRestClient.CreateListByVirtualNetworkRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsResolverPolicyRestClient.CreateListByVirtualNetworkNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _dnsResolverPolicyClientDiagnostics, Pipeline, "VirtualNetworkDnsResolverResource.GetDnsResolverPoliciesByVirtualNetwork", "value", "nextLink", cancellationToken); + } + + /// + /// Lists DNS resolver policy resource IDs linked to a virtual network. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsResolverPolicies + /// + /// + /// Operation Id + /// DnsResolverPolicies_ListByVirtualNetwork + /// + /// + /// Default Api Version + /// 2023-07-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDnsResolverPoliciesByVirtualNetwork(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsResolverPolicyRestClient.CreateListByVirtualNetworkRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsResolverPolicyRestClient.CreateListByVirtualNetworkNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _dnsResolverPolicyClientDiagnostics, Pipeline, "VirtualNetworkDnsResolverResource.GetDnsResolverPoliciesByVirtualNetwork", "value", "nextLink", cancellationToken); + } } } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md index 8d1e1544a6da6..a20c7b8e63f45 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md @@ -4,7 +4,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true -require: https://github.com/Azure/azure-rest-api-specs/blob/a9e895ccfe29d0646795f7ff1cb78e185bd09529/specification/dnsresolver/resource-manager/readme.md +require: C:\Git\jamesvoong-azure-rest-api-specs\specification\dnsresolver\resource-manager\readme.md library-name: dnsresolver namespace: Azure.ResourceManager.DnsResolver output-folder: $(this-folder)/Generated diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverDomainListTests.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverDomainListTests.cs new file mode 100644 index 0000000000000..ab70268f697ec --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverDomainListTests.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources.Models; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; + +namespace Azure.ResourceManager.DnsResolver.Tests +{ + public class DnsResolverDomainListTests : DnsResolverTestBase + { + private DnsResolverDomainListCollection _dnsResolverDomainListCollection; + + public DnsResolverDomainListTests(bool async) : base(async)//, RecordedTestMode.Record) + { + } + + public async Task CreateDnsResolverDomainListCollectionAsync() + { + var subscription = await Client.GetSubscriptions().GetAsync(TestEnvironment.SubscriptionId); + var resourceGroup = await CreateResourceGroupAsync(); + + _dnsResolverDomainListCollection = resourceGroup.GetDnsResolverDomainLists(); + } + + [Test] + [RecordedTest] + public async Task CreateDnsResolverDomainListAsync() + { + // ARRANGE + var dnsResolverDomainListName = Recording.GenerateAssetName("dnsResolverDomainList-"); + await CreateDnsResolverDomainListCollectionAsync(); + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "test.com.", "env.com." }); + + // ACT + var dnsResolverDomainList = await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData); + + // ASSERT + Assert.AreEqual(dnsResolverDomainList.Value.Data.ProvisioningState, DnsResolverProvisioningState.Succeeded); + } + + [Test] + [RecordedTest] + public async Task GetDnsResolverDomainListAsync() + { + // ARRANGE + var dnsResolverDomainListName = Recording.GenerateAssetName("dnsResolverDomainList-"); + await CreateDnsResolverDomainListCollectionAsync(); + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "test.com.", "env.com." }); + + await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData); + + // ACT + var retrievedDnsResolverDomainList = await _dnsResolverDomainListCollection.GetAsync(dnsResolverDomainListName); + + // ASSERT + Assert.AreEqual(retrievedDnsResolverDomainList.Value.Data.Name, dnsResolverDomainListName); + } + + [Test] + [RecordedTest] + public async Task UpdateDnsResolverDomainListAsync() + { + // ARRANGE + var dnsResolverDomainListName = Recording.GenerateAssetName("dnsResolverDomainList-"); + var newTagKey = Recording.GenerateAlphaNumericId("tagKey"); + var newTagValue = Recording.GenerateAlphaNumericId("tagValue"); + await CreateDnsResolverDomainListCollectionAsync(); + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "test.com.", "env.com." }); + + var createdDnsResolverDomainList = await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData); + + // ACT + var patchedDnsResolverDomainList = await createdDnsResolverDomainList.Value.AddTagAsync(newTagKey, newTagValue); + + // ASSERT + CollectionAssert.AreEquivalent(new Dictionary { { newTagKey, newTagValue } }, patchedDnsResolverDomainList.Value.Data.Tags); + } + + [Test] + [RecordedTest] + public async Task RemoveDnsResolverDomainListAsync() + { + // ARRANGE + var dnsResolverDomainListName = Recording.GenerateAssetName("dnsResolverDomainList-"); + await CreateDnsResolverDomainListCollectionAsync(); + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "test.com." , "env.com."}); + + var dnsResolverDomainList = await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData); + + // ACT + await dnsResolverDomainList.Value.DeleteAsync(WaitUntil.Completed); + + // ASSERT + var getDnsResolverDomainListResult = await _dnsResolverDomainListCollection.ExistsAsync(dnsResolverDomainListName); + Assert.AreEqual(getDnsResolverDomainListResult.Value, false); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverPolicyTests.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverPolicyTests.cs new file mode 100644 index 0000000000000..955330a6d4066 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverPolicyTests.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources.Models; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; + +namespace Azure.ResourceManager.DnsResolver.Tests +{ + public class DnsResolverPolicyTests : DnsResolverTestBase + { + private DnsResolverPolicyCollection _dnsResolverPolicyCollection; + + public DnsResolverPolicyTests(bool async) : base(async)//, RecordedTestMode.Record) + { + } + + public async Task CreateDnsResolverPolicyCollectionAsync() + { + var subscription = await Client.GetSubscriptions().GetAsync(TestEnvironment.SubscriptionId); + var resourceGroup = await CreateResourceGroupAsync(); + + _dnsResolverPolicyCollection = resourceGroup.GetDnsResolverPolicies(); + } + + [Test] + [RecordedTest] + public async Task CreateDnsResolverPolicyAsync() + { + // ARRANGE + var dnsResolverPolicyName = Recording.GenerateAssetName("dnsResolverPolicy-"); + await CreateDnsResolverPolicyCollectionAsync(); + var dnsResolverPolicyData = new DnsResolverPolicyData(this.DefaultLocation); + + // ACT + var dnsResolverPolicy = await _dnsResolverPolicyCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyName, dnsResolverPolicyData); + + // ASSERT + Assert.AreEqual(dnsResolverPolicy.Value.Data.ProvisioningState, DnsResolverProvisioningState.Succeeded); + } + + [Test] + [RecordedTest] + public async Task GetDnsResolverPolicyAsync() + { + // ARRANGE + var dnsResolverPolicyName = Recording.GenerateAssetName("dnsResolverPolicy-"); + await CreateDnsResolverPolicyCollectionAsync(); + ; + var dnsResolverPolicyData = new DnsResolverPolicyData(this.DefaultLocation); + + await _dnsResolverPolicyCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyName, dnsResolverPolicyData); + + // ACT + var retrievedDnsResolverPolicy = await _dnsResolverPolicyCollection.GetAsync(dnsResolverPolicyName); + + // ASSERT + Assert.AreEqual(retrievedDnsResolverPolicy.Value.Data.Name, dnsResolverPolicyName); + } + + [Test] + [RecordedTest] + public async Task UpdateDnsResolverPolicyAsync() + { + // ARRANGE + var dnsResolverPolicyName = Recording.GenerateAssetName("dnsResolverPolicy-"); + var newTagKey = Recording.GenerateAlphaNumericId("tagKey"); + var newTagValue = Recording.GenerateAlphaNumericId("tagValue"); + await CreateDnsResolverPolicyCollectionAsync(); + var dnsResolverPolicyData = new DnsResolverPolicyData(this.DefaultLocation); + + var createdDnsResolverPolicy = await _dnsResolverPolicyCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyName, dnsResolverPolicyData); + + // ACT + var patchedDnsResolverPolicy = await createdDnsResolverPolicy.Value.AddTagAsync(newTagKey, newTagValue); + + // ASSERT + CollectionAssert.AreEquivalent(new Dictionary { { newTagKey, newTagValue } }, patchedDnsResolverPolicy.Value.Data.Tags); + } + + [Test] + [RecordedTest] + public async Task RemoveDnsResolverPolicyAsync() + { + // ARRANGE + var dnsResolverPolicyName = Recording.GenerateAssetName("dnsResolverPolicy-"); + await CreateDnsResolverPolicyCollectionAsync(); + var dnsResolverPolicyData = new DnsResolverPolicyData(this.DefaultLocation); + + var dnsResolverPolicy = await _dnsResolverPolicyCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyName, dnsResolverPolicyData); + + // ACT + await dnsResolverPolicy.Value.DeleteAsync(WaitUntil.Completed); + + // ASSERT + var getDnsResolverPolicyResult = await _dnsResolverPolicyCollection.ExistsAsync(dnsResolverPolicyName); + Assert.AreEqual(getDnsResolverPolicyResult.Value, false); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverTests.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverTests.cs index 36af1e8de427c..7b50a0199eae4 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverTests.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverTests.cs @@ -76,7 +76,6 @@ public async Task GetDnsResolverAsync() [Test] [RecordedTest] - [Ignore("Lack of testing resources")] public async Task UpdateDnsResolverAsync() { // ARRANGE From 02660d388208d267538ae2036ef25b8d63af1578 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 24 Sep 2024 16:08:16 -0700 Subject: [PATCH 02/17] Add rule and link tests --- .../tests/DnsResolverTestBase.cs | 1 + .../tests/Tests/DnsResolverPolicyLinkTests.cs | 130 ++++++++++++++ .../tests/Tests/DnsSecurityRuleTests.cs | 166 ++++++++++++++++++ 3 files changed, 297 insertions(+) create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverPolicyLinkTests.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsSecurityRuleTests.cs diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/DnsResolverTestBase.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/DnsResolverTestBase.cs index 04e505605fe9f..acd9569ad7166 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/DnsResolverTestBase.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/DnsResolverTestBase.cs @@ -18,6 +18,7 @@ public class DnsResolverTestBase : ManagementRecordedTestBase AzureLocation.AustraliaEast; + protected int DefaultDnsSecurityRulePriority => 100; protected ArmClient Client { get; private set; } protected SubscriptionResource DefaultSubscription { get; private set; } public DnsResolverTestBase(bool isAsync) : base(isAsync) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverPolicyLinkTests.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverPolicyLinkTests.cs new file mode 100644 index 0000000000000..aeb990b08da96 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverPolicyLinkTests.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +using System.Threading.Tasks; +using NUnit.Framework; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources.Models; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; +using System.Linq; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Tests +{ + public class DnsResolverPolicyLinkTests : DnsResolverTestBase + { + private DnsResolverPolicyCollection _dnsResolverPolicyCollection; + private DnsResolverPolicyResource _dnsResolverPolicy; + private string _dnsResolverPolicyName; + + public DnsResolverPolicyLinkTests(bool async) : base(async)//, RecordedTestMode.Record) + { + } + + public async Task CreateDnsResolverCollection() + { + var vnetName = Recording.GenerateAssetName("vnet-"); + _dnsResolverPolicyName = Recording.GenerateAssetName("dnsResolverPolicy-"); + var resourceGroup = await CreateResourceGroupAsync(); + _dnsResolverPolicyCollection = resourceGroup.GetDnsResolverPolicies(); + + await CreateVirtualNetworkAsync(); + _dnsResolverPolicy = await CreateDnsResolverPolicy(_dnsResolverPolicyName); + } + + private async Task CreateDnsResolverPolicy(string dnsResolverPolicyName) + { + var dnsResolverPolicyData = new DnsResolverPolicyData(this.DefaultLocation); + + return (await _dnsResolverPolicyCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyName, dnsResolverPolicyData)).Value; + } + + [Test] + [RecordedTest] + public async Task CreateDnsResolverPolicyLink() + { + // ARRANGE + var dnsResolverPolicyLinkName = Recording.GenerateAssetName("dnsResolverPolicyLink-"); + await CreateDnsResolverCollection(); + var dnsResolverPolicyLinkData = new DnsResolverPolicyVirtualNetworkLinkData(this.DefaultLocation, new WritableSubResource + { + Id = new ResourceIdentifier(DefaultVnetID), + }); + + // ACT + var createdDnsResolverPolicyLink = await _dnsResolverPolicy.GetDnsResolverPolicyVirtualNetworkLinks().CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyLinkName, dnsResolverPolicyLinkData); + + // ASSERT + Assert.AreEqual(createdDnsResolverPolicyLink.Value.Data.ProvisioningState, DnsResolverProvisioningState.Succeeded); + } + + [Test] + [RecordedTest] + public async Task GetDnsResolverPolicyLink() + { + // ARRANGE + var dnsResolverPolicyLinkName = Recording.GenerateAssetName("dnsResolverPolicyLink-"); + await CreateDnsResolverCollection(); + var dnsResolverPolicyLinkData = new DnsResolverPolicyVirtualNetworkLinkData(this.DefaultLocation, new WritableSubResource + { + Id = new ResourceIdentifier(DefaultVnetID), + }); + + await _dnsResolverPolicy.GetDnsResolverPolicyVirtualNetworkLinks().CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyLinkName, dnsResolverPolicyLinkData); + + // ACT + var retrievedDnsResolverPolicyLink = await _dnsResolverPolicy.GetDnsResolverPolicyVirtualNetworkLinks().GetAsync(dnsResolverPolicyLinkName); + + // ASSERT + Assert.AreEqual(retrievedDnsResolverPolicyLink.Value.Data.Name, dnsResolverPolicyLinkName); + } + + [Test] + [RecordedTest] + public async Task UpdateDnsResolverPolicyLink() + { + // ARRANGE + var dnsResolverPolicyLinkName = Recording.GenerateAssetName("dnsResolverPolicyLink-"); + var newTagKey = Recording.GenerateAlphaNumericId("tagKey"); + var newTagValue = Recording.GenerateAlphaNumericId("tagValue"); + await CreateDnsResolverCollection(); + var dnsResolverPolicyLinkData = new DnsResolverPolicyVirtualNetworkLinkData(this.DefaultLocation, new WritableSubResource + { + Id = new ResourceIdentifier(DefaultVnetID), + }); + + var createdDnsResolverPolicyLink = await _dnsResolverPolicy.GetDnsResolverPolicyVirtualNetworkLinks().CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyLinkName, dnsResolverPolicyLinkData); + + var patchableDnsResolverPolicyLinkData = new DnsResolverPolicyVirtualNetworkLinkPatch(); + patchableDnsResolverPolicyLinkData.Tags.Add(newTagKey, newTagValue); + + // ACT + var patchedDnsResolverPolicyLink = await createdDnsResolverPolicyLink.Value.UpdateAsync(WaitUntil.Completed, patchableDnsResolverPolicyLinkData); + + // ASSERT + CollectionAssert.AreEquivalent(patchedDnsResolverPolicyLink.Value.Data.Tags, patchableDnsResolverPolicyLinkData.Tags); + } + + [Test] + [RecordedTest] + public async Task RemoveDnsResolverPolicyLink() + { + // ARRANGE + var dnsResolverPolicyLinkName = Recording.GenerateAssetName("dnsResolverPolicyLink-"); + await CreateDnsResolverCollection(); + var dnsResolverPolicyLinkData = new DnsResolverPolicyVirtualNetworkLinkData(this.DefaultLocation, new WritableSubResource + { + Id = new ResourceIdentifier(DefaultVnetID), + }); + + var createdDnsResolverPolicyLink = await _dnsResolverPolicy.GetDnsResolverPolicyVirtualNetworkLinks().CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyLinkName, dnsResolverPolicyLinkData); + + // ACT + await createdDnsResolverPolicyLink.Value.DeleteAsync(WaitUntil.Completed); + + // ASSERT + var getDnsResolverPolicyLink = await _dnsResolverPolicy.GetDnsResolverPolicyVirtualNetworkLinks().ExistsAsync(dnsResolverPolicyLinkName); + Assert.AreEqual(getDnsResolverPolicyLink.Value, false); + } + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsSecurityRuleTests.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsSecurityRuleTests.cs new file mode 100644 index 0000000000000..73386e06f0093 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsSecurityRuleTests.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +using System.Threading.Tasks; +using NUnit.Framework; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources.Models; +using Azure.Core; +using Azure.ResourceManager.DnsResolver.Models; +using System.Linq; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DnsResolver.Tests +{ + public class DnsSecurityRuleTests : DnsResolverTestBase + { + private DnsResolverPolicyCollection _dnsResolverPolicyCollection; + private DnsResolverDomainListCollection _dnsResolverDomainListCollection; + private DnsResolverPolicyResource _dnsResolverPolicy; + private DnsResolverDomainListResource _dnsResolverDomainList; + private string _dnsResolverPolicyName; + private string _dnsResolverDomainListName; + + public DnsSecurityRuleTests(bool async) : base(async)//, RecordedTestMode.Record) + { + } + + public async Task CreateDnsResolverCollection() + { + _dnsResolverPolicyName = Recording.GenerateAssetName("dnsResolverPolicy-"); + _dnsResolverDomainListName = Recording.GenerateAssetName("dnsResolverDomainList-"); + var resourceGroup = await CreateResourceGroupAsync(); + _dnsResolverPolicyCollection = resourceGroup.GetDnsResolverPolicies(); + _dnsResolverDomainListCollection = resourceGroup.GetDnsResolverDomainLists(); + + _dnsResolverPolicy = await CreateDnsResolverPolicy(_dnsResolverPolicyName); + _dnsResolverDomainList = await CreateDnsResolverDomainList(_dnsResolverDomainListName); + } + + private async Task CreateDnsResolverPolicy(string dnsResolverPolicyName) + { + var dnsResolverPolicyData = new DnsResolverPolicyData(this.DefaultLocation); + + return (await _dnsResolverPolicyCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverPolicyName, dnsResolverPolicyData)).Value; + } + + private async Task CreateDnsResolverDomainList(string dnsResolverDomainListName) + { + var defaultDomains = new List() { "test.com.", "env.com." }; + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, defaultDomains); + + return (await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData)).Value; + } + + [Test] + [RecordedTest] + public async Task CreateDnsSecurityRule() + { + // ARRANGE + var dnsSecurityRuleName = Recording.GenerateAssetName("dnsSecurityRule-"); + await CreateDnsResolverCollection(); + var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = ActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; + + var dnsSecurityRuleData = new DnsSecurityRuleData(this.DefaultLocation, this.DefaultDnsSecurityRulePriority, dnsSecurityRuleAction, + new List { + new WritableSubResource + { + Id = new ResourceIdentifier(_dnsResolverDomainList.Id), + } + } + ); + + // ACT + var createdDnsSecurityRule = await _dnsResolverPolicy.GetDnsSecurityRules().CreateOrUpdateAsync(WaitUntil.Completed, dnsSecurityRuleName, dnsSecurityRuleData); + + // ASSERT + Assert.AreEqual(createdDnsSecurityRule.Value.Data.ProvisioningState, DnsResolverProvisioningState.Succeeded); + } + + [Test] + [RecordedTest] + public async Task GetDnsSecurityRule() + { + // ARRANGE + var dnsSecurityRuleName = Recording.GenerateAssetName("dnsSecurityRule-"); + await CreateDnsResolverCollection(); + var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = ActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; + + var dnsSecurityRuleData = new DnsSecurityRuleData(this.DefaultLocation, this.DefaultDnsSecurityRulePriority, dnsSecurityRuleAction, + new List { + new WritableSubResource + { + Id = new ResourceIdentifier(_dnsResolverDomainList.Id), + } + } + ); + + await _dnsResolverPolicy.GetDnsSecurityRules().CreateOrUpdateAsync(WaitUntil.Completed, dnsSecurityRuleName, dnsSecurityRuleData); + + // ACT + var retrievedDnsSecurityRule = await _dnsResolverPolicy.GetDnsSecurityRules().GetAsync(dnsSecurityRuleName); + + // ASSERT + Assert.AreEqual(retrievedDnsSecurityRule.Value.Data.Name, dnsSecurityRuleName); + } + + [Test] + [RecordedTest] + public async Task UpdateDnsSecurityRule() + { + // ARRANGE + var dnsSecurityRuleName = Recording.GenerateAssetName("dnsSecurityRule-"); + var newTagKey = Recording.GenerateAlphaNumericId("tagKey"); + var newTagValue = Recording.GenerateAlphaNumericId("tagValue"); + await CreateDnsResolverCollection(); + var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = ActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; + + var dnsSecurityRuleData = new DnsSecurityRuleData(this.DefaultLocation, this.DefaultDnsSecurityRulePriority, dnsSecurityRuleAction, + new List { + new WritableSubResource + { + Id = new ResourceIdentifier(_dnsResolverDomainList.Id), + } + } + ); + + var createdDnsSecurityRule = await _dnsResolverPolicy.GetDnsSecurityRules().CreateOrUpdateAsync(WaitUntil.Completed, dnsSecurityRuleName, dnsSecurityRuleData); + + var patchableDnsSecurityRuleData = new DnsSecurityRulePatch(); + patchableDnsSecurityRuleData.Tags.Add(newTagKey, newTagValue); + + // ACT + var patchedDnsSecurityRule = await createdDnsSecurityRule.Value.UpdateAsync(WaitUntil.Completed, patchableDnsSecurityRuleData); + + // ASSERT + CollectionAssert.AreEquivalent(patchedDnsSecurityRule.Value.Data.Tags, patchableDnsSecurityRuleData.Tags); + } + + [Test] + [RecordedTest] + public async Task RemoveDnsSecurityRule() + { + // ARRANGE + var dnsSecurityRuleName = Recording.GenerateAssetName("dnsSecurityRule-"); + await CreateDnsResolverCollection(); + var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = ActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; + + var dnsSecurityRuleData = new DnsSecurityRuleData(this.DefaultLocation, this.DefaultDnsSecurityRulePriority, dnsSecurityRuleAction, + new List { + new WritableSubResource + { + Id = new ResourceIdentifier(_dnsResolverDomainList.Id), + } + } + ); + + var createdDnsSecurityRule = await _dnsResolverPolicy.GetDnsSecurityRules().CreateOrUpdateAsync(WaitUntil.Completed, dnsSecurityRuleName, dnsSecurityRuleData); + + // ACT + await createdDnsSecurityRule.Value.DeleteAsync(WaitUntil.Completed); + + // ASSERT + var getDnsSecurityRule = await _dnsResolverPolicy.GetDnsSecurityRules().ExistsAsync(dnsSecurityRuleName); + Assert.AreEqual(getDnsSecurityRule.Value, false); + } + } +} From ecf5176a4c75725d0450d9bc453d43f2a4f1066b Mon Sep 17 00:00:00 2001 From: James Date: Fri, 4 Oct 2024 12:16:58 -0700 Subject: [PATCH 03/17] Fix test domain names and add to code owners and fix readme link to spec blob --- .github/CODEOWNERS | 5 ++++- .../Azure.ResourceManager.DnsResolver/src/autorest.md | 2 +- .../tests/Tests/DnsResolverDomainListTests.cs | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f1c658d4bdc97..65994e193c9ac 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -723,7 +723,7 @@ # ServiceOwners: @netwatchsuppgithub # PRLabel: %Network - DNS -/sdk/dns*/ @dnssuppgithub +/sdk/dns/ @dnssuppgithub # ServiceLabel: %Network - DNS # ServiceOwnerS: @dnssuppgithub @@ -743,6 +743,9 @@ # ServiceLabel: %Notification Hub # ServiceOwners: @tjsomasundaram +# PRLabel: %Network - DNS +/sdk/dnsresolver/ @jamesvoongms @jotrivet @harmen-msft @anilpuvvadi @arpit-gagneja + # PRLabel: %OpenAI /sdk/openai/ @jpalvarezl @trrwilson @joseharriaga @m-nash @ralph-msft diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md index a20c7b8e63f45..be89f1b39ce03 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md @@ -4,7 +4,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true -require: C:\Git\jamesvoong-azure-rest-api-specs\specification\dnsresolver\resource-manager\readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/b26a190235f162b15d77dad889d104d06871fb4f/specification/dnsresolver/resource-manager/readme.md library-name: dnsresolver namespace: Azure.ResourceManager.DnsResolver output-folder: $(this-folder)/Generated diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverDomainListTests.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverDomainListTests.cs index ab70268f697ec..e9b3be0c46986 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverDomainListTests.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsResolverDomainListTests.cs @@ -34,7 +34,7 @@ public async Task CreateDnsResolverDomainListAsync() // ARRANGE var dnsResolverDomainListName = Recording.GenerateAssetName("dnsResolverDomainList-"); await CreateDnsResolverDomainListCollectionAsync(); - var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "test.com.", "env.com." }); + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "example.com.", "contoso.com." }); // ACT var dnsResolverDomainList = await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData); @@ -50,7 +50,7 @@ public async Task GetDnsResolverDomainListAsync() // ARRANGE var dnsResolverDomainListName = Recording.GenerateAssetName("dnsResolverDomainList-"); await CreateDnsResolverDomainListCollectionAsync(); - var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "test.com.", "env.com." }); + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "example.com.", "contoso.com." }); await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData); @@ -70,7 +70,7 @@ public async Task UpdateDnsResolverDomainListAsync() var newTagKey = Recording.GenerateAlphaNumericId("tagKey"); var newTagValue = Recording.GenerateAlphaNumericId("tagValue"); await CreateDnsResolverDomainListCollectionAsync(); - var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "test.com.", "env.com." }); + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "example.com.", "contoso.com." }); var createdDnsResolverDomainList = await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData); @@ -88,7 +88,7 @@ public async Task RemoveDnsResolverDomainListAsync() // ARRANGE var dnsResolverDomainListName = Recording.GenerateAssetName("dnsResolverDomainList-"); await CreateDnsResolverDomainListCollectionAsync(); - var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "test.com." , "env.com."}); + var dnsResolverDomainListData = new DnsResolverDomainListData(this.DefaultLocation, new List() { "example.com." , "contoso.com."}); var dnsResolverDomainList = await _dnsResolverDomainListCollection.CreateOrUpdateAsync(WaitUntil.Completed, dnsResolverDomainListName, dnsResolverDomainListData); From 60b67fe14a2d8251d3f8bd6a65f3e834c4d250c9 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 4 Oct 2024 16:07:31 -0700 Subject: [PATCH 04/17] Fix CODEOWNERS for dns resolver --- .github/CODEOWNERS | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 65994e193c9ac..063e4278dc779 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -744,7 +744,10 @@ # ServiceOwners: @tjsomasundaram # PRLabel: %Network - DNS -/sdk/dnsresolver/ @jamesvoongms @jotrivet @harmen-msft @anilpuvvadi @arpit-gagneja +/sdk/dnsresolver/ @jamesvoongms @jotrivet + +# ServiceLabel: %Network - DNS Resolver +# ServiceOwners: @jamesvoongms @jotrivet # PRLabel: %OpenAI /sdk/openai/ @jpalvarezl @trrwilson @joseharriaga @m-nash @ralph-msft @@ -1018,6 +1021,12 @@ # ServiceLabel: %Network - Mobile %Mgmt # ServiceOwners: @ArthurMa1978 +# PRLabel: %Network - DNS Resolver +/sdk/dnsresolver/Azure.ResourceManager.*/ @jamesvoongms @jotrivet + +# ServiceLabel: %Network - DNS Resolver +# ServiceOwners: @jamesvoongms @jotrivet + # PRLabel: %Network - Cloud /sdk/networkcloud/Azure.ResourceManager.*/ @Azure/azure-sdk-write-networkcloud From c3dfd1bf8a3e26911b968730ae9c0c6527984539 Mon Sep 17 00:00:00 2001 From: jamesvoongms <104241521+jamesvoongms@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:00:52 -0700 Subject: [PATCH 05/17] Update .github/CODEOWNERS Co-authored-by: Jesse Squire --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c2ca5375c8803..b27be07cbab0c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1024,7 +1024,7 @@ # PRLabel: %Network - DNS Resolver /sdk/dnsresolver/Azure.ResourceManager.*/ @jamesvoongms @jotrivet -# ServiceLabel: %Network - DNS Resolver +# ServiceLabel: %Network - DNS Resolver %Mgmt # ServiceOwners: @jamesvoongms @jotrivet # PRLabel: %Network - Cloud From cd3981087681fef0e60245e6185b09d091381782 Mon Sep 17 00:00:00 2001 From: jamesvoongms <104241521+jamesvoongms@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:04:50 -0700 Subject: [PATCH 06/17] Update .github/CODEOWNERS Co-authored-by: Jesse Squire --- .github/CODEOWNERS | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b27be07cbab0c..37d001ffa75b2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -743,12 +743,6 @@ # ServiceLabel: %Notification Hub # ServiceOwners: @tjsomasundaram -# PRLabel: %Network - DNS -/sdk/dnsresolver/ @jamesvoongms @jotrivet - -# ServiceLabel: %Network - DNS Resolver -# ServiceOwners: @jamesvoongms @jotrivet - # PRLabel: %OpenAI /sdk/openai/ @jpalvarezl @trrwilson @joseharriaga @m-nash @ralph-msft From 4970154cb8113a1934e35cba27075ec87836130b Mon Sep 17 00:00:00 2001 From: James Date: Mon, 7 Oct 2024 10:08:59 -0700 Subject: [PATCH 07/17] Fix additional codeowner addition --- .github/CODEOWNERS | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 37d001ffa75b2..8e31894bd0576 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1021,12 +1021,6 @@ # ServiceLabel: %Network - DNS Resolver %Mgmt # ServiceOwners: @jamesvoongms @jotrivet -# PRLabel: %Network - Cloud -/sdk/networkcloud/Azure.ResourceManager.*/ @Azure/azure-sdk-write-networkcloud - -# ServiceLabel: %Network - Cloud %Mgmt -# ServiceOwners: @Azure/azure-sdk-write-networkcloud - # PRLabel: %New Relic /sdk/newrelicobservability/Azure.ResourceManager.*/ @dipeshbhakat-microsoft @vipray-ms From 4f0a10b739df3400279f9a14f56720f861b68d8b Mon Sep 17 00:00:00 2001 From: James Date: Mon, 7 Oct 2024 10:22:05 -0700 Subject: [PATCH 08/17] Add Servfail to cspell word list --- .vscode/cspell.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 05e4251aba332..095b11dac48d8 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -141,6 +141,7 @@ "referer", "renormalize", "retriable", + "Servfail", "setsas", "signalr", "signup", From e7b550d6914ebd151bb72ddd48a578c0e9585fbf Mon Sep 17 00:00:00 2001 From: James Date: Mon, 7 Oct 2024 10:38:16 -0700 Subject: [PATCH 09/17] Run Export-Api --- ...ourceManager.DnsResolver.netstandard2.0.cs | 9 +++ ...DnsResolverDomainListData.Serialization.cs | 60 ++++--------------- .../DnsResolverPolicyData.Serialization.cs | 60 ++++--------------- ...icyVirtualNetworkLinkData.Serialization.cs | 60 ++++--------------- .../DnsSecurityRuleData.Serialization.cs | 60 ++++--------------- .../src/Generated/Models/ActionType.cs | 2 +- .../src/Generated/Models/BlockResponseCode.cs | 2 +- ...nsResolverDomainListPatch.Serialization.cs | 11 +++- ...sResolverDomainListResult.Serialization.cs | 11 +++- ...sResolverPolicyListResult.Serialization.cs | 11 +++- .../DnsResolverPolicyPatch.Serialization.cs | 11 +++- ...tualNetworkLinkListResult.Serialization.cs | 11 +++- ...cyVirtualNetworkLinkPatch.Serialization.cs | 11 +++- .../DnsSecurityRuleAction.Serialization.cs | 11 +++- ...DnsSecurityRuleListResult.Serialization.cs | 11 +++- .../DnsSecurityRulePatch.Serialization.cs | 11 +++- .../Generated/Models/DnsSecurityRuleState.cs | 2 +- 17 files changed, 133 insertions(+), 221 deletions(-) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs index a651a8df78ea8..39251f92a9f25 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs @@ -220,6 +220,7 @@ public DnsResolverDomainListData(Azure.Core.AzureLocation location, System.Colle public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } public System.Guid? ResourceGuid { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.DnsResolverDomainListData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.DnsResolverDomainListData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -420,6 +421,7 @@ public DnsResolverPolicyData(Azure.Core.AzureLocation location) { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } public System.Guid? ResourceGuid { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.DnsResolverPolicyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.DnsResolverPolicyData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -480,6 +482,7 @@ public DnsResolverPolicyVirtualNetworkLinkData(Azure.Core.AzureLocation location public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } public Azure.Core.ResourceIdentifier VirtualNetworkId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.DnsResolverPolicyVirtualNetworkLinkData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -568,6 +571,7 @@ public DnsSecurityRuleData(Azure.Core.AzureLocation location, int priority, Azur public Azure.ETag? ETag { get { throw null; } } public int Priority { get { throw null; } set { } } public Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? ProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.DnsSecurityRuleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.DnsSecurityRuleData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -768,6 +772,7 @@ public partial class DnsResolverDomainListPatch : System.ClientModel.Primitives. public DnsResolverDomainListPatch() { } public System.Collections.Generic.IList Domains { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsResolverDomainListPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsResolverDomainListPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -811,6 +816,7 @@ public partial class DnsResolverPolicyPatch : System.ClientModel.Primitives.IJso { public DnsResolverPolicyPatch() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -821,6 +827,7 @@ public partial class DnsResolverPolicyVirtualNetworkLinkPatch : System.ClientMod { public DnsResolverPolicyVirtualNetworkLinkPatch() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyVirtualNetworkLinkPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsResolverPolicyVirtualNetworkLinkPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -872,6 +879,7 @@ public partial class DnsSecurityRuleAction : System.ClientModel.Primitives.IJson public DnsSecurityRuleAction() { } public Azure.ResourceManager.DnsResolver.Models.ActionType? ActionType { get { throw null; } set { } } public Azure.ResourceManager.DnsResolver.Models.BlockResponseCode? BlockResponseCode { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -886,6 +894,7 @@ public DnsSecurityRulePatch() { } public Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleState? DnsSecurityRuleState { get { throw null; } set { } } public int? Priority { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsSecurityRulePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsSecurityRulePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.Serialization.cs index a0ef0029de7b9..37ea80af12ba2 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverDomainListData.Serialization.cs @@ -20,6 +20,15 @@ public partial class DnsResolverDomainListData : IUtf8JsonSerializable, IJsonMod void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,45 +36,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(DnsResolverDomainListData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("domains"u8); @@ -86,22 +62,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea writer.WriteStringValue(ResourceGuid.Value); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } DnsResolverDomainListData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.Serialization.cs index 64ba64c1345a9..9c120800f4b7c 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyData.Serialization.cs @@ -20,6 +20,15 @@ public partial class DnsResolverPolicyData : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,45 +36,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW throw new FormatException($"The model {nameof(DnsResolverPolicyData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) @@ -79,22 +55,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW writer.WriteStringValue(ResourceGuid.Value); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } DnsResolverPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.Serialization.cs index 8d8cddb23c610..09e8196fa4034 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverPolicyVirtualNetworkLinkData.Serialization.cs @@ -21,6 +21,15 @@ public partial class DnsResolverPolicyVirtualNetworkLinkData : IUtf8JsonSerializ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -28,45 +37,12 @@ void IJsonModel.Write(Utf8JsonWriter wr throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("virtualNetwork"u8); @@ -77,22 +53,6 @@ void IJsonModel.Write(Utf8JsonWriter wr writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } DnsResolverPolicyVirtualNetworkLinkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.Serialization.cs index 22cb108cdd79f..50bce91b5f8e9 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsSecurityRuleData.Serialization.cs @@ -21,6 +21,15 @@ public partial class DnsSecurityRuleData : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -28,45 +37,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(DnsSecurityRuleData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (options.Format != "W" && Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("priority"u8); @@ -91,22 +67,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } DnsSecurityRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs index 39ea855c89c55..9a6b07de1ecd4 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs @@ -36,7 +36,7 @@ public ActionType(string value) public static bool operator ==(ActionType left, ActionType right) => left.Equals(right); /// Determines if two values are not the same. public static bool operator !=(ActionType left, ActionType right) => !left.Equals(right); - /// Converts a string to a . + /// Converts a to a . public static implicit operator ActionType(string value) => new ActionType(value); /// diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/BlockResponseCode.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/BlockResponseCode.cs index 4f6955a8023fd..d90e68da243ea 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/BlockResponseCode.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/BlockResponseCode.cs @@ -30,7 +30,7 @@ public BlockResponseCode(string value) public static bool operator ==(BlockResponseCode left, BlockResponseCode right) => left.Equals(right); /// Determines if two values are not the same. public static bool operator !=(BlockResponseCode left, BlockResponseCode right) => !left.Equals(right); - /// Converts a string to a . + /// Converts a to a . public static implicit operator BlockResponseCode(string value) => new BlockResponseCode(value); /// diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.Serialization.cs index 6bf5c78004fc4..ae2935aee9c22 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListPatch.Serialization.cs @@ -18,6 +18,15 @@ public partial class DnsResolverDomainListPatch : IUtf8JsonSerializable, IJsonMo void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe throw new FormatException($"The model {nameof(DnsResolverDomainListPatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -65,7 +73,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe #endif } } - writer.WriteEndObject(); } DnsResolverDomainListPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.Serialization.cs index 05c394959299d..c1e7f451e27c0 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverDomainListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class DnsResolverDomainListResult : IUtf8JsonSerializable, IJso void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR throw new FormatException($"The model {nameof(DnsResolverDomainListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR #endif } } - writer.WriteEndObject(); } DnsResolverDomainListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.Serialization.cs index 8c4be07f5b59e..62ee34b8e56ec 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class DnsResolverPolicyListResult : IUtf8JsonSerializable, IJso void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR throw new FormatException($"The model {nameof(DnsResolverPolicyListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR #endif } } - writer.WriteEndObject(); } DnsResolverPolicyListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.Serialization.cs index 693145e8cdad8..1613aef06be83 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyPatch.Serialization.cs @@ -18,6 +18,15 @@ public partial class DnsResolverPolicyPatch : IUtf8JsonSerializable, IJsonModel< void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader throw new FormatException($"The model {nameof(DnsResolverPolicyPatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -52,7 +60,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader #endif } } - writer.WriteEndObject(); } DnsResolverPolicyPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.Serialization.cs index 412263837ce3f..1098b6df168df 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class DnsResolverPolicyVirtualNetworkLinkListResult : IUtf8Json void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWri throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWri #endif } } - writer.WriteEndObject(); } DnsResolverPolicyVirtualNetworkLinkListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.Serialization.cs index 302c6b56a68f6..9c549acfda71c 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsResolverPolicyVirtualNetworkLinkPatch.Serialization.cs @@ -18,6 +18,15 @@ public partial class DnsResolverPolicyVirtualNetworkLinkPatch : IUtf8JsonSeriali void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter w throw new FormatException($"The model {nameof(DnsResolverPolicyVirtualNetworkLinkPatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -52,7 +60,6 @@ void IJsonModel.Write(Utf8JsonWriter w #endif } } - writer.WriteEndObject(); } DnsResolverPolicyVirtualNetworkLinkPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs index d4d5d458be6b3..31bf9cbf96d05 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs @@ -18,6 +18,15 @@ public partial class DnsSecurityRuleAction : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW throw new FormatException($"The model {nameof(DnsSecurityRuleAction)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(ActionType)) { writer.WritePropertyName("actionType"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW #endif } } - writer.WriteEndObject(); } DnsSecurityRuleAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.Serialization.cs index 1a41c77bc2334..1edf3165c63c3 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class DnsSecurityRuleListResult : IUtf8JsonSerializable, IJsonM void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(DnsSecurityRuleListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea #endif } } - writer.WriteEndObject(); } DnsSecurityRuleListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.Serialization.cs index 4c59e4288ae80..6dca9843cf94e 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRulePatch.Serialization.cs @@ -19,6 +19,15 @@ public partial class DnsSecurityRulePatch : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(DnsSecurityRulePatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -81,7 +89,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr #endif } } - writer.WriteEndObject(); } DnsSecurityRulePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleState.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleState.cs index fa93f10235ec5..8b22ea3257800 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleState.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleState.cs @@ -33,7 +33,7 @@ public DnsSecurityRuleState(string value) public static bool operator ==(DnsSecurityRuleState left, DnsSecurityRuleState right) => left.Equals(right); /// Determines if two values are not the same. public static bool operator !=(DnsSecurityRuleState left, DnsSecurityRuleState right) => !left.Equals(right); - /// Converts a string to a . + /// Converts a to a . public static implicit operator DnsSecurityRuleState(string value) => new DnsSecurityRuleState(value); /// From d3128b56f77e9d1ffc49f2df6126e1aec798e04c Mon Sep 17 00:00:00 2001 From: James Date: Mon, 7 Oct 2024 12:32:46 -0700 Subject: [PATCH 10/17] Add assets file after pushing recording --- sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json index 2a3e7214b4c3d..e44a007cdc1a6 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/dnsresolver/Azure.ResourceManager.DnsResolver", - "Tag": "net/dnsresolver/Azure.ResourceManager.DnsResolver_fc065926f5" + "Tag": "net/dnsresolver/Azure.ResourceManager.DnsResolver_74b3b7356e" } From 0d266d99d6b23fb2878426a4a2540fb567d83b1f Mon Sep 17 00:00:00 2001 From: James Date: Mon, 7 Oct 2024 15:25:19 -0700 Subject: [PATCH 11/17] Record tests for dns resolver as well --- sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json index e44a007cdc1a6..c674ed360a7fb 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/dnsresolver/Azure.ResourceManager.DnsResolver", - "Tag": "net/dnsresolver/Azure.ResourceManager.DnsResolver_74b3b7356e" + "Tag": "net/dnsresolver/Azure.ResourceManager.DnsResolver_2d8bfd113e" } From 810dd2642bb5f4aed46c73dfdc188cd991e1d727 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 8 Oct 2024 09:17:02 -0700 Subject: [PATCH 12/17] Change ActionType to DnsSecurityRuleActionTYpe --- ...ourceManager.DnsResolver.netstandard2.0.cs | 40 +++++++------- .../src/Generated/Models/ActionType.cs | 54 ------------------- .../DnsSecurityRuleAction.Serialization.cs | 4 +- .../Generated/Models/DnsSecurityRuleAction.cs | 4 +- .../Models/DnsSecurityRuleActionType.cs | 54 +++++++++++++++++++ .../src/autorest.md | 1 + .../tests/Tests/DnsSecurityRuleTests.cs | 8 +-- 7 files changed, 83 insertions(+), 82 deletions(-) delete mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs create mode 100644 sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleActionType.cs diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs index 39251f92a9f25..a005ccac78edd 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/api/Azure.ResourceManager.DnsResolver.netstandard2.0.cs @@ -663,25 +663,6 @@ protected MockableDnsResolverSubscriptionResource() { } } namespace Azure.ResourceManager.DnsResolver.Models { - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct ActionType : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public ActionType(string value) { throw null; } - public static Azure.ResourceManager.DnsResolver.Models.ActionType Alert { get { throw null; } } - public static Azure.ResourceManager.DnsResolver.Models.ActionType Allow { get { throw null; } } - public static Azure.ResourceManager.DnsResolver.Models.ActionType Block { get { throw null; } } - public bool Equals(Azure.ResourceManager.DnsResolver.Models.ActionType other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.DnsResolver.Models.ActionType left, Azure.ResourceManager.DnsResolver.Models.ActionType right) { throw null; } - public static implicit operator Azure.ResourceManager.DnsResolver.Models.ActionType (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.DnsResolver.Models.ActionType left, Azure.ResourceManager.DnsResolver.Models.ActionType right) { throw null; } - public override string ToString() { throw null; } - } public static partial class ArmDnsResolverModelFactory { public static Azure.ResourceManager.DnsResolver.DnsForwardingRuleData DnsForwardingRuleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), string domainName = null, System.Collections.Generic.IEnumerable targetDnsServers = null, System.Collections.Generic.IDictionary metadata = null, Azure.ResourceManager.DnsResolver.Models.DnsForwardingRuleState? dnsForwardingRuleState = default(Azure.ResourceManager.DnsResolver.Models.DnsForwardingRuleState?), Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState? provisioningState = default(Azure.ResourceManager.DnsResolver.Models.DnsResolverProvisioningState?)) { throw null; } @@ -877,7 +858,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class DnsSecurityRuleAction : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DnsSecurityRuleAction() { } - public Azure.ResourceManager.DnsResolver.Models.ActionType? ActionType { get { throw null; } set { } } + public Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType? ActionType { get { throw null; } set { } } public Azure.ResourceManager.DnsResolver.Models.BlockResponseCode? BlockResponseCode { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -886,6 +867,25 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DnsSecurityRuleActionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DnsSecurityRuleActionType(string value) { throw null; } + public static Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType Alert { get { throw null; } } + public static Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType Allow { get { throw null; } } + public static Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType Block { get { throw null; } } + public bool Equals(Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType left, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType right) { throw null; } + public static implicit operator Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType left, Azure.ResourceManager.DnsResolver.Models.DnsSecurityRuleActionType right) { throw null; } + public override string ToString() { throw null; } + } public partial class DnsSecurityRulePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DnsSecurityRulePatch() { } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs deleted file mode 100644 index 9a6b07de1ecd4..0000000000000 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/ActionType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.DnsResolver.Models -{ - /// The type of action to take. - public readonly partial struct ActionType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ActionType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AllowValue = "Allow"; - private const string AlertValue = "Alert"; - private const string BlockValue = "Block"; - - /// Allow. - public static ActionType Allow { get; } = new ActionType(AllowValue); - /// Alert. - public static ActionType Alert { get; } = new ActionType(AlertValue); - /// Block. - public static ActionType Block { get; } = new ActionType(BlockValue); - /// Determines if two values are the same. - public static bool operator ==(ActionType left, ActionType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ActionType left, ActionType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ActionType(string value) => new ActionType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ActionType other && Equals(other); - /// - public bool Equals(ActionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs index 31bf9cbf96d05..d55663ca144d3 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.Serialization.cs @@ -81,7 +81,7 @@ internal static DnsSecurityRuleAction DeserializeDnsSecurityRuleAction(JsonEleme { return null; } - ActionType? actionType = default; + DnsSecurityRuleActionType? actionType = default; BlockResponseCode? blockResponseCode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -93,7 +93,7 @@ internal static DnsSecurityRuleAction DeserializeDnsSecurityRuleAction(JsonEleme { continue; } - actionType = new ActionType(property.Value.GetString()); + actionType = new DnsSecurityRuleActionType(property.Value.GetString()); continue; } if (property.NameEquals("blockResponseCode"u8)) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.cs index ea0ef9ffea350..7ed7262c0583d 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleAction.cs @@ -54,7 +54,7 @@ public DnsSecurityRuleAction() /// The type of action to take. /// The response code for block actions. /// Keeps track of any properties unknown to the library. - internal DnsSecurityRuleAction(ActionType? actionType, BlockResponseCode? blockResponseCode, IDictionary serializedAdditionalRawData) + internal DnsSecurityRuleAction(DnsSecurityRuleActionType? actionType, BlockResponseCode? blockResponseCode, IDictionary serializedAdditionalRawData) { ActionType = actionType; BlockResponseCode = blockResponseCode; @@ -62,7 +62,7 @@ internal DnsSecurityRuleAction(ActionType? actionType, BlockResponseCode? blockR } /// The type of action to take. - public ActionType? ActionType { get; set; } + public DnsSecurityRuleActionType? ActionType { get; set; } /// The response code for block actions. public BlockResponseCode? BlockResponseCode { get; set; } } diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleActionType.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleActionType.cs new file mode 100644 index 0000000000000..3202ee2bcfb66 --- /dev/null +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/Models/DnsSecurityRuleActionType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DnsResolver.Models +{ + /// The type of action to take. + public readonly partial struct DnsSecurityRuleActionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DnsSecurityRuleActionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AllowValue = "Allow"; + private const string AlertValue = "Alert"; + private const string BlockValue = "Block"; + + /// Allow. + public static DnsSecurityRuleActionType Allow { get; } = new DnsSecurityRuleActionType(AllowValue); + /// Alert. + public static DnsSecurityRuleActionType Alert { get; } = new DnsSecurityRuleActionType(AlertValue); + /// Block. + public static DnsSecurityRuleActionType Block { get; } = new DnsSecurityRuleActionType(BlockValue); + /// Determines if two values are the same. + public static bool operator ==(DnsSecurityRuleActionType left, DnsSecurityRuleActionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsSecurityRuleActionType left, DnsSecurityRuleActionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DnsSecurityRuleActionType(string value) => new DnsSecurityRuleActionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DnsSecurityRuleActionType other && Equals(other); + /// + public bool Equals(DnsSecurityRuleActionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md index d8d7465a38ae1..0f0186cd96489 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/autorest.md @@ -70,6 +70,7 @@ rename-mapping: IpAllocationMethod: InboundEndpointIPAllocationMethod OutboundEndpoint: DnsResolverOutboundEndpoint VirtualNetworkLink: DnsForwardingRulesetVirtualNetworkLink + ActionType: DnsSecurityRuleActionType directive: - from: dnsresolver.json diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsSecurityRuleTests.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsSecurityRuleTests.cs index 73386e06f0093..9d89fce049e34 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsSecurityRuleTests.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/tests/Tests/DnsSecurityRuleTests.cs @@ -58,7 +58,7 @@ public async Task CreateDnsSecurityRule() // ARRANGE var dnsSecurityRuleName = Recording.GenerateAssetName("dnsSecurityRule-"); await CreateDnsResolverCollection(); - var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = ActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; + var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = DnsSecurityRuleActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; var dnsSecurityRuleData = new DnsSecurityRuleData(this.DefaultLocation, this.DefaultDnsSecurityRulePriority, dnsSecurityRuleAction, new List { @@ -83,7 +83,7 @@ public async Task GetDnsSecurityRule() // ARRANGE var dnsSecurityRuleName = Recording.GenerateAssetName("dnsSecurityRule-"); await CreateDnsResolverCollection(); - var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = ActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; + var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = DnsSecurityRuleActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; var dnsSecurityRuleData = new DnsSecurityRuleData(this.DefaultLocation, this.DefaultDnsSecurityRulePriority, dnsSecurityRuleAction, new List { @@ -112,7 +112,7 @@ public async Task UpdateDnsSecurityRule() var newTagKey = Recording.GenerateAlphaNumericId("tagKey"); var newTagValue = Recording.GenerateAlphaNumericId("tagValue"); await CreateDnsResolverCollection(); - var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = ActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; + var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = DnsSecurityRuleActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; var dnsSecurityRuleData = new DnsSecurityRuleData(this.DefaultLocation, this.DefaultDnsSecurityRulePriority, dnsSecurityRuleAction, new List { @@ -142,7 +142,7 @@ public async Task RemoveDnsSecurityRule() // ARRANGE var dnsSecurityRuleName = Recording.GenerateAssetName("dnsSecurityRule-"); await CreateDnsResolverCollection(); - var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = ActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; + var dnsSecurityRuleAction = new DnsSecurityRuleAction() { ActionType = DnsSecurityRuleActionType.Block, BlockResponseCode = BlockResponseCode.Servfail }; var dnsSecurityRuleData = new DnsSecurityRuleData(this.DefaultLocation, this.DefaultDnsSecurityRulePriority, dnsSecurityRuleAction, new List { From 1782531882c935f8de6dd1b5f6e6143b2a23b6b9 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 8 Oct 2024 14:32:29 -0700 Subject: [PATCH 13/17] Re-record DNS security rule tests after ActionType changes --- sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json index c674ed360a7fb..afed3d8d1bd5d 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/dnsresolver/Azure.ResourceManager.DnsResolver", - "Tag": "net/dnsresolver/Azure.ResourceManager.DnsResolver_2d8bfd113e" + "Tag": "net/dnsresolver/Azure.ResourceManager.DnsResolver_24b7185c51" } From 4d958d7f0b28858ac8335233a7c00b0d2c09c9b4 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 8 Oct 2024 14:33:35 -0700 Subject: [PATCH 14/17] Change DNS resolver to DNS private resolver in codeowners --- .github/CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8e31894bd0576..64570a2442a84 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1015,10 +1015,10 @@ # ServiceLabel: %Network - Mobile %Mgmt # ServiceOwners: @ArthurMa1978 -# PRLabel: %Network - DNS Resolver +# PRLabel: %Network - DNS Private Resolver /sdk/dnsresolver/Azure.ResourceManager.*/ @jamesvoongms @jotrivet -# ServiceLabel: %Network - DNS Resolver %Mgmt +# ServiceLabel: %Network - DNS Private Resolver %Mgmt # ServiceOwners: @jamesvoongms @jotrivet # PRLabel: %New Relic From 98224c6a7e937a946ce2d4bc06c3805947a2401c Mon Sep 17 00:00:00 2001 From: James Date: Thu, 10 Oct 2024 22:07:06 -0700 Subject: [PATCH 15/17] Add new release version and notes --- .../CHANGELOG.md | 16 ++++++++++++++++ .../src/Azure.ResourceManager.DnsResolver.csproj | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md index 7b4c1239ccc91..b0e1a3a8b1490 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 1.3.0-beta.1 (2023-07-01-preview) + +### Features Added + +- Add DNS Security Policy functionality for the following resources: + - DNS Security Policy + - DNS Security Policy Links + - Dns Security Rules + - DNS Resolver Domain Lists + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + ## 1.2.0-beta.1 (Unreleased) ### Features Added diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Azure.ResourceManager.DnsResolver.csproj b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Azure.ResourceManager.DnsResolver.csproj index 104ca7781db4a..0c63f47e3f7b6 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Azure.ResourceManager.DnsResolver.csproj +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Azure.ResourceManager.DnsResolver.csproj @@ -1,6 +1,6 @@ - 1.2.0-beta.1 + 1.3.0-beta.1 1.1.0 Azure.ResourceManager.DnsResolver From 34fe153b76af9e00ca88b49a5f79e7d78f183a21 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 10 Oct 2024 22:44:29 -0700 Subject: [PATCH 16/17] Fix to using 1.2.0-beta.1 as the new version --- .../CHANGELOG.md | 17 +++-------------- .../Azure.ResourceManager.DnsResolver.csproj | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md index b0e1a3a8b1490..3b69aebd26c9f 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md @@ -1,9 +1,11 @@ # Release History -## 1.3.0-beta.1 (2023-07-01-preview) +## 1.2.0-beta.1 (2024-10-18) ### Features Added +- Enable the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. +- Exposed `JsonModelWriteCore` for model serialization procedure. - Add DNS Security Policy functionality for the following resources: - DNS Security Policy - DNS Security Policy Links @@ -16,19 +18,6 @@ ### Other Changes -## 1.2.0-beta.1 (Unreleased) - -### Features Added - -- Enable the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. -- Exposed `JsonModelWriteCore` for model serialization procedure. - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - ## 1.1.0 (2023-11-27) ### Features Added diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Azure.ResourceManager.DnsResolver.csproj b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Azure.ResourceManager.DnsResolver.csproj index 0c63f47e3f7b6..104ca7781db4a 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Azure.ResourceManager.DnsResolver.csproj +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Azure.ResourceManager.DnsResolver.csproj @@ -1,6 +1,6 @@ - 1.3.0-beta.1 + 1.2.0-beta.1 1.1.0 Azure.ResourceManager.DnsResolver From 23976f4d3091e05b48b20d2547810e40fc9a321f Mon Sep 17 00:00:00 2001 From: James Date: Fri, 11 Oct 2024 08:40:21 -0700 Subject: [PATCH 17/17] Remove empty sections in the changelog --- .../Azure.ResourceManager.DnsResolver/CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md index 3b69aebd26c9f..f36cc628a0df1 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/CHANGELOG.md @@ -12,12 +12,6 @@ - Dns Security Rules - DNS Resolver Domain Lists -### Breaking Changes - -### Bugs Fixed - -### Other Changes - ## 1.1.0 (2023-11-27) ### Features Added