diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneDCollection.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneDCollection.cs new file mode 100644 index 000000000000..53aa3ce2c57b --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneDCollection.cs @@ -0,0 +1,343 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dns.Models; + +namespace Azure.ResourceManager.Dns +{ + /// + /// 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 GetDnsZoneDs method from an instance of . + /// + public partial class DnsZoneDCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dnsZoneDRecordSetsClientDiagnostics; + private readonly RecordSetsRestOperations _dnsZoneDRecordSetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DnsZoneDCollection() + { + } + + /// 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 DnsZoneDCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsZoneDRecordSetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dns", DnsZoneDResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DnsZoneDResource.ResourceType, out string dnsZoneDRecordSetsApiVersion); + _dnsZoneDRecordSetsRestClient = new RecordSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsZoneDRecordSetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DnsZoneResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DnsZoneResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_CreateOrUpdate + /// + /// + /// + /// 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 record set, relative to the name of the zone. + /// Parameters supplied to the CreateOrUpdate operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will be ignored. + /// The cancellation token to use. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string relativeRecordSetName, DnsRecordData data, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dnsZoneDRecordSetsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), relativeRecordSetName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsArmOperation(Response.FromValue(new DnsZoneDResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_CreateOrUpdate + /// + /// + /// + /// 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 record set, relative to the name of the zone. + /// Parameters supplied to the CreateOrUpdate operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will be ignored. + /// The cancellation token to use. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string relativeRecordSetName, DnsRecordData data, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dnsZoneDRecordSetsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), relativeRecordSetName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DnsArmOperation(Response.FromValue(new DnsZoneDResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetAsync(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDCollection.Get"); + scope.Start(); + try + { + var response = await _dnsZoneDRecordSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), relativeRecordSetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneDResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDCollection.Get"); + scope.Start(); + try + { + var response = _dnsZoneDRecordSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), relativeRecordSetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneDResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the record sets of a specified type in a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType} + /// + /// + /// Operation Id + /// RecordSets_ListByType + /// + /// + /// + /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. + /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. + /// 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, string recordsetnamesuffix = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsZoneDRecordSetsRestClient.CreateListByTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), top, recordsetnamesuffix); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsZoneDRecordSetsRestClient.CreateListByTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), top, recordsetnamesuffix); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsZoneDResource(Client, DnsRecordData.DeserializeDnsRecordData(e)), _dnsZoneDRecordSetsClientDiagnostics, Pipeline, "DnsZoneDCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the record sets of a specified type in a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType} + /// + /// + /// Operation Id + /// RecordSets_ListByType + /// + /// + /// + /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. + /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, string recordsetnamesuffix = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsZoneDRecordSetsRestClient.CreateListByTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), top, recordsetnamesuffix); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsZoneDRecordSetsRestClient.CreateListByTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), top, recordsetnamesuffix); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsZoneDResource(Client, DnsRecordData.DeserializeDnsRecordData(e)), _dnsZoneDRecordSetsClientDiagnostics, Pipeline, "DnsZoneDCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExistsAsync(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDCollection.Exists"); + scope.Start(); + try + { + var response = await _dnsZoneDRecordSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), relativeRecordSetName, 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/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDCollection.Exists"); + scope.Start(); + try + { + var response = _dnsZoneDRecordSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "DS".ToDnsRecordType(), relativeRecordSetName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneDResource.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneDResource.cs new file mode 100644 index 000000000000..0091bfeca034 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneDResource.cs @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dns.Models; + +namespace Azure.ResourceManager.Dns +{ + /// + /// A Class representing a DnsZoneD 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 GetDnsZoneDResource method. + /// Otherwise you can get one from its parent resource using the GetDnsZoneD method. + /// + public partial class DnsZoneDResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string zoneName, string relativeRecordSetName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/DS/{relativeRecordSetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dnsZoneDRecordSetsClientDiagnostics; + private readonly RecordSetsRestOperations _dnsZoneDRecordSetsRestClient; + private readonly DnsRecordData _data; + + /// Initializes a new instance of the class for mocking. + protected DnsZoneDResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DnsZoneDResource(ArmClient client, DnsRecordData 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 DnsZoneDResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsZoneDRecordSetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dns", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dnsZoneDRecordSetsApiVersion); + _dnsZoneDRecordSetsRestClient = new RecordSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsZoneDRecordSetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Network/dnsZones/DS"; + + /// 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 DnsRecordData 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 record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDResource.Get"); + scope.Start(); + try + { + var response = await _dnsZoneDRecordSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "DS".ToDnsRecordType(), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneDResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDResource.Get"); + scope.Start(); + try + { + var response = _dnsZoneDRecordSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "DS".ToDnsRecordType(), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneDResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDResource.Delete"); + scope.Start(); + try + { + var response = await _dnsZoneDRecordSetsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "DS".ToDnsRecordType(), Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDResource.Delete"); + scope.Start(); + try + { + var response = _dnsZoneDRecordSetsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "DS".ToDnsRecordType(), Id.Name, ifMatch, cancellationToken); + var operation = new DnsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a record set within a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Update + /// + /// + /// + /// Parameters supplied to the Update operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(DnsRecordData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDResource.Update"); + scope.Start(); + try + { + var response = await _dnsZoneDRecordSetsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "DS".ToDnsRecordType(), Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsZoneDResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a record set within a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Update + /// + /// + /// + /// Parameters supplied to the Update operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual Response Update(DnsRecordData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneDRecordSetsClientDiagnostics.CreateScope("DnsZoneDResource.Update"); + scope.Start(); + try + { + var response = _dnsZoneDRecordSetsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "DS".ToDnsRecordType(), Id.Name, data, ifMatch, cancellationToken); + return Response.FromValue(new DnsZoneDResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneData.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneData.cs index 09a404501ebe..86245e7f3f54 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneData.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneData.cs @@ -27,6 +27,7 @@ public DnsZoneData(AzureLocation location) : base(location) NameServers = new ChangeTrackingList(); RegistrationVirtualNetworks = new ChangeTrackingList(); ResolutionVirtualNetworks = new ChangeTrackingList(); + SigningKeys = new ChangeTrackingList(); } /// Initializes a new instance of DnsZoneData. @@ -44,7 +45,8 @@ public DnsZoneData(AzureLocation location) : base(location) /// The type of this DNS zone (Public or Private). /// A list of references to virtual networks that register hostnames in this DNS zone. This is a only when ZoneType is Private. /// A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private. - internal DnsZoneData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, long? maxNumberOfRecords, long? maxNumberOfRecordsPerRecord, long? numberOfRecords, IReadOnlyList nameServers, DnsZoneType? zoneType, IList registrationVirtualNetworks, IList resolutionVirtualNetworks) : base(id, name, resourceType, systemData, tags, location) + /// The list of signing keys. + internal DnsZoneData(ResourceIdentifier id, string name, ResourceType resourceType, ResourceManager.Models.SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, long? maxNumberOfRecords, long? maxNumberOfRecordsPerRecord, long? numberOfRecords, IReadOnlyList nameServers, DnsZoneType? zoneType, IList registrationVirtualNetworks, IList resolutionVirtualNetworks, IReadOnlyList signingKeys) : base(id, name, resourceType, systemData, tags, location) { ETag = etag; MaxNumberOfRecords = maxNumberOfRecords; @@ -54,6 +56,7 @@ internal DnsZoneData(ResourceIdentifier id, string name, ResourceType resourceTy ZoneType = zoneType; RegistrationVirtualNetworks = registrationVirtualNetworks; ResolutionVirtualNetworks = resolutionVirtualNetworks; + SigningKeys = signingKeys; } /// The etag of the zone. @@ -72,5 +75,7 @@ internal DnsZoneData(ResourceIdentifier id, string name, ResourceType resourceTy public IList RegistrationVirtualNetworks { get; } /// A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private. public IList ResolutionVirtualNetworks { get; } + /// The list of signing keys. + public IReadOnlyList SigningKeys { get; } } } diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneNAPTRCollection.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneNAPTRCollection.cs new file mode 100644 index 000000000000..1e93d8ab5d47 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneNAPTRCollection.cs @@ -0,0 +1,343 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dns.Models; + +namespace Azure.ResourceManager.Dns +{ + /// + /// 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 GetDnsZoneNAPTRs method from an instance of . + /// + public partial class DnsZoneNAPTRCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dnsZoneNAPTRRecordSetsClientDiagnostics; + private readonly RecordSetsRestOperations _dnsZoneNAPTRRecordSetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DnsZoneNAPTRCollection() + { + } + + /// 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 DnsZoneNAPTRCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsZoneNAPTRRecordSetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dns", DnsZoneNAPTRResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DnsZoneNAPTRResource.ResourceType, out string dnsZoneNAPTRRecordSetsApiVersion); + _dnsZoneNAPTRRecordSetsRestClient = new RecordSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsZoneNAPTRRecordSetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DnsZoneResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DnsZoneResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_CreateOrUpdate + /// + /// + /// + /// 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 record set, relative to the name of the zone. + /// Parameters supplied to the CreateOrUpdate operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will be ignored. + /// The cancellation token to use. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string relativeRecordSetName, DnsRecordData data, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dnsZoneNAPTRRecordSetsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), relativeRecordSetName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsArmOperation(Response.FromValue(new DnsZoneNAPTRResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_CreateOrUpdate + /// + /// + /// + /// 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 record set, relative to the name of the zone. + /// Parameters supplied to the CreateOrUpdate operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will be ignored. + /// The cancellation token to use. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string relativeRecordSetName, DnsRecordData data, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dnsZoneNAPTRRecordSetsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), relativeRecordSetName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DnsArmOperation(Response.FromValue(new DnsZoneNAPTRResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetAsync(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRCollection.Get"); + scope.Start(); + try + { + var response = await _dnsZoneNAPTRRecordSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), relativeRecordSetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneNAPTRResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRCollection.Get"); + scope.Start(); + try + { + var response = _dnsZoneNAPTRRecordSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), relativeRecordSetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneNAPTRResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the record sets of a specified type in a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType} + /// + /// + /// Operation Id + /// RecordSets_ListByType + /// + /// + /// + /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. + /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. + /// 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, string recordsetnamesuffix = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsZoneNAPTRRecordSetsRestClient.CreateListByTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), top, recordsetnamesuffix); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsZoneNAPTRRecordSetsRestClient.CreateListByTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), top, recordsetnamesuffix); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsZoneNAPTRResource(Client, DnsRecordData.DeserializeDnsRecordData(e)), _dnsZoneNAPTRRecordSetsClientDiagnostics, Pipeline, "DnsZoneNAPTRCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the record sets of a specified type in a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType} + /// + /// + /// Operation Id + /// RecordSets_ListByType + /// + /// + /// + /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. + /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, string recordsetnamesuffix = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsZoneNAPTRRecordSetsRestClient.CreateListByTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), top, recordsetnamesuffix); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsZoneNAPTRRecordSetsRestClient.CreateListByTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), top, recordsetnamesuffix); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsZoneNAPTRResource(Client, DnsRecordData.DeserializeDnsRecordData(e)), _dnsZoneNAPTRRecordSetsClientDiagnostics, Pipeline, "DnsZoneNAPTRCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExistsAsync(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRCollection.Exists"); + scope.Start(); + try + { + var response = await _dnsZoneNAPTRRecordSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), relativeRecordSetName, 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/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRCollection.Exists"); + scope.Start(); + try + { + var response = _dnsZoneNAPTRRecordSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "NAPTR".ToDnsRecordType(), relativeRecordSetName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneNAPTRResource.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneNAPTRResource.cs new file mode 100644 index 000000000000..89c0ec6d1036 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneNAPTRResource.cs @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dns.Models; + +namespace Azure.ResourceManager.Dns +{ + /// + /// A Class representing a DnsZoneNAPTR 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 GetDnsZoneNAPTRResource method. + /// Otherwise you can get one from its parent resource using the GetDnsZoneNAPTR method. + /// + public partial class DnsZoneNAPTRResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string zoneName, string relativeRecordSetName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/NAPTR/{relativeRecordSetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dnsZoneNAPTRRecordSetsClientDiagnostics; + private readonly RecordSetsRestOperations _dnsZoneNAPTRRecordSetsRestClient; + private readonly DnsRecordData _data; + + /// Initializes a new instance of the class for mocking. + protected DnsZoneNAPTRResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DnsZoneNAPTRResource(ArmClient client, DnsRecordData 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 DnsZoneNAPTRResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsZoneNAPTRRecordSetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dns", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dnsZoneNAPTRRecordSetsApiVersion); + _dnsZoneNAPTRRecordSetsRestClient = new RecordSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsZoneNAPTRRecordSetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Network/dnsZones/NAPTR"; + + /// 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 DnsRecordData 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 record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRResource.Get"); + scope.Start(); + try + { + var response = await _dnsZoneNAPTRRecordSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "NAPTR".ToDnsRecordType(), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneNAPTRResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRResource.Get"); + scope.Start(); + try + { + var response = _dnsZoneNAPTRRecordSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "NAPTR".ToDnsRecordType(), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneNAPTRResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRResource.Delete"); + scope.Start(); + try + { + var response = await _dnsZoneNAPTRRecordSetsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "NAPTR".ToDnsRecordType(), Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRResource.Delete"); + scope.Start(); + try + { + var response = _dnsZoneNAPTRRecordSetsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "NAPTR".ToDnsRecordType(), Id.Name, ifMatch, cancellationToken); + var operation = new DnsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a record set within a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Update + /// + /// + /// + /// Parameters supplied to the Update operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(DnsRecordData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRResource.Update"); + scope.Start(); + try + { + var response = await _dnsZoneNAPTRRecordSetsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "NAPTR".ToDnsRecordType(), Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsZoneNAPTRResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a record set within a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Update + /// + /// + /// + /// Parameters supplied to the Update operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual Response Update(DnsRecordData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneNAPTRRecordSetsClientDiagnostics.CreateScope("DnsZoneNAPTRResource.Update"); + scope.Start(); + try + { + var response = _dnsZoneNAPTRRecordSetsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "NAPTR".ToDnsRecordType(), Id.Name, data, ifMatch, cancellationToken); + return Response.FromValue(new DnsZoneNAPTRResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneTLSACollection.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneTLSACollection.cs new file mode 100644 index 000000000000..d03ea5ef6154 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneTLSACollection.cs @@ -0,0 +1,343 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dns.Models; + +namespace Azure.ResourceManager.Dns +{ + /// + /// 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 GetDnsZoneTLSAs method from an instance of . + /// + public partial class DnsZoneTLSACollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics; + private readonly RecordSetsRestOperations _dnsZoneTlsDnsARecordInfoSetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DnsZoneTLSACollection() + { + } + + /// 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 DnsZoneTLSACollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dns", DnsZoneTLSAResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DnsZoneTLSAResource.ResourceType, out string dnsZoneTlsDnsARecordInfoSetsApiVersion); + _dnsZoneTlsDnsARecordInfoSetsRestClient = new RecordSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsZoneTlsDnsARecordInfoSetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DnsZoneResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DnsZoneResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_CreateOrUpdate + /// + /// + /// + /// 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 record set, relative to the name of the zone. + /// Parameters supplied to the CreateOrUpdate operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will be ignored. + /// The cancellation token to use. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string relativeRecordSetName, DnsRecordData data, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSACollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dnsZoneTlsDnsARecordInfoSetsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), relativeRecordSetName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsArmOperation(Response.FromValue(new DnsZoneTLSAResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_CreateOrUpdate + /// + /// + /// + /// 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 record set, relative to the name of the zone. + /// Parameters supplied to the CreateOrUpdate operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow a new record set to be created, but to prevent updating an existing record set. Other values will be ignored. + /// The cancellation token to use. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string relativeRecordSetName, DnsRecordData data, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSACollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dnsZoneTlsDnsARecordInfoSetsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), relativeRecordSetName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DnsArmOperation(Response.FromValue(new DnsZoneTLSAResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual async Task> GetAsync(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSACollection.Get"); + scope.Start(); + try + { + var response = await _dnsZoneTlsDnsARecordInfoSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), relativeRecordSetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneTLSAResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSACollection.Get"); + scope.Start(); + try + { + var response = _dnsZoneTlsDnsARecordInfoSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), relativeRecordSetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneTLSAResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the record sets of a specified type in a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType} + /// + /// + /// Operation Id + /// RecordSets_ListByType + /// + /// + /// + /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. + /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. + /// 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, string recordsetnamesuffix = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsZoneTlsDnsARecordInfoSetsRestClient.CreateListByTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), top, recordsetnamesuffix); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsZoneTlsDnsARecordInfoSetsRestClient.CreateListByTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), top, recordsetnamesuffix); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DnsZoneTLSAResource(Client, DnsRecordData.DeserializeDnsRecordData(e)), _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics, Pipeline, "DnsZoneTLSACollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the record sets of a specified type in a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType} + /// + /// + /// Operation Id + /// RecordSets_ListByType + /// + /// + /// + /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. + /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(int? top = null, string recordsetnamesuffix = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dnsZoneTlsDnsARecordInfoSetsRestClient.CreateListByTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), top, recordsetnamesuffix); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dnsZoneTlsDnsARecordInfoSetsRestClient.CreateListByTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), top, recordsetnamesuffix); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DnsZoneTLSAResource(Client, DnsRecordData.DeserializeDnsRecordData(e)), _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics, Pipeline, "DnsZoneTLSACollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual async Task> ExistsAsync(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSACollection.Exists"); + scope.Start(); + try + { + var response = await _dnsZoneTlsDnsARecordInfoSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), relativeRecordSetName, 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/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The name of the record set, relative to the name of the zone. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string relativeRecordSetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(relativeRecordSetName, nameof(relativeRecordSetName)); + + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSACollection.Exists"); + scope.Start(); + try + { + var response = _dnsZoneTlsDnsARecordInfoSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, "TLSA".ToDnsRecordType(), relativeRecordSetName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneTLSAResource.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneTLSAResource.cs new file mode 100644 index 000000000000..dc39b9f8324c --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnsZoneTLSAResource.cs @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dns.Models; + +namespace Azure.ResourceManager.Dns +{ + /// + /// A Class representing a DnsZoneTLSA 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 GetDnsZoneTLSAResource method. + /// Otherwise you can get one from its parent resource using the GetDnsZoneTLSA method. + /// + public partial class DnsZoneTLSAResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string zoneName, string relativeRecordSetName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/TLSA/{relativeRecordSetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics; + private readonly RecordSetsRestOperations _dnsZoneTlsDnsARecordInfoSetsRestClient; + private readonly DnsRecordData _data; + + /// Initializes a new instance of the class for mocking. + protected DnsZoneTLSAResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DnsZoneTLSAResource(ArmClient client, DnsRecordData 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 DnsZoneTLSAResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dns", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dnsZoneTlsDnsARecordInfoSetsApiVersion); + _dnsZoneTlsDnsARecordInfoSetsRestClient = new RecordSetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnsZoneTlsDnsARecordInfoSetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Network/dnsZones/TLSA"; + + /// 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 DnsRecordData 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 record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSAResource.Get"); + scope.Start(); + try + { + var response = await _dnsZoneTlsDnsARecordInfoSetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "TLSA".ToDnsRecordType(), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneTLSAResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a record set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSAResource.Get"); + scope.Start(); + try + { + var response = _dnsZoneTlsDnsARecordInfoSetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "TLSA".ToDnsRecordType(), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnsZoneTLSAResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSAResource.Delete"); + scope.Start(); + try + { + var response = await _dnsZoneTlsDnsARecordInfoSetsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "TLSA".ToDnsRecordType(), Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSAResource.Delete"); + scope.Start(); + try + { + var response = _dnsZoneTlsDnsARecordInfoSetsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "TLSA".ToDnsRecordType(), Id.Name, ifMatch, cancellationToken); + var operation = new DnsArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a record set within a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Update + /// + /// + /// + /// Parameters supplied to the Update operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(DnsRecordData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSAResource.Update"); + scope.Start(); + try + { + var response = await _dnsZoneTlsDnsARecordInfoSetsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "TLSA".ToDnsRecordType(), Id.Name, data, ifMatch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DnsZoneTLSAResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a record set within a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName} + /// + /// + /// Operation Id + /// RecordSets_Update + /// + /// + /// + /// Parameters supplied to the Update operation. + /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. + /// The cancellation token to use. + /// is null. + public virtual Response Update(DnsRecordData data, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dnsZoneTlsDnsARecordInfoSetsClientDiagnostics.CreateScope("DnsZoneTLSAResource.Update"); + scope.Start(); + try + { + var response = _dnsZoneTlsDnsARecordInfoSetsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, "TLSA".ToDnsRecordType(), Id.Name, data, ifMatch, cancellationToken); + return Response.FromValue(new DnsZoneTLSAResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnssecConfigData.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnssecConfigData.cs new file mode 100644 index 000000000000..95d5d5a33cfa --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnssecConfigData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Dns.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dns +{ + /// + /// A class representing the DnssecConfig data model. + /// Represents the DNSSEC configuration. + /// + public partial class DnssecConfigData : ResourceData + { + /// Initializes a new instance of DnssecConfigData. + internal DnssecConfigData() + { + SigningKeys = new ChangeTrackingList(); + } + + /// Initializes a new instance of DnssecConfigData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The etag of the DNSSEC configuration. + /// Provisioning State of the DNSSEC configuration. + /// The list of signing keys. + internal DnssecConfigData(ResourceIdentifier id, string name, ResourceType resourceType, ResourceManager.Models.SystemData systemData, ETag? etag, string provisioningState, IReadOnlyList signingKeys) : base(id, name, resourceType, systemData) + { + ETag = etag; + ProvisioningState = provisioningState; + SigningKeys = signingKeys; + } + + /// The etag of the DNSSEC configuration. + public ETag? ETag { get; } + /// Provisioning State of the DNSSEC configuration. + public string ProvisioningState { get; } + /// The list of signing keys. + public IReadOnlyList SigningKeys { get; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnssecConfigResource.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnssecConfigResource.cs new file mode 100644 index 000000000000..32e17a527403 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/DnssecConfigResource.cs @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dns +{ + /// + /// A Class representing a DnssecConfig 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 GetDnssecConfigResource method. + /// Otherwise you can get one from its parent resource using the GetDnssecConfig method. + /// + public partial class DnssecConfigResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string zoneName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dnssecConfigClientDiagnostics; + private readonly DnssecConfigsRestOperations _dnssecConfigRestClient; + private readonly DnssecConfigData _data; + + /// Initializes a new instance of the class for mocking. + protected DnssecConfigResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DnssecConfigResource(ArmClient client, DnssecConfigData 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 DnssecConfigResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dnssecConfigClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dns", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dnssecConfigApiVersion); + _dnssecConfigRestClient = new DnssecConfigsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dnssecConfigApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Network/dnsZones/dnssecConfigs"; + + /// 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 DnssecConfigData 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 the DNSSEC configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default + /// + /// + /// Operation Id + /// DnssecConfigs_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dnssecConfigClientDiagnostics.CreateScope("DnssecConfigResource.Get"); + scope.Start(); + try + { + var response = await _dnssecConfigRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnssecConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the DNSSEC configuration. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default + /// + /// + /// Operation Id + /// DnssecConfigs_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dnssecConfigClientDiagnostics.CreateScope("DnssecConfigResource.Get"); + scope.Start(); + try + { + var response = _dnssecConfigRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DnssecConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the DNSSEC configuration on a DNS zone. This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default + /// + /// + /// Operation Id + /// DnssecConfigs_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The etag of this DNSSEC configuration. Omit this value to always delete the DNSSEC configuration. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnssecConfigClientDiagnostics.CreateScope("DnssecConfigResource.Delete"); + scope.Start(); + try + { + var response = await _dnssecConfigRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsArmOperation(_dnssecConfigClientDiagnostics, Pipeline, _dnssecConfigRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.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 the DNSSEC configuration on a DNS zone. This operation cannot be undone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default + /// + /// + /// Operation Id + /// DnssecConfigs_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The etag of this DNSSEC configuration. Omit this value to always delete the DNSSEC configuration. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnssecConfigClientDiagnostics.CreateScope("DnssecConfigResource.Delete"); + scope.Start(); + try + { + var response = _dnssecConfigRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, ifMatch, cancellationToken); + var operation = new DnsArmOperation(_dnssecConfigClientDiagnostics, Pipeline, _dnssecConfigRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates the DNSSEC configuration on a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default + /// + /// + /// Operation Id + /// DnssecConfigs_CreateOrUpdate + /// + /// + /// + /// 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 etag of the DNSSEC configuration. Omit this value to always overwrite the DNSSEC configuration. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow this DNSSEC configuration to be created, but to prevent updating existing DNSSEC configuration. Other values will be ignored. + /// The cancellation token to use. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnssecConfigClientDiagnostics.CreateScope("DnssecConfigResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dnssecConfigRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DnsArmOperation(new DnssecConfigOperationSource(Client), _dnssecConfigClientDiagnostics, Pipeline, _dnssecConfigRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, 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 the DNSSEC configuration on a DNS zone. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default + /// + /// + /// Operation Id + /// DnssecConfigs_CreateOrUpdate + /// + /// + /// + /// 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 etag of the DNSSEC configuration. Omit this value to always overwrite the DNSSEC configuration. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow this DNSSEC configuration to be created, but to prevent updating existing DNSSEC configuration. Other values will be ignored. + /// The cancellation token to use. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _dnssecConfigClientDiagnostics.CreateScope("DnssecConfigResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dnssecConfigRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DnsArmOperation(new DnssecConfigOperationSource(Client), _dnssecConfigClientDiagnostics, Pipeline, _dnssecConfigRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs index e4ad455c51ee..3c4a0d809957 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs @@ -50,6 +50,25 @@ private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtens return new SubscriptionResourceExtensionClient(client, scope); }); } + #region DnssecConfigResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DnssecConfigResource GetDnssecConfigResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DnssecConfigResource.ValidateResourceId(id); + return new DnssecConfigResource(client, id); + } + ); + } + #endregion + #region DnsARecordResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. @@ -240,6 +259,63 @@ public static DnsTxtRecordResource GetDnsTxtRecordResource(this ArmClient client } #endregion + #region DnsZoneTLSAResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DnsZoneTLSAResource GetDnsZoneTLSAResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DnsZoneTLSAResource.ValidateResourceId(id); + return new DnsZoneTLSAResource(client, id); + } + ); + } + #endregion + + #region DnsZoneDResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DnsZoneDResource GetDnsZoneDResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DnsZoneDResource.ValidateResourceId(id); + return new DnsZoneDResource(client, id); + } + ); + } + #endregion + + #region DnsZoneNAPTRResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DnsZoneNAPTRResource GetDnsZoneNAPTRResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DnsZoneNAPTRResource.ValidateResourceId(id); + return new DnsZoneNAPTRResource(client, id); + } + ); + } + #endregion + #region DnsZoneResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/LongRunningOperation/DnssecConfigOperationSource.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/LongRunningOperation/DnssecConfigOperationSource.cs new file mode 100644 index 000000000000..90a006fbf120 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/LongRunningOperation/DnssecConfigOperationSource.cs @@ -0,0 +1,40 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dns +{ + internal class DnssecConfigOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DnssecConfigOperationSource(ArmClient client) + { + _client = client; + } + + DnssecConfigResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DnssecConfigData.DeserializeDnssecConfigData(document.RootElement); + return new DnssecConfigResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DnssecConfigData.DeserializeDnssecConfigData(document.RootElement); + return new DnssecConfigResource(_client, data); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/CreatedByType.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..773cedf5fd52 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dns.Models +{ + /// The type of identity that created the resource. + internal readonly partial struct CreatedByType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CreatedByType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "User"; + private const string ApplicationValue = "Application"; + private const string ManagedIdentityValue = "ManagedIdentity"; + private const string KeyValue = "Key"; + + /// User. + public static CreatedByType User { get; } = new CreatedByType(UserValue); + /// Application. + public static CreatedByType Application { get; } = new CreatedByType(ApplicationValue); + /// ManagedIdentity. + public static CreatedByType ManagedIdentity { get; } = new CreatedByType(ManagedIdentityValue); + /// Key. + public static CreatedByType Key { get; } = new CreatedByType(KeyValue); + /// Determines if two values are the same. + public static bool operator ==(CreatedByType left, CreatedByType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CreatedByType left, CreatedByType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CreatedByType(string value) => new CreatedByType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CreatedByType other && Equals(other); + /// + public bool Equals(CreatedByType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DelegationSignerInfo.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DelegationSignerInfo.Serialization.cs new file mode 100644 index 000000000000..c5b6662b60b2 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DelegationSignerInfo.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dns.Models +{ + public partial class DelegationSignerInfo + { + internal static DelegationSignerInfo DeserializeDelegationSignerInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional digestAlgorithmType = default; + Optional digestValue = default; + Optional record = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("digestAlgorithmType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + digestAlgorithmType = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("digestValue"u8)) + { + digestValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("record"u8)) + { + record = property.Value.GetString(); + continue; + } + } + return new DelegationSignerInfo(Optional.ToNullable(digestAlgorithmType), digestValue.Value, record.Value); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DelegationSignerInfo.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DelegationSignerInfo.cs new file mode 100644 index 000000000000..fe08e0b675c2 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DelegationSignerInfo.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dns.Models +{ + /// The delegation signer information. + public partial class DelegationSignerInfo + { + /// Initializes a new instance of DelegationSignerInfo. + internal DelegationSignerInfo() + { + } + + /// Initializes a new instance of DelegationSignerInfo. + /// The digest algorithm type represents the standard digest algorithm number used to construct the digest. See: https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml. + /// The digest value is a cryptographic hash value of the referenced DNSKEY Resource Record. + /// The record represents a delegation signer (DS) record. + internal DelegationSignerInfo(int? digestAlgorithmType, string digestValue, string record) + { + DigestAlgorithmType = digestAlgorithmType; + DigestValue = digestValue; + Record = record; + } + + /// The digest algorithm type represents the standard digest algorithm number used to construct the digest. See: https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml. + public int? DigestAlgorithmType { get; } + /// The digest value is a cryptographic hash value of the referenced DNSKEY Resource Record. + public string DigestValue { get; } + /// The record represents a delegation signer (DS) record. + public string Record { get; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Digest.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Digest.Serialization.cs new file mode 100644 index 000000000000..c8e54cfe0b8e --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Digest.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dns.Models +{ + public partial class Digest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AlgorithmType)) + { + writer.WritePropertyName("algorithmType"u8); + writer.WriteNumberValue(AlgorithmType.Value); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WriteEndObject(); + } + + internal static Digest DeserializeDigest(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional algorithmType = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("algorithmType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + algorithmType = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + } + return new Digest(Optional.ToNullable(algorithmType), value.Value); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Digest.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Digest.cs new file mode 100644 index 000000000000..cd51953af68f --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/Digest.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dns.Models +{ + /// A digest. + public partial class Digest + { + /// Initializes a new instance of Digest. + public Digest() + { + } + + /// Initializes a new instance of Digest. + /// The digest algorithm type represents the standard digest algorithm number used to construct the digest. See: https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml. + /// The digest value is a cryptographic hash value of the referenced DNSKEY Resource Record. + internal Digest(int? algorithmType, string value) + { + AlgorithmType = algorithmType; + Value = value; + } + + /// The digest algorithm type represents the standard digest algorithm number used to construct the digest. See: https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml. + public int? AlgorithmType { get; set; } + /// The digest value is a cryptographic hash value of the referenced DNSKEY Resource Record. + public string Value { get; set; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsRecordType.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsRecordType.Serialization.cs index 255b1fc656a9..431f5709abb8 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsRecordType.Serialization.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsRecordType.Serialization.cs @@ -23,6 +23,9 @@ internal static partial class DnsRecordTypeExtensions DnsRecordType.SOA => "SOA", DnsRecordType.SRV => "SRV", DnsRecordType.TXT => "TXT", + DnsRecordType.Tlsa => "TLSA", + DnsRecordType.DS => "DS", + DnsRecordType.Naptr => "NAPTR", _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DnsRecordType value.") }; @@ -38,6 +41,9 @@ public static DnsRecordType ToDnsRecordType(this string value) if (StringComparer.OrdinalIgnoreCase.Equals(value, "SOA")) return DnsRecordType.SOA; if (StringComparer.OrdinalIgnoreCase.Equals(value, "SRV")) return DnsRecordType.SRV; if (StringComparer.OrdinalIgnoreCase.Equals(value, "TXT")) return DnsRecordType.TXT; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "TLSA")) return DnsRecordType.Tlsa; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "DS")) return DnsRecordType.DS; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NAPTR")) return DnsRecordType.Naptr; throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DnsRecordType value."); } } diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsRecordType.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsRecordType.cs index 1ef03f858ac7..9865dc20f2b7 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsRecordType.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsRecordType.cs @@ -29,6 +29,12 @@ internal enum DnsRecordType /// SRV. SRV, /// TXT. - TXT + TXT, + /// TLSA. + Tlsa, + /// DS. + DS, + /// NAPTR. + Naptr } } diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsZoneData.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsZoneData.Serialization.cs index c6a60d428de6..408fcef88d23 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsZoneData.Serialization.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnsZoneData.Serialization.cs @@ -81,7 +81,7 @@ internal static DnsZoneData DeserializeDnsZoneData(JsonElement element) ResourceIdentifier id = default; string name = default; ResourceType type = default; - Optional systemData = default; + Optional systemData = default; Optional maxNumberOfRecordSets = default; Optional maxNumberOfRecordsPerRecordSet = default; Optional numberOfRecordSets = default; @@ -89,6 +89,7 @@ internal static DnsZoneData DeserializeDnsZoneData(JsonElement element) Optional zoneType = default; Optional> registrationVirtualNetworks = default; Optional> resolutionVirtualNetworks = default; + Optional> signingKeys = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag"u8)) @@ -140,7 +141,7 @@ internal static DnsZoneData DeserializeDnsZoneData(JsonElement element) { continue; } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } if (property.NameEquals("properties"u8)) @@ -231,11 +232,25 @@ internal static DnsZoneData DeserializeDnsZoneData(JsonElement element) resolutionVirtualNetworks = array; continue; } + if (property0.NameEquals("signingKeys"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(SigningKey.DeserializeSigningKey(item)); + } + signingKeys = array; + continue; + } } continue; } } - return new DnsZoneData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(maxNumberOfRecordSets), Optional.ToNullable(maxNumberOfRecordsPerRecordSet), Optional.ToNullable(numberOfRecordSets), Optional.ToList(nameServers), Optional.ToNullable(zoneType), Optional.ToList(registrationVirtualNetworks), Optional.ToList(resolutionVirtualNetworks)); + return new DnsZoneData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(etag), Optional.ToNullable(maxNumberOfRecordSets), Optional.ToNullable(maxNumberOfRecordsPerRecordSet), Optional.ToNullable(numberOfRecordSets), Optional.ToList(nameServers), Optional.ToNullable(zoneType), Optional.ToList(registrationVirtualNetworks), Optional.ToList(resolutionVirtualNetworks), Optional.ToList(signingKeys)); } } } diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigData.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigData.Serialization.cs new file mode 100644 index 000000000000..d5c944d0e9a9 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigData.Serialization.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Dns.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dns +{ + public partial class DnssecConfigData + { + internal static DnssecConfigData DeserializeDnssecConfigData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional etag = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional> signingKeys = default; + 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("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)) + { + provisioningState = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("signingKeys"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(SigningKey.DeserializeSigningKey(item)); + } + signingKeys = array; + continue; + } + } + continue; + } + } + return new DnssecConfigData(id, name, type, systemData.Value, Optional.ToNullable(etag), provisioningState.Value, Optional.ToList(signingKeys)); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigListResult.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigListResult.Serialization.cs new file mode 100644 index 000000000000..c6b167e798a9 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dns; + +namespace Azure.ResourceManager.Dns.Models +{ + internal partial class DnssecConfigListResult + { + internal static DnssecConfigListResult DeserializeDnssecConfigListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DnssecConfigData.DeserializeDnssecConfigData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DnssecConfigListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigListResult.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigListResult.cs new file mode 100644 index 000000000000..84b2fa746aae --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DnssecConfigListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dns; + +namespace Azure.ResourceManager.Dns.Models +{ + /// The response to a List DNSSEC configurations operation. + internal partial class DnssecConfigListResult + { + /// Initializes a new instance of DnssecConfigListResult. + internal DnssecConfigListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DnssecConfigListResult. + /// Information about the DNSSEC configurations in the response. + /// The continuation token for the next page of results. + internal DnssecConfigListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Information about the DNSSEC configurations in the response. + public IReadOnlyList Value { get; } + /// The continuation token for the next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DsRecord.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DsRecord.Serialization.cs new file mode 100644 index 000000000000..dc3b693f0a04 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DsRecord.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dns.Models +{ + public partial class DsRecord : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(KeyTag)) + { + writer.WritePropertyName("keyTag"u8); + writer.WriteNumberValue(KeyTag.Value); + } + if (Optional.IsDefined(Algorithm)) + { + writer.WritePropertyName("algorithm"u8); + writer.WriteNumberValue(Algorithm.Value); + } + if (Optional.IsDefined(Digest)) + { + writer.WritePropertyName("digest"u8); + writer.WriteObjectValue(Digest); + } + writer.WriteEndObject(); + } + + internal static DsRecord DeserializeDsRecord(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional keyTag = default; + Optional algorithm = default; + Optional digest = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyTag = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("algorithm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + algorithm = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("digest"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + digest = Digest.DeserializeDigest(property.Value); + continue; + } + } + return new DsRecord(Optional.ToNullable(keyTag), Optional.ToNullable(algorithm), digest.Value); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DsRecord.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DsRecord.cs new file mode 100644 index 000000000000..9b2ba51a9e90 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/DsRecord.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dns.Models +{ + /// A DS record. For more information about the DS record format, see RFC 4034: https://www.rfc-editor.org/rfc/rfc4034. + public partial class DsRecord + { + /// Initializes a new instance of DsRecord. + public DsRecord() + { + } + + /// Initializes a new instance of DsRecord. + /// The key tag value is used to determine which DNSKEY Resource Record is used for signature verification. + /// The security algorithm type represents the standard security algorithm number of the DNSKEY Resource Record. See: https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml. + /// The digest entity. + internal DsRecord(int? keyTag, int? algorithm, Digest digest) + { + KeyTag = keyTag; + Algorithm = algorithm; + Digest = digest; + } + + /// The key tag value is used to determine which DNSKEY Resource Record is used for signature verification. + public int? KeyTag { get; set; } + /// The security algorithm type represents the standard security algorithm number of the DNSKEY Resource Record. See: https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml. + public int? Algorithm { get; set; } + /// The digest entity. + public Digest Digest { get; set; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/NaptrRecord.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/NaptrRecord.Serialization.cs new file mode 100644 index 000000000000..06c43afdf1f3 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/NaptrRecord.Serialization.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dns.Models +{ + public partial class NaptrRecord : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Order)) + { + writer.WritePropertyName("order"u8); + writer.WriteNumberValue(Order.Value); + } + if (Optional.IsDefined(Preference)) + { + writer.WritePropertyName("preference"u8); + writer.WriteNumberValue(Preference.Value); + } + if (Optional.IsDefined(Flags)) + { + writer.WritePropertyName("flags"u8); + writer.WriteStringValue(Flags); + } + if (Optional.IsDefined(Services)) + { + writer.WritePropertyName("services"u8); + writer.WriteStringValue(Services); + } + if (Optional.IsDefined(Regexp)) + { + writer.WritePropertyName("regexp"u8); + writer.WriteStringValue(Regexp); + } + if (Optional.IsDefined(Replacement)) + { + writer.WritePropertyName("replacement"u8); + writer.WriteStringValue(Replacement); + } + writer.WriteEndObject(); + } + + internal static NaptrRecord DeserializeNaptrRecord(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional order = default; + Optional preference = default; + Optional flags = default; + Optional services = default; + Optional regexp = default; + Optional replacement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("order"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + order = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("preference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + preference = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("flags"u8)) + { + flags = property.Value.GetString(); + continue; + } + if (property.NameEquals("services"u8)) + { + services = property.Value.GetString(); + continue; + } + if (property.NameEquals("regexp"u8)) + { + regexp = property.Value.GetString(); + continue; + } + if (property.NameEquals("replacement"u8)) + { + replacement = property.Value.GetString(); + continue; + } + } + return new NaptrRecord(Optional.ToNullable(order), Optional.ToNullable(preference), flags.Value, services.Value, regexp.Value, replacement.Value); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/NaptrRecord.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/NaptrRecord.cs new file mode 100644 index 000000000000..1c5e42623590 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/NaptrRecord.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dns.Models +{ + /// A NAPTR record. For more information about the NAPTR record format, see RFC 3403: https://www.rfc-editor.org/rfc/rfc3403. + public partial class NaptrRecord + { + /// Initializes a new instance of NaptrRecord. + public NaptrRecord() + { + } + + /// Initializes a new instance of NaptrRecord. + /// The order in which the NAPTR records MUST be processed in order to accurately represent the ordered list of rules. The ordering is from lowest to highest. Valid values: 0-65535. + /// The preference specifies the order in which NAPTR records with equal 'order' values should be processed, low numbers being processed before high numbers. Valid values: 0-65535. + /// The flags specific to DDDS applications. Values currently defined in RFC 3404 are uppercase and lowercase letters "A", "P", "S", and "U", and the empty string, "". Enclose Flags in quotation marks. + /// The services specific to DDDS applications. Enclose Services in quotation marks. + /// The regular expression that the DDDS application uses to convert an input value into an output value. For example: an IP phone system might use a regular expression to convert a phone number that is entered by a user into a SIP URI. Enclose the regular expression in quotation marks. Specify either a value for 'regexp' or a value for 'replacement'. + /// The replacement is a fully qualified domain name (FQDN) of the next domain name that you want the DDDS application to submit a DNS query for. The DDDS application replaces the input value with the value specified for replacement. Specify either a value for 'regexp' or a value for 'replacement'. If you specify a value for 'regexp', specify a dot (.) for 'replacement'. + internal NaptrRecord(int? order, int? preference, string flags, string services, string regexp, string replacement) + { + Order = order; + Preference = preference; + Flags = flags; + Services = services; + Regexp = regexp; + Replacement = replacement; + } + + /// The order in which the NAPTR records MUST be processed in order to accurately represent the ordered list of rules. The ordering is from lowest to highest. Valid values: 0-65535. + public int? Order { get; set; } + /// The preference specifies the order in which NAPTR records with equal 'order' values should be processed, low numbers being processed before high numbers. Valid values: 0-65535. + public int? Preference { get; set; } + /// The flags specific to DDDS applications. Values currently defined in RFC 3404 are uppercase and lowercase letters "A", "P", "S", and "U", and the empty string, "". Enclose Flags in quotation marks. + public string Flags { get; set; } + /// The services specific to DDDS applications. Enclose Services in quotation marks. + public string Services { get; set; } + /// The regular expression that the DDDS application uses to convert an input value into an output value. For example: an IP phone system might use a regular expression to convert a phone number that is entered by a user into a SIP URI. Enclose the regular expression in quotation marks. Specify either a value for 'regexp' or a value for 'replacement'. + public string Regexp { get; set; } + /// The replacement is a fully qualified domain name (FQDN) of the next domain name that you want the DDDS application to submit a DNS query for. The DDDS application replaces the input value with the value specified for replacement. Specify either a value for 'regexp' or a value for 'replacement'. If you specify a value for 'regexp', specify a dot (.) for 'replacement'. + public string Replacement { get; set; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SigningKey.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SigningKey.Serialization.cs new file mode 100644 index 000000000000..44e7384d8b01 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SigningKey.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dns.Models +{ + public partial class SigningKey + { + internal static SigningKey DeserializeSigningKey(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> delegationSignerInfo = default; + Optional flags = default; + Optional keyTag = default; + Optional protocol = default; + Optional publicKey = default; + Optional securityAlgorithmType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("delegationSignerInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.DelegationSignerInfo.DeserializeDelegationSignerInfo(item)); + } + delegationSignerInfo = array; + continue; + } + if (property.NameEquals("flags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + flags = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("keyTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyTag = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("publicKey"u8)) + { + publicKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("securityAlgorithmType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + securityAlgorithmType = property.Value.GetInt32(); + continue; + } + } + return new SigningKey(Optional.ToList(delegationSignerInfo), Optional.ToNullable(flags), Optional.ToNullable(keyTag), Optional.ToNullable(protocol), publicKey.Value, Optional.ToNullable(securityAlgorithmType)); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SigningKey.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SigningKey.cs new file mode 100644 index 000000000000..2af6db8e3cff --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SigningKey.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Dns.Models +{ + /// Represents the signing key. + public partial class SigningKey + { + /// Initializes a new instance of SigningKey. + internal SigningKey() + { + DelegationSignerInfo = new ChangeTrackingList(); + } + + /// Initializes a new instance of SigningKey. + /// The delegation signer information. + /// The flags specifies how the key is used. + /// The key tag value of the DNSKEY Resource Record. + /// The protocol value. The value is always 3. + /// The public key, represented as a Base64 encoding. + /// The security algorithm type represents the standard security algorithm number of the DNSKEY Resource Record. See: https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml. + internal SigningKey(IReadOnlyList delegationSignerInfo, int? flags, int? keyTag, int? protocol, string publicKey, int? securityAlgorithmType) + { + DelegationSignerInfo = delegationSignerInfo; + Flags = flags; + KeyTag = keyTag; + Protocol = protocol; + PublicKey = publicKey; + SecurityAlgorithmType = securityAlgorithmType; + } + + /// The delegation signer information. + public IReadOnlyList DelegationSignerInfo { get; } + /// The flags specifies how the key is used. + public int? Flags { get; } + /// The key tag value of the DNSKEY Resource Record. + public int? KeyTag { get; } + /// The protocol value. The value is always 3. + public int? Protocol { get; } + /// The public key, represented as a Base64 encoding. + public string PublicKey { get; } + /// The security algorithm type represents the standard security algorithm number of the DNSKEY Resource Record. See: https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml. + public int? SecurityAlgorithmType { get; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SystemData.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SystemData.Serialization.cs new file mode 100644 index 000000000000..6b561f8bb61d --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SystemData.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dns.Models +{ + internal partial class SystemData + { + internal static SystemData DeserializeSystemData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional createdBy = default; + Optional createdByType = default; + Optional createdAt = default; + Optional lastModifiedBy = default; + Optional lastModifiedByType = default; + Optional lastModifiedAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("createdBy"u8)) + { + createdBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdByType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastModifiedBy"u8)) + { + lastModifiedBy = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedByType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedByType = new CreatedByType(property.Value.GetString()); + continue; + } + if (property.NameEquals("lastModifiedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModifiedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new SystemData(createdBy.Value, Optional.ToNullable(createdByType), Optional.ToNullable(createdAt), lastModifiedBy.Value, Optional.ToNullable(lastModifiedByType), Optional.ToNullable(lastModifiedAt)); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SystemData.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..4034010162e2 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/SystemData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Dns.Models +{ + /// Metadata pertaining to creation and last modification of the resource. + internal partial class SystemData + { + /// Initializes a new instance of SystemData. + internal SystemData() + { + } + + /// Initializes a new instance of SystemData. + /// The identity that created the resource. + /// The type of identity that created the resource. + /// The timestamp of resource creation (UTC). + /// The identity that last modified the resource. + /// The type of identity that last modified the resource. + /// The timestamp of resource last modification (UTC). + internal SystemData(string createdBy, CreatedByType? createdByType, DateTimeOffset? createdOn, string lastModifiedBy, CreatedByType? lastModifiedByType, DateTimeOffset? lastModifiedOn) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedOn = createdOn; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedOn = lastModifiedOn; + } + + /// The identity that created the resource. + public string CreatedBy { get; } + /// The type of identity that created the resource. + public CreatedByType? CreatedByType { get; } + /// The timestamp of resource creation (UTC). + public DateTimeOffset? CreatedOn { get; } + /// The identity that last modified the resource. + public string LastModifiedBy { get; } + /// The type of identity that last modified the resource. + public CreatedByType? LastModifiedByType { get; } + /// The timestamp of resource last modification (UTC). + public DateTimeOffset? LastModifiedOn { get; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/TlsaRecord.Serialization.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/TlsaRecord.Serialization.cs new file mode 100644 index 000000000000..cfa001c5f052 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/TlsaRecord.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dns.Models +{ + public partial class TlsaRecord : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Usage)) + { + writer.WritePropertyName("usage"u8); + writer.WriteNumberValue(Usage.Value); + } + if (Optional.IsDefined(Selector)) + { + writer.WritePropertyName("selector"u8); + writer.WriteNumberValue(Selector.Value); + } + if (Optional.IsDefined(MatchingType)) + { + writer.WritePropertyName("matchingType"u8); + writer.WriteNumberValue(MatchingType.Value); + } + if (Optional.IsDefined(CertAssociationData)) + { + writer.WritePropertyName("certAssociationData"u8); + writer.WriteStringValue(CertAssociationData); + } + writer.WriteEndObject(); + } + + internal static TlsaRecord DeserializeTlsaRecord(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional usage = default; + Optional selector = default; + Optional matchingType = default; + Optional certAssociationData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("usage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + usage = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("selector"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + selector = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("matchingType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + matchingType = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("certAssociationData"u8)) + { + certAssociationData = property.Value.GetString(); + continue; + } + } + return new TlsaRecord(Optional.ToNullable(usage), Optional.ToNullable(selector), Optional.ToNullable(matchingType), certAssociationData.Value); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/TlsaRecord.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/TlsaRecord.cs new file mode 100644 index 000000000000..3b38c3f29b79 --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Models/TlsaRecord.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dns.Models +{ + /// A TLSA record. For more information about the TLSA record format, see RFC 6698: https://www.rfc-editor.org/rfc/rfc6698. + public partial class TlsaRecord + { + /// Initializes a new instance of TlsaRecord. + public TlsaRecord() + { + } + + /// Initializes a new instance of TlsaRecord. + /// The usage specifies the provided association that will be used to match the certificate presented in the TLS handshake. + /// The selector specifies which part of the TLS certificate presented by the server will be matched against the association data. + /// The matching type specifies how the certificate association is presented. + /// This specifies the certificate association data to be matched. + internal TlsaRecord(int? usage, int? selector, int? matchingType, string certAssociationData) + { + Usage = usage; + Selector = selector; + MatchingType = matchingType; + CertAssociationData = certAssociationData; + } + + /// The usage specifies the provided association that will be used to match the certificate presented in the TLS handshake. + public int? Usage { get; set; } + /// The selector specifies which part of the TLS certificate presented by the server will be matched against the association data. + public int? Selector { get; set; } + /// The matching type specifies how the certificate association is presented. + public int? MatchingType { get; set; } + /// This specifies the certificate association data to be matched. + public string CertAssociationData { get; set; } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/DnsResourceReferenceRestOperations.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/DnsResourceReferenceRestOperations.cs index d912c189cfe7..dedd5567e5c8 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/DnsResourceReferenceRestOperations.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/DnsResourceReferenceRestOperations.cs @@ -33,7 +33,7 @@ public DnsResourceReferenceRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-05-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,7 +59,7 @@ internal HttpMessage CreateGetByTargetResourcesRequest(string subscriptionId, Dn } /// Returns the DNS records specified by the referencing targetResourceIds. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. + /// The ID of the target subscription. /// Properties for dns resource reference request. /// The cancellation token to use. /// or is null. @@ -86,7 +86,7 @@ public async Task> GetByTargetResourcesAsyn } /// Returns the DNS records specified by the referencing targetResourceIds. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. + /// The ID of the target subscription. /// Properties for dns resource reference request. /// The cancellation token to use. /// or is null. diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/DnssecConfigsRestOperations.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/DnssecConfigsRestOperations.cs new file mode 100644 index 000000000000..ec5a2d4fd52a --- /dev/null +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/DnssecConfigsRestOperations.cs @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Dns.Models; + +namespace Azure.ResourceManager.Dns +{ + internal partial class DnssecConfigsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DnssecConfigsRestOperations. + /// 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 DnssecConfigsRestOperations(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 HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string zoneName, ETag? 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/dnsZones/", false); + uri.AppendPath(zoneName, true); + uri.AppendPath("/dnssecConfigs/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Creates or updates the DNSSEC configuration on a DNS zone. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// The etag of the DNSSEC configuration. Omit this value to always overwrite the DNSSEC configuration. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow this DNSSEC configuration to be created, but to prevent updating existing DNSSEC configuration. 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 zoneName, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, zoneName, 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 the DNSSEC configuration on a DNS zone. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// The etag of the DNSSEC configuration. Omit this value to always overwrite the DNSSEC configuration. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. + /// Set to '*' to allow this DNSSEC configuration to be created, but to prevent updating existing DNSSEC configuration. 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 zoneName, ETag? ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, zoneName, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string zoneName, ETag? 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/dnsZones/", false); + uri.AppendPath(zoneName, true); + uri.AppendPath("/dnssecConfigs/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch.Value); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the DNSSEC configuration on a DNS zone. This operation cannot be undone. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// The etag of this DNSSEC configuration. Omit this value to always delete the DNSSEC configuration. Specify the last-seen etag value to prevent accidentally deleting 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 zoneName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, zoneName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the DNSSEC configuration on a DNS zone. This operation cannot be undone. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// The etag of this DNSSEC configuration. Omit this value to always delete the DNSSEC configuration. Specify the last-seen etag value to prevent accidentally deleting 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 zoneName, ETag? ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, zoneName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string zoneName) + { + 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/dnsZones/", false); + uri.AppendPath(zoneName, true); + uri.AppendPath("/dnssecConfigs/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the DNSSEC configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// 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 zoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, zoneName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnssecConfigData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnssecConfigData.DeserializeDnssecConfigData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnssecConfigData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the DNSSEC configuration. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// 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 zoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, zoneName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnssecConfigData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnssecConfigData.DeserializeDnssecConfigData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DnssecConfigData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDnsZoneRequest(string subscriptionId, string resourceGroupName, string zoneName) + { + 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/dnsZones/", false); + uri.AppendPath(zoneName, true); + uri.AppendPath("/dnssecConfigs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the DNSSEC configurations in a DNS zone. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByDnsZoneAsync(string subscriptionId, string resourceGroupName, string zoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateListByDnsZoneRequest(subscriptionId, resourceGroupName, zoneName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnssecConfigListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnssecConfigListResult.DeserializeDnssecConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the DNSSEC configurations in a DNS zone. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByDnsZone(string subscriptionId, string resourceGroupName, string zoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateListByDnsZoneRequest(subscriptionId, resourceGroupName, zoneName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnssecConfigListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnssecConfigListResult.DeserializeDnssecConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDnsZoneNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string zoneName) + { + 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 the DNSSEC configurations in a DNS zone. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByDnsZoneNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string zoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateListByDnsZoneNextPageRequest(nextLink, subscriptionId, resourceGroupName, zoneName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DnssecConfigListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DnssecConfigListResult.DeserializeDnssecConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the DNSSEC configurations in a DNS zone. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the DNS zone (without a terminating dot). + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByDnsZoneNextPage(string nextLink, string subscriptionId, string resourceGroupName, string zoneName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(zoneName, nameof(zoneName)); + + using var message = CreateListByDnsZoneNextPageRequest(nextLink, subscriptionId, resourceGroupName, zoneName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DnssecConfigListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DnssecConfigListResult.DeserializeDnssecConfigListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/RecordSetsRestOperations.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/RecordSetsRestOperations.cs index 6864aa97c688..c246b9f6aa0e 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/RecordSetsRestOperations.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/RecordSetsRestOperations.cs @@ -33,7 +33,7 @@ public RecordSetsRestOperations(HttpPipeline pipeline, string applicationId, Uri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-05-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -70,8 +70,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates a record set within a DNS zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The type of DNS record in this record set. /// The name of the record set, relative to the name of the zone. @@ -105,8 +105,8 @@ public async Task> UpdateAsync(string subscriptionId, st } /// Updates a record set within a DNS zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The type of DNS record in this record set. /// The name of the record set, relative to the name of the zone. @@ -175,11 +175,11 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r return message; } - /// Creates or updates a record set within a DNS zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). - /// The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// The type of DNS record in this record set. /// The name of the record set, relative to the name of the zone. /// Parameters supplied to the CreateOrUpdate operation. /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. @@ -212,11 +212,11 @@ public async Task> CreateOrUpdateAsync(string subscripti } } - /// Creates or updates a record set within a DNS zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). - /// The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). + /// The type of DNS record in this record set. /// The name of the record set, relative to the name of the zone. /// Parameters supplied to the CreateOrUpdate operation. /// The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. @@ -277,11 +277,11 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Deletes a record set from a DNS zone. This operation cannot be undone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). - /// The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// The type of DNS record in this record set. /// The name of the record set, relative to the name of the zone. /// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. /// The cancellation token to use. @@ -306,11 +306,11 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Deletes a record set from a DNS zone. This operation cannot be undone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). - /// The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). + /// The type of DNS record in this record set. /// The name of the record set, relative to the name of the zone. /// The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. /// The cancellation token to use. @@ -360,8 +360,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets a record set. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The type of DNS record in this record set. /// The name of the record set, relative to the name of the zone. @@ -394,8 +394,8 @@ public async Task> GetAsync(string subscriptionId, strin } /// Gets a record set. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The type of DNS record in this record set. /// The name of the record set, relative to the name of the zone. @@ -458,10 +458,10 @@ internal HttpMessage CreateListByTypeRequest(string subscriptionId, string resou } /// Lists the record sets of a specified type in a DNS zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). - /// The type of record sets to enumerate. + /// The type of DNS record in this record set. /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. /// The cancellation token to use. @@ -490,10 +490,10 @@ public async Task> ListByTypeAsync(string subscrip } /// Lists the record sets of a specified type in a DNS zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). - /// The type of record sets to enumerate. + /// The type of DNS record in this record set. /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. /// The cancellation token to use. @@ -551,8 +551,8 @@ internal HttpMessage CreateListByDnsZoneRequest(string subscriptionId, string re } /// Lists all record sets in a DNS zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. @@ -582,8 +582,8 @@ public async Task> ListByDnsZoneAsync(string subsc } /// Lists all record sets in a DNS zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. @@ -628,10 +628,10 @@ internal HttpMessage CreateListByTypeNextPageRequest(string nextLink, string sub /// Lists the record sets of a specified type in a DNS zone. /// The URL to the next page of results. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). - /// The type of record sets to enumerate. + /// The type of DNS record in this record set. /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. /// The cancellation token to use. @@ -662,10 +662,10 @@ public async Task> ListByTypeNextPageAsync(string /// Lists the record sets of a specified type in a DNS zone. /// The URL to the next page of results. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). - /// The type of record sets to enumerate. + /// The type of DNS record in this record set. /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. /// The cancellation token to use. @@ -710,8 +710,8 @@ internal HttpMessage CreateListByDnsZoneNextPageRequest(string nextLink, string /// Lists all record sets in a DNS zone. /// The URL to the next page of results. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. @@ -743,8 +743,8 @@ public async Task> ListByDnsZoneNextPageAsync(stri /// Lists all record sets in a DNS zone. /// The URL to the next page of results. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .<recordSetNameSuffix>. diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/ZonesRestOperations.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/ZonesRestOperations.cs index 6fcad23250ae..a44a7d1b3e5a 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/ZonesRestOperations.cs +++ b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/RestOperations/ZonesRestOperations.cs @@ -33,7 +33,7 @@ public ZonesRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-05-01"; + _apiVersion = apiVersion ?? "2023-07-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -70,8 +70,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Creates or updates a DNS zone. Does not modify DNS records within the zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// Parameters supplied to the CreateOrUpdate operation. /// The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. @@ -104,8 +104,8 @@ public async Task> CreateOrUpdateAsync(string subscription } /// Creates or updates a DNS zone. Does not modify DNS records within the zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// Parameters supplied to the CreateOrUpdate operation. /// The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. @@ -162,8 +162,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. /// The cancellation token to use. @@ -189,8 +189,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. /// The cancellation token to use. @@ -236,8 +236,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The cancellation token to use. /// , or is null. @@ -267,8 +267,8 @@ public async Task> GetAsync(string subscriptionId, string } /// Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// The cancellation token to use. /// , or is null. @@ -326,8 +326,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Updates a DNS zone. Does not modify DNS records within the zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// Parameters supplied to the Update operation. /// The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. @@ -358,8 +358,8 @@ public async Task> UpdateAsync(string subscriptionId, stri } /// Updates a DNS zone. Does not modify DNS records within the zone. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the DNS zone (without a terminating dot). /// Parameters supplied to the Update operation. /// The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. @@ -413,8 +413,8 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str } /// Lists the DNS zones within a resource group. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The cancellation token to use. /// or is null. @@ -441,8 +441,8 @@ public async Task> ListByResourceGroupAsync(string s } /// Lists the DNS zones within a resource group. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The cancellation token to use. /// or is null. @@ -490,7 +490,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, int? top) } /// Lists the DNS zones in all resource groups in a subscription. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. + /// The ID of the target subscription. /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. /// The cancellation token to use. /// is null. @@ -516,7 +516,7 @@ public async Task> ListAsync(string subscriptionId, } /// Lists the DNS zones in all resource groups in a subscription. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. + /// The ID of the target subscription. /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. /// The cancellation token to use. /// is null. @@ -557,8 +557,8 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// Lists the DNS zones within a resource group. /// The URL to the next page of results. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The cancellation token to use. /// , or is null. @@ -587,8 +587,8 @@ public async Task> ListByResourceGroupNextPageAsync( /// Lists the DNS zones within a resource group. /// The URL to the next page of results. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The maximum number of record sets to return. If not specified, returns up to 100 record sets. /// The cancellation token to use. /// , or is null. @@ -631,7 +631,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Lists the DNS zones in all resource groups in a subscription. /// The URL to the next page of results. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. + /// The ID of the target subscription. /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. /// The cancellation token to use. /// or is null. @@ -659,7 +659,7 @@ public async Task> ListNextPageAsync(string nextLink /// Lists the DNS zones in all resource groups in a subscription. /// The URL to the next page of results. - /// Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. + /// The ID of the target subscription. /// The maximum number of DNS zones to return. If not specified, returns up to 100 zones. /// The cancellation token to use. /// or is null. diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/autorest.md b/sdk/dns/Azure.ResourceManager.Dns/src/autorest.md index 4a99827bec54..adf5450bd031 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/autorest.md +++ b/sdk/dns/Azure.ResourceManager.Dns/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true generate-model-factory: false library-name: Dns namespace: Azure.ResourceManager.Dns -require: https://github.com/Azure/azure-rest-api-specs/blob/48a49f06399fbdf21f17406b5042f96a5d573bf0/specification/dns/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dns/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true @@ -128,4 +128,4 @@ directive: transform: > $.RecordSetProperties.properties.MXRecords["x-ms-client-name"] = "MXRecords"; $.RecordSetProperties.properties.NSRecords["x-ms-client-name"] = "NSRecords"; -``` \ No newline at end of file +```